|
ini-cpp
|
Public Member Functions | |
| INIReader (std::string filename) | |
| Construct an INIReader object from a file name. More... | |
| INIReader (FILE *file) | |
| Construct an INIReader object from a file pointer. More... | |
| int | ParseError () const |
| const std::set< std::string > | Sections () const |
| Return the list of sections found in ini file. More... | |
| const std::set< std::string > | Keys (std::string section) const |
| Return the list of keys in the given section. More... | |
| const std::unordered_map< std::string, std::string > | Get (std::string section) const |
| Get the map representing the values in a section of the INI file. More... | |
| template<typename T = std::string> | |
| T | Get (const std::string §ion, const std::string &name) const |
| Return the value of the given key in the given section. More... | |
| template<typename T > | |
| T | Get (const std::string §ion, const std::string &name, T &&default_v) const |
| Return the value of the given key in the given section, return default if not found. More... | |
| template<typename T = std::string> | |
| std::vector< T > | GetVector (const std::string §ion, const std::string &name) const |
| Return the value array of the given key in the given section. More... | |
| template<typename T > | |
| std::vector< T > | GetVector (const std::string §ion, const std::string &name, const std::vector< T > &default_v) const |
| Return the value array of the given key in the given section, return default if not found. More... | |
| template<typename T = std::string> | |
| void | InsertEntry (const std::string §ion, const std::string &name, const T &v) |
| Insert a key-value pair into the INI file. More... | |
| template<typename T = std::string> | |
| void | InsertEntry (const std::string §ion, const std::string &name, const std::vector< T > &vs) |
| Insert a vector of values into the INI file. More... | |
| template<typename T = std::string> | |
| void | UpdateEntry (const std::string §ion, const std::string &name, const T &v) |
| Update a key-value pair in the INI file. More... | |
| template<typename T = std::string> | |
| void | UpdateEntry (const std::string §ion, const std::string &name, const std::vector< T > &vs) |
| Update a vector of values in the INI file. More... | |
Static Protected Member Functions | |
| static int | ValueHandler (void *user, const char *section, const char *name, const char *value) |
Protected Attributes | |
| int | _error |
| std::unordered_map< std::string, std::unordered_map< std::string, std::string > > | _values |
|
inline |
Construct an INIReader object from a file name.
| filename | The name of the INI file to parse |
| std::runtime_error | if there is an error parsing the INI file |
|
inline |
Construct an INIReader object from a file pointer.
| file | A pointer to the INI file to parse |
| std::runtime_error | if there is an error parsing the INI file |
|
inline |
Return the value of the given key in the given section.
| section | The section name |
| name | The key name |
|
inline |
Return the value of the given key in the given section, return default if not found.
| section | The section name |
| name | The key name |
| default_v | The default value |
|
inline |
Get the map representing the values in a section of the INI file.
| section | The name of the section to retrieve |
| std::runtime_error | if the section is not found |
|
inline |
Return the value array of the given key in the given section.
| section | The section name |
| name | The key name |
For example:
|
inline |
Return the value array of the given key in the given section, return default if not found.
| section | The section name |
| name | The key name |
| default_v | The default value |
|
inline |
Insert a vector of values into the INI file.
| section | The section name |
| name | The key name |
| vs | The vector of values to insert |
| std::runtime_error | if the key already exists in the section |
|
inline |
Insert a key-value pair into the INI file.
| section | The section name |
| name | The key name |
| v | The value to insert |
| std::runtime_error | if the key already exists in the section |
|
inline |
Return the list of keys in the given section.
| section | The section name |
|
inline |
Return the list of sections found in ini file.
|
inline |
Update a vector of values in the INI file.
| section | The section name |
| name | The key name |
| vs | The new vector of values to set |
| std::runtime_error | if the key does not exist in the section |
|
inline |
Update a key-value pair in the INI file.
| section | The section name |
| name | The key name |
| v | The new value to set |
| std::runtime_error | if the key does not exist in the section |