gem5  v20.1.0.0
Public Member Functions | Private Types | Private Attributes | List of all members
IniFile::Section Class Reference

A section. More...

#include <inifile.hh>

Public Member Functions

 Section ()
 Constructor. More...
 
bool isReferenced ()
 Has this section been used? More...
 
void addEntry (const std::string &entryName, const std::string &value, bool append)
 Add an entry to the table. More...
 
bool add (const std::string &assignment)
 Add an entry to the table given a string assigment. More...
 
EntryfindEntry (const std::string &entryName) const
 Find the entry with the given name. More...
 
bool printUnreferenced (const std::string &sectionName)
 Print the unreferenced entries in this section to cerr. More...
 
void dump (const std::string &sectionName)
 Print the contents of this section to cout (for debugging). More...
 

Private Types

typedef std::unordered_map< std::string, Entry * > EntryTable
 EntryTable type. Map of strings to Entry object pointers. More...
 

Private Attributes

EntryTable table
 Table of entries. More...
 
bool referenced
 Has this section been used? More...
 

Detailed Description

A section.

Definition at line 90 of file inifile.hh.

Member Typedef Documentation

◆ EntryTable

typedef std::unordered_map<std::string, Entry *> IniFile::Section::EntryTable
private

EntryTable type. Map of strings to Entry object pointers.

Definition at line 93 of file inifile.hh.

Constructor & Destructor Documentation

◆ Section()

IniFile::Section::Section ( )
inline

Constructor.

Definition at line 100 of file inifile.hh.

Member Function Documentation

◆ add()

bool IniFile::Section::add ( const std::string &  assignment)

Add an entry to the table given a string assigment.

Assignment should be of the form "param=value" or "param+=value" (for append). This funciton parses the assignment statment and calls addEntry().

Return values
Truefor success, false if parse error.

Definition at line 98 of file inifile.cc.

References eat_white(), and ArmISA::offset.

◆ addEntry()

void IniFile::Section::addEntry ( const std::string &  entryName,
const std::string &  value,
bool  append 
)

Add an entry to the table.

If an entry with the same name already exists, the 'append' parameter is checked If true, the new value will be appended to the existing entry. If false, the new value will replace the existing entry.

Definition at line 76 of file inifile.cc.

◆ dump()

void IniFile::Section::dump ( const std::string &  sectionName)

Print the contents of this section to cout (for debugging).

Definition at line 331 of file inifile.cc.

◆ findEntry()

IniFile::Entry * IniFile::Section::findEntry ( const std::string &  entryName) const

Find the entry with the given name.

Return values
Pointerto the entry object, or NULL if none.

Definition at line 122 of file inifile.cc.

Referenced by IniFile::entryExists(), IniFile::find(), and IniFile::printUnreferenced().

◆ isReferenced()

bool IniFile::Section::isReferenced ( )
inline

Has this section been used?

Definition at line 106 of file inifile.hh.

References referenced.

Referenced by IniFile::printUnreferenced().

◆ printUnreferenced()

bool IniFile::Section::printUnreferenced ( const std::string &  sectionName)

Print the unreferenced entries in this section to cerr.

Messages can be suppressed using "unref_section_ok" and "unref_entries_ok".

Parameters
sectionNameName of this section, for use in output message.
Return values
Trueif any entries were printed.

Definition at line 249 of file inifile.cc.

References IniFile::Entry::getValue(), IniFile::Entry::isReferenced(), and tokenize().

Referenced by IniFile::printUnreferenced().

Member Data Documentation

◆ referenced

bool IniFile::Section::referenced
mutableprivate

Has this section been used?

Definition at line 96 of file inifile.hh.

Referenced by isReferenced().

◆ table

EntryTable IniFile::Section::table
private

Table of entries.

Definition at line 95 of file inifile.hh.


The documentation for this class was generated from the following files:

Generated on Wed Sep 30 2020 14:02:26 for gem5 by doxygen 1.8.17