Content


NTL
Core
CDbValidator

CDbValidator


This is a base class for validators that provides common functionality.

You can find more information in comments below. Overrided methods can be found in corresponding base class or interface.

class CDbValidator :public virtual IDbValidator, public CReleasable
{
protected:
    String m_sMessage; // Error message 
    StringArray m_aOn; // Array of scenarios the validator to be active in 
    StringArray m_aExcept; // Array of scenarios the validator should be turned off 
    bool m_bSkipOnError; // Whether to skip validation if attribute already has an error 
    bool m_bSkipOnEmpty; // Whether to skip validation if attribute is empty (Null) 
    FWhen m_fWhen; // Custom function to check whether validation is required 
protected:
    bool ShouldSkip(CDbModel *model, IDbAttribute *attribute); // Check whether attribute validation should be skipped depending on On/Except/SkipOnError/SkipOnEmpty/When properties 
public:
    // IDbValidator setters 
    IDbValidator *setCode(const int value) override;
    IDbValidator *setMessage(const String &value) override;
    IDbValidator *setOn(const StringArray &value) override;
    IDbValidator *setExcept(const StringArray &value) override;
    IDbValidator *setSkipOnError(const bool &value) override;
    IDbValidator *setSkipOnEmpty(const bool &value) override;
    IDbValidator *setWhen(FWhen value) override;

    CDbValidator();
};
Namespace: nitisa
Include: Nitisa/Db/DbValidator.h