MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / Validate

Method Validate

src/twparser/parserobjects.cpp:233–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231}
232
233void 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
271bool cParseNamedAttr::NamesMatch(int nString, const TSTRING& strName) const

Callers 1

AddMethod · 0.80

Calls 3

InterpretIntMethod · 0.80
beginMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected