// Parse bool CSelectionCriterionRule::parse(CRuleParser &ruleParser, string &strError) { // Criterion _pSelectionCriterion = ruleParser.getSelectionCriteriaDefinition()->getSelectionCriterion(ruleParser.getType()); // Check existence if (!_pSelectionCriterion) { strError = "Couldn't find selection criterion " + ruleParser.getType(); return false; } // Verb string strMatchesWhen; if (!ruleParser.next(strMatchesWhen, strError)) { return false; } // Value string strValue; if (!ruleParser.next(strValue, strError)) { return false; } // Matches when if (!setMatchesWhen(strMatchesWhen, strError)) { strError = "Verb error: " + strError; return false; } // Value if (!_pSelectionCriterion->getCriterionType()->getNumericalValue(strValue, _iMatchValue)) { strError = "Value error: \"" + strValue + "\" is not part of criterion \"" + _pSelectionCriterion->getCriterionName() + "\""; return false; } return true; }
// Parse bool CCompoundRule::parse(CRuleParser& ruleParser, string& strError) { // Get rule type uint32_t uiType; for (uiType = 0; uiType < 2; uiType++) { if (ruleParser.getType() == _apcTypes[uiType]) { // Set type _bTypeAll = uiType != 0; return true; } } // Failed strError = "Unknown compound rule type: "; strError += ruleParser.getType(); return false; }