Bites
A small library of miscellaneous C++ codes.
 All Classes Namespaces Functions Friends Pages
Config.hpp
1 #ifndef BITES_CONFIG_HPP_INCLUDED
2 #define BITES_CONFIG_HPP_INCLUDED
3 
4 #include <string>
5 #include <vector>
6 #include <map>
7 
8 namespace bites {
9 
45 class Config
46 {
47 public:
50  Config(const std::string& fname="");
51 
55  bool load(const std::string& fname);
56 
59  void save(const std::string& fname) const;
60 
63  std::string& operator[](const std::string& key);
64 
69  friend std::ostream& operator<<(std::ostream& out, const Config& config);
70 
73  std::vector<std::string> keys();
74 
75 private:
77  typedef std::map<std::string, std::string> DataType;
78  DataType m_data;
79 };
80 
81 } // namespace bites.
82 
83 #endif // BITES_CONFIG_HPP_INCLUDED
bool load(const std::string &fname)
Definition: Config.cpp:26
void save(const std::string &fname) const
Definition: Config.cpp:87
friend std::ostream & operator<<(std::ostream &out, const Config &config)
Definition: Config.cpp:99
Config(const std::string &fname="")
Definition: Config.cpp:18
std::string & operator[](const std::string &key)
Definition: Config.cpp:94
std::vector< std::string > keys()
Definition: Config.cpp:112
Definition: Config.hpp:45