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

Method MergeNoOverwrite

src/twparser/parserobjects.cpp:340–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340void cParseNamedAttrList::MergeNoOverwrite(const cParseNamedAttrList* const pal)
341{
342 if (pal)
343 {
344 // foreach attribute in pal
345 for (constListIter newIter = pal->mList.begin(); newIter != pal->mList.end(); ++newIter)
346 {
347 // look for this attribute in this list
348 constListIter thisIter = Find(*newIter);
349
350 // if not already in list, just put it in
351 if (thisIter == mList.end())
352 {
353 mList.push_back((*newIter)->Clone());
354 }
355 else // do not overwrite value (except for emailto)
356 {
357 // special case for emailto: this can have multiple values, so add the new value to the old value
358 if (0 == (*thisIter)->GetName().compare(TSS_GetString(cTWParser, twparser::STR_PARSER_EMAILTO)))
359 {
360 TSTRING tstr = (*thisIter)->GetValue();
361 cParserUtil::MergeMailLists(tstr, (*newIter)->GetValue());
362 (*thisIter)->SetValue(tstr);
363 }
364 }
365 }
366 }
367}
368
369const cParseNamedAttr* cParseNamedAttrList::Lookup(const TSTRING& tstrAttrName) const
370{

Callers 2

yyparse.cppFile · 0.80
PushScopeMethod · 0.80

Calls 6

beginMethod · 0.80
endMethod · 0.80
SetValueMethod · 0.80
CloneMethod · 0.45
compareMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected