This project is read-only.
Project Description

A validation rule is a condition that evaluates on an object. When it is applied, if the condition evaluates to true an action is executed; if it evaluates to false another action is executed.
validrulescpp is a C++ rule validation framework with a business rules-like declarative approach. It has the following features:
  • Definition of a rule by its name, boolean expression, base object and 1 additional argument in case of need.
  • A rule can be reused, evaluated and applied multiples times, with not need of redefinition, with different base object and argument.
  • The evaluated expression is a simple C++ boolean expression.
  • The actions to execute after the rule is evaluated are simple C++ statements.
  • Once the rule is evaluated or applied, the evaluation result can be revisited with no additional cost and no need to reapply.
  • Each rule represents a C++ class with the following methods:
    • GetRuleName: Gets the unique rule identifier or name.
    • GetRuleExpression: Gets a string representation of the boolean expression of the rule.
    • GetLastValidationResult: Gets the last result of the rule's evaluation.
    • GetTimesApplied: Gets the amount of times the rule was applied (its expression is evaluated and the corresponding action is executed).
  • A validation scope may be defined. This means that the result of GetLastValidationResult and GetTimesApplied of the rules are relative to the current scope.
  • A rule can possess precedent rules. This means that before a rule is applied, the preceding rules must be applied first. If they are not applied, an exception is thrown.
  • The framework's macros make easy and speed up the creation, application and processing of rules.
  • The mix of adequate AOP techniques with rule creation and validation can lead to a fine separation of concerns.

Last edited Jun 6, 2013 at 3:33 AM by kuritsu, version 4