#ifndef __CONFIG_FILE_H__ #define __CONFIG_FILE_H__ /* Usage * ConfigFile cf("config.txt"); * * std::string foo; * std::string water; * double four; * * foo = cf.Value("section_1","foo" ); * water = cf.Value("section_2","water"); * four = cf.Value("section_2","four" ); * * std::cout << foo << std::endl; * std::cout << water << std::endl; * std::cout << four << std::endl; * * From a config file like this: * * [section_1] * foo = bar * water= h2o * * [section_2] * foo = foo * water= wet * four = 4.2 */ #include #include #include "Value.h" class ConfigFile { //std::map content_; std::map content_; public: ConfigFile(); ConfigFile(std::string const& configFile); bool Open(std::string const& configFile); Value const& GetValue(std::string const& section, std::string const& entry) const; Value const& GetValue(std::string const& section, std::string const& entry, double value); Value const& GetValue(std::string const& section, std::string const& entry, std::string const& value); }; #endif