36#include <unordered_map>
97 typedef std::unordered_map<std::string, Entry>
EntryTable;
116 void addEntry(
const std::string &entryName,
const std::string &value,
124 bool add(
const std::string &assignment);
139 void dump(
const std::string §ionName)
const;
141 EntryTable::const_iterator
begin()
const;
142 EntryTable::const_iterator
end()
const;
170 bool load(std::istream &
f);
177 bool load(
const std::string &file);
182 bool add(
const std::string &
s);
187 bool find(
const std::string §ion,
const std::string &entry,
188 std::string &value)
const;
194 const std::string &entry)
const;
215 const std::string&,
const std::string&)>;
std::string value
The entry value.
bool isReferenced() const
Has this entry been used?
const std::string & getValue() const
Fetch the value.
Entry(const std::string &v)
Constructor.
void setValue(const std::string &v)
Set the value.
bool referenced
Has this entry been used?
void appendValue(const std::string &v)
Append the given string to the value.
EntryTable table
Table of entries.
std::unordered_map< std::string, Entry > EntryTable
EntryTable type. Map of strings to Entry object pointers.
void addEntry(const std::string &entryName, const std::string &value, bool append)
Add an entry to the table.
EntryTable::const_iterator end() const
bool add(const std::string &assignment)
Add an entry to the table given a string assigment.
EntryTable::const_iterator begin() const
bool referenced
Has this section been used?
bool isReferenced() const
Has this section been used?
Entry * findEntry(const std::string &entryName)
Find the entry with the given name.
This class represents the contents of a ".ini" file.
bool add(const std::string &s)
Take string of the form "<section>:<parameter>=<value>" or "<section>:<parameter>+=<value>" and add t...
bool find(const std::string §ion, const std::string &entry, std::string &value) const
Find value corresponding to given section and entry names.
void visitSection(const std::string §ionName, VisitSectionCallback cb)
Iterate over key/value pairs of the given section.
std::unordered_map< std::string, Section > SectionTable
SectionTable type. Map of strings to Section object pointers.
std::function< void( const std::string &, const std::string &)> VisitSectionCallback
Visitor callback that receives key/value pairs.
SectionTable table
Hash of section names to Section object pointers.
bool entryExists(const std::string §ion, const std::string &entry) const
Determine whether the entry exists within named section exists in the .ini file.
void getSectionNames(std::vector< std::string > &list) const
Push all section names into the given vector.
bool load(std::istream &f)
Load parameter settings from given istream.
void dump()
Dump contents to cout. For debugging.
bool printUnreferenced() const
Print unreferenced entries in object.
Section * addSection(const std::string §ionName)
Look up section with the given name, creating a new section if not found.
bool sectionExists(const std::string §ion) const
Determine whether the named section exists in the .ini file.
Section * findSection(const std::string §ionName)
Look up section with the given name.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.