#include <rulesmanager.h>
Public Types | |
| typedef int | priority_t |
Public Member Functions | |
| virtual | ~IRuleMatcher () |
| virtual bool | betterMatch (const priority_t &prio1, const priority_t &prio2) const |
| virtual bool | operator() (const RuleType &original, const RuleType &rule, priority_t *priority) const =0 |
Class for rule matching.
Provides interface for generic rules comparing. Rule is specified as template parameter RuleType. Implementation specific match algorithm should be implemented in functional operator defined by implementator.
When multiple matches can occure (multiple rules matche one original), priority should be compared and one with the highest (according betterMatch method) should be used.
| typedef int rulesmanager::IRuleMatcher< RuleType >::priority_t |
Type for matching priority. Use betterMatch method for priority comparing.
Reimplemented in configuration::ModeMatcher, and configuration::StringMatcher.
| virtual rulesmanager::IRuleMatcher< RuleType >::~IRuleMatcher | ( | ) | [inline, virtual] |
Virtual destructor.
| virtual bool rulesmanager::IRuleMatcher< RuleType >::betterMatch | ( | const priority_t & | prio1, | |
| const priority_t & | prio2 | |||
| ) | const [inline, virtual] |
Checks whether prio2 is higher than prio1.
| prio1 | Priority. | |
| prio2 | Priority. |
Referenced by rulesmanager::RulesManager< std::string, std::string >::findMatching().
| virtual bool rulesmanager::IRuleMatcher< RuleType >::operator() | ( | const RuleType & | original, | |
| const RuleType & | rule, | |||
| priority_t * | priority | |||
| ) | const [pure virtual] |
Functor to compare given rules.
| original | Rule from configuration. | |
| rule | Rule to check. | |
| priority | Place where to set priority if given rule matches (if NULL, nothing is set). |
Implementator should define when given rules matches and formulate priorities if multiple rules can match original. Match with higher priority should have higher precedence (use betterMatch method for priority comparing).
If given rule matches and priority parameter is non NULL, sets priority to place where it points.