OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
configurationmanager.hpp
Go to the documentation of this file.
1 #ifndef COMPONENTS_FILES_CONFIGURATIONMANAGER_HPP
2 #define COMPONENTS_FILES_CONFIGURATIONMANAGER_HPP
3 
4 #include <map>
5 
6 #include <boost/program_options.hpp>
7 
10 
14 namespace Files
15 {
16 
21 {
22  ConfigurationManager(bool silent=false);
23  virtual ~ConfigurationManager();
24 
25  void readConfiguration(boost::program_options::variables_map& variables,
26  boost::program_options::options_description& description, bool quiet=false);
27 
28  void processPaths(Files::PathContainer& dataDirs, bool create = false);
30 
32  const boost::filesystem::path& getGlobalPath() const;
33  const boost::filesystem::path& getUserConfigPath() const;
34  const boost::filesystem::path& getLocalPath() const;
35 
36  const boost::filesystem::path& getGlobalDataPath() const;
37  const boost::filesystem::path& getUserDataPath() const;
38  const boost::filesystem::path& getLocalDataPath() const;
39  const boost::filesystem::path& getInstallPath() const;
40 
41  const boost::filesystem::path& getCachePath() const;
42 
43  const boost::filesystem::path& getLogPath() const;
44 
45  private:
47 
48  typedef const boost::filesystem::path& (FixedPathType::*path_type_f)() const;
49  typedef std::map<std::string, path_type_f> TokensMappingContainer;
50 
51  bool loadConfig(const boost::filesystem::path& path,
52  boost::program_options::variables_map& variables,
53  boost::program_options::options_description& description);
54 
55  void setupTokensMapping();
56 
58 
59  boost::filesystem::path mLogPath;
60 
62 
63  bool mSilent;
64 };
65 } /* namespace Cfg */
66 
67 #endif /* COMPONENTS_FILES_CONFIGURATIONMANAGER_HPP */
const boost::filesystem::path & getGlobalDataPath() const
Definition: configurationmanager.cpp:190
const boost::filesystem::path & getLocalPath() const
Definition: configurationmanager.cpp:185
const boost::filesystem::path & getLogPath() const
Definition: configurationmanager.cpp:205
TokensMappingContainer mTokensMapping
Definition: configurationmanager.hpp:61
const boost::filesystem::path & getInstallPath() const
Definition: configurationmanager.cpp:200
void processPaths(Files::PathContainer &dataDirs, bool create=false)
Definition: configurationmanager.cpp:78
const boost::filesystem::path & getLocalDataPath() const
Files::FixedPath FixedPathType
Definition: configurationmanager.hpp:46
Definition: configurationmanager.hpp:20
FixedPathType mFixedPath
Definition: configurationmanager.hpp:57
const boost::filesystem::path & getUserConfigPath() const
Definition: configurationmanager.cpp:175
void readConfiguration(boost::program_options::variables_map &variables, boost::program_options::options_description &description, bool quiet=false)
Definition: configurationmanager.cpp:57
const boost::filesystem::path & getGlobalPath() const
Definition: configurationmanager.cpp:170
Definition: fixedpath.hpp:44
std::map< std::string, path_type_f > TokensMappingContainer
Definition: configurationmanager.hpp:49
bool mSilent
Definition: configurationmanager.hpp:63
ConfigurationManager(bool silent=false)
Definition: configurationmanager.cpp:34
virtual ~ConfigurationManager()
Definition: configurationmanager.cpp:46
bool loadConfig(const boost::filesystem::path &path, boost::program_options::variables_map &variables, boost::program_options::options_description &description)
Definition: configurationmanager.cpp:136
void create(const MWWorld::Store< T > &list, const std::string &name, boost::any &refValue, MWWorld::Ptr &ptrValue)
Definition: manualref.cpp:9
const boost::filesystem::path &(FixedPathType::* path_type_f)() const
Definition: configurationmanager.hpp:48
void setupTokensMapping()
Definition: configurationmanager.cpp:50
const boost::filesystem::path & getCachePath() const
Definition: configurationmanager.cpp:195
boost::filesystem::path mLogPath
Definition: configurationmanager.hpp:59
std::vector< boost::filesystem::path > PathContainer
Definition: gamesettings.hpp:14
const boost::filesystem::path & getUserDataPath() const
Definition: configurationmanager.cpp:180