#include <validator.h>
Public Types | |
| enum | Result { Error = 0 , Ok = 1 , Warning = 2 } |
Public Member Functions | |
| 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) |
| virtual TQValidator::State | validate (TQString &input, int &pos) const |
| void | addChildValidator (Validator *v) |
Static Public Member Functions | |
| static const TQString | msgColumnNotEmpty () |
Protected Member Functions | |
| virtual Result | internalCheck (const TQString &valueName, const TQVariant &v, TQString &message, TQString &details) |
Protected Attributes | |
| bool | m_acceptsEmptyValue: 1 |
Friends | |
| class | MultiValidator |
Detailed Description
A validator extending TQValidator with offline-checking for value's validity.
The offline-checking for value's validity is provided by Validator::check() method. The validator groups two purposes into one container:
- string validator for line editors (online checking, "on typing");
- offline-checking for TQVariant values, reimplementing validate().
It also offers error and warning messages for check() method. You may need to reimplement:
- TQValidator::State IdentifierValidator::validate( TQString& input, int& pos ) const;
- Result check(const TQString &valueName, TQVariant v, TQString &message, TQString &details);
Definition at line 45 of file validator.h.
Member Enumeration Documentation
◆ Result
| enum KexiUtils::Validator::Result |
Definition at line 48 of file validator.h.
Constructor & Destructor Documentation
◆ Validator()
| Validator::Validator | ( | TQObject * | parent = 0, |
| const char * | name = 0 |
||
| ) |
Definition at line 24 of file validator.cpp.
◆ ~Validator()
|
virtual |
Definition at line 30 of file validator.cpp.
Member Function Documentation
◆ acceptsEmptyValue()
|
inline |
- Returns
- true if the validator accepts empty values
- See also
- setAcceptsEmptyValue()
Definition at line 59 of file validator.h.
◆ addChildValidator()
◆ check()
| Validator::Result Validator::check | ( | const TQString & | valueName, |
| const TQVariant & | v, | ||
| TQString & | message, | ||
| TQString & | details | ||
| ) |
Checks if value v is ok and returns one of Result value:
- Error is returned on error;
- Ok on success;
- Warning if there is something to warn about. In any case except Ok, i18n'ed message will be set in message and (optionally) datails are set in details, e.g. for use in a message box. valueName can be used to contruct message as well, for example: "[valueName] is not a valid login name". Depending on acceptsEmptyValue(), immediately accepts empty values or not.
Definition at line 34 of file validator.cpp.
◆ internalCheck()
|
protectedvirtual |
Definition at line 47 of file validator.cpp.
◆ msgColumnNotEmpty()
A generic error/warning message.
Definition at line 77 of file validator.h.
◆ setAcceptsEmptyValue()
|
inline |
Sets accepting empty values on (true) or off (false). By default the validator does not accepts empty values.
Definition at line 55 of file validator.h.
◆ validate()
|
virtual |
This implementation always returns value TQValidator::Acceptable.
Reimplemented in KexiUtils::IdentifierValidator, and KexiUtils::MultiValidator.
Definition at line 53 of file validator.cpp.
Friends And Related Symbol Documentation
◆ MultiValidator
|
friend |
Definition at line 91 of file validator.h.
Member Data Documentation
◆ m_acceptsEmptyValue
|
protected |
Definition at line 89 of file validator.h.
The documentation for this class was generated from the following files:
