Context for evaluating expressions of derived tags. More...
#include <expression.h>
Public Member Functions | |
| TagexprContext (const std::set< std::string > &tags, const std::map< std::string, Expression > &derivedTags) | |
| Create a context for recursive tagset evaluation. | |
| bool | eval (const std::string &tag) const |
| Evaluates the input tags on the contents to see if they contain the given tag, or if they match its associated tag expression if tag is a derived tag. | |
Protected Attributes | |
| const std::set< std::string > & | tags |
| const std::map< std::string, Expression > & | derivedTags |
| std::set< std::string > | seen |
Context for evaluating expressions of derived tags.
A derived tag is a tag which is automatically inferred when a tag expression is matched on a tagset.
TagexprContext allows the inference engine to distinguish between a normal tag or a derived tag.
This class is mainly used to support DerivedTags and has probably little applications elsewhere.
| tagcoll::TagexprContext::TagexprContext | ( | const std::set< std::string > & | tags, | |
| const std::map< std::string, Expression > & | derivedTags | |||
| ) | [inline] |
Create a context for recursive tagset evaluation.
Evaluation happens using a derivation table, which can list a tag as an alias for another tag expression. Whenever a tag is matched for equality with a derived tag, the match is performed with the derived tag expression instead.
| tags | The tags to evaluate | |
| derivedTags | The table of derived tags to use in the evaluation |
| bool tagcoll::TagexprContext::eval | ( | const std::string & | tag | ) | const |
Evaluates the input tags on the contents to see if they contain the given tag, or if they match its associated tag expression if tag is a derived tag.
References derivedTags, and seen.
const std::map<std::string, Expression>& tagcoll::TagexprContext::derivedTags [protected] |
Referenced by eval().
std::set<std::string> tagcoll::TagexprContext::seen [mutable, protected] |
Referenced by eval().
const std::set<std::string>& tagcoll::TagexprContext::tags [protected] |
1.6.2