| 231 | } |
| 232 | |
| 233 | void cParseNamedAttr::Validate() const |
| 234 | { |
| 235 | if (NamesMatch(twparser::STR_PARSER_RULENAME, mstrName)) |
| 236 | { |
| 237 | // no checking needed |
| 238 | } |
| 239 | else if (NamesMatch(twparser::STR_PARSER_EMAILTO, mstrName)) |
| 240 | { |
| 241 | // no checking needed |
| 242 | } |
| 243 | else if (NamesMatch(twparser::STR_PARSER_SEVERITY, mstrName)) |
| 244 | { |
| 245 | int iIgnore; |
| 246 | cSeverityLimits sl; |
| 247 | if (!sl.InterpretInt(mstrValue, &iIgnore)) |
| 248 | throw eParserBadSevVal(mstrValue, mLineNum); |
| 249 | } |
| 250 | else if (NamesMatch(twparser::STR_PARSER_RECURSE, mstrName)) |
| 251 | { |
| 252 | TSTRING str = mstrValue; |
| 253 | std::transform(str.begin(), str.end(), str.begin(), _totlower); |
| 254 | |
| 255 | if (!NamesMatch(twparser::STR_PARSER_FALSE, str) && !NamesMatch(twparser::STR_PARSER_TRUE, str)) |
| 256 | { |
| 257 | // must be number |
| 258 | int iIgnore; |
| 259 | cRecurseDepthLimits rdl; |
| 260 | if (!rdl.InterpretInt(str, &iIgnore)) |
| 261 | throw eParserUnrecognizedAttrVal(mstrValue, mLineNum); |
| 262 | } |
| 263 | } |
| 264 | else |
| 265 | { |
| 266 | throw eParserUnrecognizedAttr(mstrName, mLineNum); |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | // case sensitive-matching |
| 271 | bool cParseNamedAttr::NamesMatch(int nString, const TSTRING& strName) const |
no test coverage detected