DocumentValidator Class Reference
Declared in |
|
template <class T> class DocumentValidator; |
flip::DocumentValidator is the base of document validators.
Template Parameters
| The root class to validate. |
Member Functions Synopsys
Receives document validation request notification |
Member Functions
validate
virtual void validate (T & root) = 0; |
To receive document change notification, one will inherit from this class and implement this function.
When a validation error is encountered, the function must throw to notify the flip system that validation failed. The macro flip_VALIDATION_FAILED is provided for convenience.
Example:
class MyValidator : public flip::DocumentValidator <MyRootClass> |
{ |
public: |
virtual void document_changed (MyRootClass & root) override; |
}; |
void MyValidator::document_changed (MyRootClass & root) |
{ |
if (root.changed ()) |
{ |
if (root.tempo < 20.0) flip_VALIDATION_FAILED ("incorrect tempo"); |
} |
} |