#include <validator.h>
Public Member Functions | |
| MultiValidator (TQObject *parent=0, const char *name=0) | |
| MultiValidator (TQValidator *validator, TQObject *parent=0, const char *name=0) | |
| void | addSubvalidator (TQValidator *validator, bool owned=true) |
| virtual TQValidator::State | validate (TQString &input, int &pos) const |
| virtual void | fixup (TQString &input) const |
Public Member Functions inherited from KexiUtils::Validator | |
| Validator (TQObject *parent=0, const char *name=0) | |
| void | setAcceptsEmptyValue (bool set) |
| bool | acceptsEmptyValue () const |
| Result | check (const TQString &valueName, const TQVariant &v, TQString &message, TQString &details) |
| void | addChildValidator (Validator *v) |
Protected Attributes | |
| TQPtrList< TQValidator > | m_ownedSubValidators |
| TQValueList< TQValidator * > | m_subValidators |
Protected Attributes inherited from KexiUtils::Validator | |
| bool | m_acceptsEmptyValue: 1 |
Additional Inherited Members | |
Public Types inherited from KexiUtils::Validator | |
| enum | Result { Error = 0 , Ok = 1 , Warning = 2 } |
Static Public Member Functions inherited from KexiUtils::Validator | |
| static const TQString | msgColumnNotEmpty () |
Detailed Description
A validator groupping multiple TQValidators.
MultiValidator behaves like normal KexiUtils::Validator, but it allows to add define more than one different validator. Given validation is successful if every subvalidator accepted given value.
- acceptsEmptyValue() is used globally here (no matter what is defined in subvalidators).
- result of calling check() depends on value of check() returned by subvalidators:
- Error is returned if at least one subvalidator returned Error;
- Warning is returned if at least one subvalidator returned Warning and no validator returned error;
- Ok is returned only if exactly all subvalidators returned Ok.
- If there is no subvalidators defined, Error is always returned.
- If a given subvalidator is not of class Validator but ust TQValidator, it's assumed it's check() method returned Ok.
- result of calling validate() (a method implemented for TQValidator) depends on value of validate() returned by subvalidators:
- Invalid is returned if at least one subvalidator returned Invalid
- Intermediate is returned if at least one subvalidator returned Intermediate
- Acceptable is returned if exactly all subvalidators returned Acceptable.
- If there is no subvalidators defined, Invalid is always returned.
If there are no subvalidators, the multi validator always accepts the input.
Definition at line 120 of file validator.h.
Constructor & Destructor Documentation
◆ MultiValidator() [1/2]
| MultiValidator::MultiValidator | ( | TQObject * | parent = 0, |
| const char * | name = 0 |
||
| ) |
Constructs multivalidator with no subvalidators defined. You can add more validators with addSubvalidator().
Definition at line 60 of file validator.cpp.
◆ MultiValidator() [2/2]
| MultiValidator::MultiValidator | ( | TQValidator * | validator, |
| TQObject * | parent = 0, |
||
| const char * | name = 0 |
||
| ) |
Constructs multivalidator with one validator validator. It will be owned if has no parent defined. You can add more validators with addSubvalidator().
Definition at line 66 of file validator.cpp.
Member Function Documentation
◆ addSubvalidator()
| void MultiValidator::addSubvalidator | ( | TQValidator * | validator, |
| bool | owned = true |
||
| ) |
Adds validator validator as another subvalidator. Subvalidator will be owned by this multivalidator if owned is true and its parent is NULL.
Definition at line 74 of file validator.cpp.
◆ fixup()
|
virtual |
Calls TQValidator::fixup() on every subvalidator. This may be senseless to use this methog in certain cases (can return weir results), so think twice before..
Definition at line 94 of file validator.cpp.
◆ validate()
|
virtual |
Reimplemented to call validate() on subvalidators.
Reimplemented from KexiUtils::Validator.
Definition at line 83 of file validator.cpp.
Member Data Documentation
◆ m_ownedSubValidators
|
protected |
Definition at line 152 of file validator.h.
◆ m_subValidators
|
protected |
Definition at line 153 of file validator.h.
The documentation for this class was generated from the following files:

Public Member Functions inherited from