32 #ifndef __INIFILE_HH__
33 #define __INIFILE_HH__
38 #include <unordered_map>
96 typedef std::unordered_map<std::string, Entry *>
EntryTable;
115 void addEntry(
const std::string &entryName,
const std::string &value,
123 bool add(
const std::string &assignment);
137 void dump(
const std::string §ionName);
167 bool load(std::istream &
f);
174 bool load(
const std::string &file);
179 bool add(
const std::string &
s);
184 bool find(
const std::string §ion,
const std::string &entry,
185 std::string &value)
const;
191 const std::string &entry)
const;
211 #endif // __INIFILE_HH__
void getSectionNames(std::vector< std::string > &list) const
Push all section names into the given vector.
bool printUnreferenced()
Print unreferenced entries in object.
Entry * findEntry(const std::string &entryName) const
Find the entry with the given name.
std::string value
The entry value.
std::unordered_map< std::string, Entry * > EntryTable
EntryTable type. Map of strings to Entry object pointers.
bool isReferenced()
Has this entry been used?
Section * addSection(const std::string §ionName)
Look up section with the given name, creating a new section if not found.
void dump(const std::string §ionName)
Print the contents of this section to cout (for debugging).
bool add(const std::string &s)
Take string of the form "<section>:<parameter>=<value>" or "<section>:<parameter>+=<value>" and add t...
bool referenced
Has this entry been used?
bool printUnreferenced(const std::string §ionName)
Print the unreferenced entries in this section to cerr.
bool entryExists(const std::string §ion, const std::string &entry) const
Determine whether the entry exists within named section exists in the .ini file.
bool find(const std::string §ion, const std::string &entry, std::string &value) const
Find value corresponding to given section and entry names.
bool load(std::istream &f)
Load parameter settings from given istream.
std::unordered_map< std::string, Section * > SectionTable
SectionTable type. Map of strings to Section object pointers.
const std::string & getValue() const
Fetch the value.
SectionTable table
Hash of section names to Section object pointers.
Section * findSection(const std::string §ionName) const
Look up section with the given name.
bool referenced
Has this section been used?
EntryTable table
Table of entries.
bool isReferenced()
Has this section been used?
void appendValue(const std::string &v)
Append the given string to the value.
Entry(const std::string &v)
Constructor.
void setValue(const std::string &v)
Set the value.
void dump()
Dump contents to cout. For debugging.
bool sectionExists(const std::string §ion) const
Determine whether the named section exists in the .ini file.
This class represents the contents of a ".ini" file.
bool add(const std::string &assignment)
Add an entry to the table given a string assigment.
void addEntry(const std::string &entryName, const std::string &value, bool append)
Add an entry to the table.