ConfigurationParser/README.md

36 lines
879 B
Markdown
Raw Permalink Normal View History

2020-10-28 20:19:36 +03:00
# Configuration Parser
2020-10-28 20:22:37 +03:00
Very simple, Header-only, Key-Value pair Parser and Generator.
2020-10-28 20:19:36 +03:00
To change the default assigner "=" there's a define named CONFIG_ASSIGNER in ConfigReader.h (33).
2020-10-28 20:22:37 +03:00
```C++
2020-10-28 20:19:36 +03:00
#define CONFIG_ASSIGNER "="
```
#### Example
2020-10-28 20:22:37 +03:00
```C++
2020-10-28 20:19:36 +03:00
#include <iostream>
#include "ConfigurationParser.h"
int main()
{
Syn::ConfigurationParser parser = Syn::ConfigurationParser("config.cfg");
parser["NewKey"] = "NewValue";
std::cout << "parser[newKey] -> " << parser["NewKey"] << std::endl;
// Save to the current file "config.cfg"
parser.SaveFile();
// Open another file
parser.ParseFile("anotherConfig.conf");
for(auto [key, value] : parser)
std::cout << key << " -> " << value << std::endl;
// Write to a specific file and change the current file to that file
parser.WriteFile("newConfig.ini");
return 0;
}
```