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

Method SetSection

src/twparser/parserhelper.cpp:317–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315// strSection is not an acceptable genre for this OS
316
317void cParserHelper::SetSection(TSTRING& strSection) // throw( eParserHelper )
318{
319 //
320 // do we recognize the section string?
321 //
322 cGenre::Genre g = cGenreSwitcher::GetInstance()->StringToGenre(strSection.c_str());
323 if (cGenre::GENRE_INVALID != g && cGenreSwitcher::GetInstance()->IsGenreAppropriate(g))
324 {
325 cGenreSwitcher::GetInstance()->SelectGenre(g);
326
327 // set current genre info pointer
328 GenreContainer::iterator i = mAph.find(cGenreSwitcher::GetInstance()->CurrentGenre());
329 if (mAph.end() == i)
330 {
331 pCurrentGenreInfo = new cGenreParseInfo;
332 mAph.insert(GenreContainer::value_type(cGenreSwitcher::GetInstance()->CurrentGenre(), pCurrentGenreInfo));
333
334 cPreprocessor::ReadSection();
335 }
336 else
337 {
338 throw eParserSectionAlreadyDefined(strSection);
339 }
340 }
341 else // ignore
342 {
343 if (!ParseOnly())
344 {
345 eParserIgnoringSection e(strSection);
346 e.SetFatality(false);
347 if (mpError)
348 mpError->AddError(e);
349 }
350
351 cPreprocessor::IgnoreSection();
352 }
353}
354
355// A function for inserting a global variable into the global variable table. Throws
356// an exception if they try to redefine one of the predefined variables. Returns

Callers

nothing calls this directly

Calls 9

StringToGenreMethod · 0.80
c_strMethod · 0.80
IsGenreAppropriateMethod · 0.80
SelectGenreMethod · 0.80
CurrentGenreMethod · 0.80
endMethod · 0.80
SetFatalityMethod · 0.80
findMethod · 0.45
AddErrorMethod · 0.45

Tested by

no test coverage detected