14#include<unordered_map>
38 std::unordered_map<std::string, std::unordered_map<std::string, Item>>
values;
64 Item itemAtKey(
const std::string §ion,
const std::string &key);
72 void setItem(
const std::string §ion,
const std::string &key,
const std::string value);
84 void saveFile(
const std::string &f2);
91 std::vector<std::string>
splitByComma(
const std::string &str);
ConfigFile & operator=(const ConfigFile &)=delete
std::vector< std::string > splitByComma(const std::string &str)
Split a string on comma delimiters.
void loadFile(const std::string &f)
Load (or reload) a configuration file from disk.
Item itemAtKey(const std::string §ion, const std::string &key)
Retrieve a configuration item by section and key.
void setItem(const std::string §ion, const std::string &key, const std::string value)
Insert or update a configuration item.
void saveFile(const std::string &f2)
Save the current configuration to a file.
ConfigFile()=default
Default constructor — no file loaded.
ConfigFile(const ConfigFile &)=delete
ConfigFile(ConfigFile &&)=delete
~ConfigFile()
Destructor — closes any open file resources.
std::unordered_map< std::string, std::unordered_map< std::string, Item > > values
ConfigFile & operator=(ConfigFile &&)=delete
A single key/value pair read from a configuration file.
std::string key
Configuration key name.
std::string value
Value associated with the key.