Ocular Engine
Config.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_UTILITIES_CONFIG__H__
19 #define __H__OCULAR_UTILITIES_CONFIG__H__
20 
21 #include "FileIO/File.hpp"
22 
23 #include <string>
24 #include <unordered_map>
25 
26 //------------------------------------------------------------------------------------------
27 
32 namespace Ocular
33 {
38  namespace Utils
39  {
61  class Config
62  {
63  public:
64 
65  Config();
66  ~Config();
67 
68  //------------------------------------------------------------
69 
73  bool read();
74 
78  bool write();
79 
85  void setFile(Core::File const& file);
86 
97  std::string get(std::string const& option) const;
98 
105  void set(std::string const& option, std::string const& value);
106 
107  protected:
108 
109  bool isValidReadFile(Core::File const& file) const;
110  bool isValidWriteFile(Core::File const& file) const;
111 
112  private:
113 
114  Core::File m_File;
115 
116  std::unordered_map<std::string, std::string> m_ConfigOptions;
117  };
118  }
122 }
127 //------------------------------------------------------------------------------------------
128 
129 #endif
void setFile(Core::File const &file)
Definition: Config.cpp:117
bool read()
Definition: Config.cpp:46
bool write()
Definition: Config.cpp:81
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
void set(std::string const &option, std::string const &value)
Definition: Config.cpp:135
Definition: Config.hpp:61
Definition: File.hpp:41