A simple YAML configuration wrapper for C++.
yconfig is a configuration wrapper built around the yaml-cpp library and is distributed under the MIT license.
It is a companion project to the chapter "YAML for C++: Applied Data-Driven Design" of the book Game Development Tools.
yconfig requires CMake and the yaml-cpp library (auto-detected by CMake) to be built.
$ cd yconfig
$ mkdir build
$ cd build
$ cmake ..
$ make
You should now have the yconfig headers and library files, directly integrable into your C++ project.
To run the test examples described in the book chapter, you can type the following:
$ cd ..
$ build/configtest
#include "Config.h"
std::ifstream file("configfile.yaml");
Config cfg(file); // throws an exception if the stream is unreadable
unsigned int width = cfg["screen/width"];
unsigned int width = cfg["screen/height"];
// use width and height to initialize the screen...
std::vector<Player> players = cfg["players"];
// iterate over the players list here...