![]() |
HAL
|
Combines different validators into one. More...
#include <stacked_validator.h>
Public Member Functions | |
StackedValidator () | |
void | addValidator (Validator *v) |
void | removeValidator (Validator *v) |
void | clearValidators () |
bool | validate (const QString &input) |
![]() | |
void | setFailText (const QString &text) |
QString | failText () const |
Additional Inherited Members | |
![]() | |
QString | mFailText = "Chosen input is not allowed." |
Combines different validators into one.
The StackedValidator is a Validator that combines multiple other Validators. Its validate function returns true if all added Validators accept the string.
The fail text will be chosen from the firstly added validator which validation fails.
Definition at line 42 of file stacked_validator.h.
hal::StackedValidator::StackedValidator | ( | ) |
Constructor. At this point the StackedValidator will accept any string. Therefore one should add validators by calling addValidator.
Definition at line 4 of file stacked_validator.cpp.
void hal::StackedValidator::addValidator | ( | Validator * | v | ) |
Adds a Validator to the StackedValidator.
v | - The Validator to add |
Definition at line 9 of file stacked_validator.cpp.
Referenced by hal::InputDialog::addValidator().
void hal::StackedValidator::clearValidators | ( | ) |
Removes all Validators from the StackedValidator.
Definition at line 19 of file stacked_validator.cpp.
Referenced by hal::InputDialog::clearValidators().
void hal::StackedValidator::removeValidator | ( | Validator * | v | ) |
Removes a Validator from the StackedValidator.
v | - The Validator to remove |
Definition at line 14 of file stacked_validator.cpp.
Referenced by hal::InputDialog::removeValidator().
|
virtual |
Given any string this function returns true iff the string is accepted by all registered Validators (added by StackedValidator:addValidator).
If no Validator is registered this function always returns true. If one or more Validators reject the string, the fail text of the failing Validator that was added the earliest will be chosen.
input | - The input string |
Implements hal::Validator.
Definition at line 24 of file stacked_validator.cpp.
References hal::input, and hal::Validator::setFailText().