KatePrefixStore

Search for usage in LXR

#include <prefixstore.h>

Public Types

typedef QPair< bool, bool > BooleanPair
 

Public Member Functions

void addPrefix (const QString &prefix)
 
void clear ()
 
void dump ()
 
QString findPrefix (const Kate::TextLine &line, int start=0) const
 
QString findPrefix (const QString &s, int start=0) const
 
int longestPrefixLength () const
 
void removePrefix (const QString &prefix)
 

Protected Types

typedef QHash< unsigned short, QPair< unsigned int, unsigned long long > > CharToOccurrenceStateHash
 
typedef QHash< unsigned long long, CharToOccurrenceStateHashTransitionFunction
 

Protected Member Functions

int computeLongestPrefixLength ()
 
unsigned long long nextFreeState ()
 

Protected Attributes

QSet< unsigned long long > m_acceptingStates
 
unsigned long long m_lastAssignedState = 0
 
int m_longestPrefixLength = 0
 
QSet< QStringm_prefixSet
 
QList< unsigned long long > m_stateFreeList
 
TransitionFunction m_transitionFunction
 

Detailed Description

This class can be used to efficiently search for occurrences of strings in a given string.

Theoretically speaking, a finite deterministic automaton is constructed which exactly accepts the strings that are to be recognized. In order to check whether a given string contains one of the strings that are being searched for the constructed automaton has to applied on each position in the given string.

Definition at line 26 of file prefixstore.h.

Member Typedef Documentation

◆ BooleanPair

QPair<bool, bool> KatePrefixStore::BooleanPair

Definition at line 29 of file prefixstore.h.

◆ CharToOccurrenceStateHash

QHash<unsigned short, QPair<unsigned int, unsigned long long> > KatePrefixStore::CharToOccurrenceStateHash
protected

Definition at line 59 of file prefixstore.h.

◆ TransitionFunction

Definition at line 60 of file prefixstore.h.

Member Function Documentation

◆ addPrefix()

void KatePrefixStore::addPrefix ( const QString & prefix)

Definition at line 11 of file prefixstore.cpp.

◆ clear()

void KatePrefixStore::clear ( )

Definition at line 136 of file prefixstore.cpp.

◆ computeLongestPrefixLength()

int KatePrefixStore::computeLongestPrefixLength ( )
protected

Definition at line 146 of file prefixstore.cpp.

◆ dump()

void KatePrefixStore::dump ( )

Definition at line 82 of file prefixstore.cpp.

◆ findPrefix() [1/2]

QString KatePrefixStore::findPrefix ( const Kate::TextLine & line,
int start = 0 ) const

Returns the shortest prefix of the given string that is contained in this prefix store starting at position 'start'.

Definition at line 112 of file prefixstore.cpp.

◆ findPrefix() [2/2]

QString KatePrefixStore::findPrefix ( const QString & s,
int start = 0 ) const

Returns the shortest prefix of the given string that is contained in this prefix store starting at position 'start'.

Definition at line 93 of file prefixstore.cpp.

◆ longestPrefixLength()

int KatePrefixStore::longestPrefixLength ( ) const

Definition at line 131 of file prefixstore.cpp.

◆ nextFreeState()

unsigned long long KatePrefixStore::nextFreeState ( )
protected

Definition at line 156 of file prefixstore.cpp.

◆ removePrefix()

void KatePrefixStore::removePrefix ( const QString & prefix)

Definition at line 44 of file prefixstore.cpp.

Member Data Documentation

◆ m_acceptingStates

QSet<unsigned long long> KatePrefixStore::m_acceptingStates
protected

Definition at line 62 of file prefixstore.h.

◆ m_lastAssignedState

unsigned long long KatePrefixStore::m_lastAssignedState = 0
protected

Definition at line 64 of file prefixstore.h.

◆ m_longestPrefixLength

int KatePrefixStore::m_longestPrefixLength = 0
protected

Definition at line 55 of file prefixstore.h.

◆ m_prefixSet

QSet<QString> KatePrefixStore::m_prefixSet
protected

Definition at line 56 of file prefixstore.h.

◆ m_stateFreeList

QList<unsigned long long> KatePrefixStore::m_stateFreeList
protected

Definition at line 63 of file prefixstore.h.

◆ m_transitionFunction

TransitionFunction KatePrefixStore::m_transitionFunction
protected

Definition at line 61 of file prefixstore.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:11:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.