Workspace 6.21.5
|
Super basic trie class for validating strings. Speeds up the code needed for some autocomplete / validation used in QLineEdits. More...
#include <DataAnalysis/DataStructures/trie.h>
Public Types | |
enum | State { Invalid = QValidator::Invalid , Intermediate = QValidator::Intermediate , Accepted = QValidator::Acceptable } |
Public Member Functions | |
Trie () | |
Trie (const QStringList &strings) | |
~Trie () | |
void | addString (const QString &string) |
void | addStrings (const QStringList &strings) |
int | charCount (bool includeNullChars=false) const |
void | clear () |
bool | empty () const |
State | validate (const QString &string) const |
To use it, add as many strings as you like to the trie, then validate input strings using the validate function.
enum State |
Trie | ( | ) |
Trie | ( | const QStringList & | strings | ) |
strings | List of strings to initialise the trie with. |
~Trie | ( | ) |
void addString | ( | const QString & | str | ) |
str | The string to be inserted into the trie. |
Adds a string to the trie so that it's available for validation.
void addStrings | ( | const QStringList & | strings | ) |
strings | The strings to add to the trie. |
int charCount | ( | bool | includeNullChars = false | ) | const |
includeNullChars | If enabled, this will include the null terminator characters in the count. |
void clear | ( | ) |
Clears the trie, ensuring it has no values.
bool empty | ( | ) | const |
Trie::State validate | ( | const QString & | string | ) | const |