Yet another .ini
parser for modern c++ (made for cpp17), inspired and extend from inih.
Example
The config.ini
's content is something looks like:
[section1]
any=5
[section2]
any_vec = 1 2 3
#include "ini/ini.h"
int main() {
const auto& v1 = r.
Get<std::string>(
"section1",
"any");
const auto& v2 = r.Get<int>("section1", "any");
const auto& v3 = r.Get<double>("section1", "any");
const auto& v4 = r.GetVector<float>("section2", "any_vec");
const auto& v5 = r.GetVector<std::string>("section2", "any_vec");
r.InsertEntry("new_section", "key1", 5);
return 0;
}
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.
Definition: ini.h:350
static void write(const std::string &filepath, const INIReader &reader)
Write the contents of an INI file to a new file.
Definition: ini.h:604
To learn more, please refer to test folder, it covered ALL utilities.
Install
Simply copy the header file ini/ini.h
to your project, then done.