Content


NTL
Core
CDbValidatorCompare

CDbValidatorCompare


Comparison validator which compare attribute value to either another attribute value or to directly specified value.

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

class CDbValidatorCompare :public CDbValidator
{
public:
    enum class Operator // Comparison operator type 
    {
        StrictEquals, // = with type check 
        Equals, // = 
        StrictNotEquals, // != with type check 
        NotEquals, // != 
        Greater, // > 
        GreaterEquals, // >= 
        Less, // < 
        LessEquals // <= 
    };

    enum class Operands // Operand type 
    {
        Strings,
        Integers,
        Floats
    };
public:
    // IDbValidator methods 
    bool Validate(CDbModel *model, IDbAttribute *attribute, String &error) override;

    CDbValidatorCompare();

    CDbValidatorCompare *setOperator(const Operator &value); // Set comparison operator type 
    CDbValidatorCompare *setOperands(const Operands &value); // Set operands type 
    CDbValidatorCompare *setAttribute(const String &value); // Set attribute name to be compared with 
    CDbValidatorCompare *setValue(const DbValue &value); // Set value to be compared with 
    CDbValidatorCompare *setTolerance(const double &value); // Set absolute comparison tolerance when comparing float values 
    CDbValidatorCompare *setRelativeTolerance(const bool &value); // Set relative comparison tolerance when comparing float values 
    CDbValidatorCompare *setMessageNoAttribute(const String &value); // Set error message indicating specified attribute is not found in model 

    static ReleasablePtr<CDbValidatorCompare> Create(); // Helper static method to create validator in form used in model rule adding methods 
};
Namespace: nitisa
Include: Nitisa/Db/DbValidatorCompare.h