ScummVM API documentation
config_file_manager.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ULTIMA8_CONF_CONFIGFILEMANAGER_H
23 #define ULTIMA8_CONF_CONFIGFILEMANAGER_H
24 
25 #include "common/formats/ini-file.h"
26 #include "ultima/shared/std/string.h"
27 #include "ultima/shared/std/containers.h"
28 
29 namespace Ultima {
30 namespace Ultima8 {
31 
33 
35 public:
38 
39  struct ConfigFile {
40  Std::string _category;
41  Common::INIFile _iniFile;
42  };
43 
44  static ConfigFileManager *get_instance() {
45  return _configFileManager;
46  }
47 
53  bool readConfigFile(const Common::Path &fname, const Std::string &category);
54 
56  void clear();
57 
59  void clearRoot(const Std::string &category);
60 
62  bool get(const Std::string &category, const Std::string &section, const Std::string &key, Std::string &ret) const;
64  bool get(const Std::string &category, const Std::string &section, const Std::string &key, int &ret) const;
66  bool get(const Std::string &category, const Std::string &section, const Std::string &key, bool &ret) const;
67 
71  Std::vector<Std::string> listSections(const Std::string &category) const;
76  KeyMap listKeyValues(const Std::string &category, const Std::string &section) const;
77 
78 private:
79  Std::vector<ConfigFile *> _configFiles;
80 
81  static ConfigFileManager *_configFileManager;
82 };
83 
84 } // End of namespace Ultima8
85 } // End of namespace Ultima
86 
87 #endif
void clear()
clear everything
Definition: config_file_manager.h:39
Definition: path.h:52
void clearRoot(const Std::string &category)
clear everything in a root
Definition: detection.h:27
Definition: hashmap.h:85
Definition: string.h:30
bool readConfigFile(const Common::Path &fname, const Std::string &category)
Definition: ini-file.h:58
Definition: config_file_manager.h:34
KeyMap listKeyValues(const Std::string &category, const Std::string &section) const
Definition: containers.h:38
Std::vector< Std::string > listSections(const Std::string &category) const