![]() |
HAL
|
Checks if a given string is unique compared to other given strings. More...
#include <unique_string_validator.h>
Public Member Functions | |
UniqueStringValidator (const QStringList &unique_strings) | |
bool | validate (const QString &input) |
![]() | |
void | setFailText (const QString &text) |
QString | failText () const |
Additional Inherited Members | |
![]() | |
QString | mFailText = "Chosen input is not allowed." |
Checks if a given string is unique compared to other given strings.
The UniqueStringValidator is a Validator which validate function returns true if the candidate string does not appear in the list of unique strings passed in the constructor. It should be used whenever an input must not contain an already used identifier.
Definition at line 42 of file unique_string_validator.h.
hal::UniqueStringValidator::UniqueStringValidator | ( | const QStringList & | unique_strings | ) |
Constructor.
unique_strings | - The black list of strings that will cause the validate function to return false |
Definition at line 5 of file unique_string_validator.cpp.
References hal::Validator::setFailText().
|
virtual |
Given any string this function returns true iff the string does not appear in the unique_string list passed to the constructor.
input | - The input string |
Implements hal::Validator.
Definition at line 10 of file unique_string_validator.cpp.
References QStringList::contains(), and hal::input.