In-memory representation of a parsed INI file.
More...
#include <ini.h>
|
| | IniFile ()=default |
| | Construct an empty INI store.
|
| |
| bool | load (const std::string &path) |
| | Parse an INI file from disk.
|
| |
| bool | has (const std::string &key) const |
| |
| std::string | get (const std::string &key, const std::string &fallback="") const |
| |
| int | get_int (const std::string &key, int fallback) const |
| |
| double | get_double (const std::string &key, double fallback) const |
| |
| bool | get_bool (const std::string &key, bool fallback) const |
| |
| const std::map< std::string, std::string > & | values () const |
| |
In-memory representation of a parsed INI file.
Definition at line 34 of file ini.h.
◆ IniFile()
| ncorr::IniFile::IniFile |
( |
| ) |
|
|
default |
Construct an empty INI store.
◆ get()
| std::string ncorr::IniFile::get |
( |
const std::string & |
key, |
|
|
const std::string & |
fallback = "" |
|
) |
| const |
|
inline |
- Returns
- the raw string value for
key, or fallback if absent.
Definition at line 96 of file ini.h.
◆ get_bool()
| bool ncorr::IniFile::get_bool |
( |
const std::string & |
key, |
|
|
bool |
fallback |
|
) |
| const |
|
inline |
- Returns
- parsed bool for
key, or fallback if absent. Accepts (case-insensitively) true/false, 1/0, yes/no, on/off.
Definition at line 127 of file ini.h.
◆ get_double()
| double ncorr::IniFile::get_double |
( |
const std::string & |
key, |
|
|
double |
fallback |
|
) |
| const |
|
inline |
- Returns
- parsed double for
key, or fallback if absent. Throws on bad value.
Definition at line 114 of file ini.h.
◆ get_int()
| int ncorr::IniFile::get_int |
( |
const std::string & |
key, |
|
|
int |
fallback |
|
) |
| const |
|
inline |
- Returns
- parsed int for
key, or fallback if absent. Throws on bad value.
Definition at line 102 of file ini.h.
◆ has()
| bool ncorr::IniFile::has |
( |
const std::string & |
key | ) |
const |
|
inline |
- Returns
- true if a value exists for
key.
Definition at line 93 of file ini.h.
◆ load()
| bool ncorr::IniFile::load |
( |
const std::string & |
path | ) |
|
|
inline |
Parse an INI file from disk.
- Parameters
-
| path | Path to the INI file. |
- Returns
- true if the file was opened and parsed; false if it did not exist.
- Exceptions
-
| std::runtime_error | on a structurally invalid line. |
Definition at line 45 of file ini.h.
◆ values()
| const std::map< std::string, std::string > & ncorr::IniFile::values |
( |
| ) |
const |
|
inline |
- Returns
- the full key/value map (for iteration / diagnostics).
Definition at line 138 of file ini.h.
The documentation for this class was generated from the following file: