////////////////////////////////////////////////////////////////////////// Class holding one ruleset. A ruleset is one (or more) pre-conditions, and one (or more) operators.
| 36 | // one (or more) operators. |
| 37 | // |
| 38 | class RuleSet |
| 39 | { |
| 40 | public: |
| 41 | // Holding the IF and ELSE operators and mods, in two separate linked lists. |
| 42 | struct OperatorPair { |
| 43 | OperatorPair() = default; |
| 44 | |
| 45 | OperatorPair(const OperatorPair &) = delete; |
| 46 | OperatorPair &operator=(const OperatorPair &) = delete; |
| 47 | |
| 48 | Operator *oper = nullptr; |
| 49 | OperModifiers oper_mods = OPER_NONE; |
| 50 | }; |
| 51 | |
| 52 | RuleSet() { Dbg(dbg_ctl, "RuleSet CTOR"); } |
| 53 | |
| 54 | ~RuleSet() |
| 55 | { |
| 56 | Dbg(dbg_ctl, "RulesSet DTOR"); |
| 57 | delete _operators[0].oper; // These are pointers |
| 58 | delete _operators[1].oper; |
| 59 | delete next; |
| 60 | } |
| 61 | |
| 62 | // noncopyable |
| 63 | RuleSet(const RuleSet &) = delete; |
| 64 | void operator=(const RuleSet &) = delete; |
| 65 | |
| 66 | // No reason to inline these |
| 67 | void append(RuleSet *rule); |
| 68 | Condition *make_condition(Parser &p, const char *filename, int lineno); |
| 69 | bool add_operator(Parser &p, const char *filename, int lineno); |
| 70 | ResourceIDs get_all_resource_ids() const; |
| 71 | |
| 72 | bool |
| 73 | has_operator() const |
| 74 | { |
| 75 | return (nullptr != _operators[0].oper) || (nullptr != _operators[1].oper); |
| 76 | } |
| 77 | |
| 78 | void |
| 79 | set_hook(TSHttpHookID hook) |
| 80 | { |
| 81 | _hook = hook; |
| 82 | } |
| 83 | |
| 84 | ConditionGroup * |
| 85 | get_group() |
| 86 | { |
| 87 | return &_group; |
| 88 | } |
| 89 | |
| 90 | TSHttpHookID |
| 91 | get_hook() const |
| 92 | { |
| 93 | return _hook; |
| 94 | } |
| 95 |