NConfig is a minimalist .conf file parser for C++ apps, using INI-like syntax with enhanced access patterns.
- Easy
.conffile parsing: supports[section] key = valueformat - Type-safe
get<T>()andset<T>()functions - Built-in support for:
int,unsigned int,long,long long,float,double,bool,std::stringstd::vector<T>of the above types
- Config saving and loading
- Fallback values for missing keys
- Section/key discovery via
keys(),sections(), andkeys_in()
#include "NConfig.h"
NConfig config;
config.load("settings.conf");
// Set values
config.set("window.width", 1280);
config.set("window.fullscreen", true);
config.set("player.names", std::vector<std::string>{"Alice", "Bob"});
// Get values
int width = config.get("window.width", 800);
bool fullscreen = config.get("window.fullscreen", false);
auto names = config.get<std::vector<std::string>>("player.names", {});
// Save config
config.save("settings.conf");config.has_key("audio.volume"); // true/false
config.keys(); // All keys
config.sections(); // All section names
config.keys_in("audio"); // All keys under 'audio'NConfig comes with NTest unit tests to verify correctness. Run:
./build.sh[TBD]