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 "common/str.h"
27 
28 namespace Ultima {
29 namespace Ultima8 {
30 
32 
34 public:
37 
38  struct ConfigFile {
39  Common::String _category;
40  Common::INIFile _iniFile;
41  };
42 
43  static ConfigFileManager *get_instance() {
44  return _configFileManager;
45  }
46 
52  bool readConfigFile(const Common::Path &fname, const Common::String &category);
53 
55  void clear();
56 
58  void clearRoot(const Common::String &category);
59 
61  bool get(const Common::String &category, const Common::String &section, const Common::String &key, Common::String &ret) const;
63  bool get(const Common::String &category, const Common::String &section, const Common::String &key, int &ret) const;
65  bool get(const Common::String &category, const Common::String &section, const Common::String &key, bool &ret) const;
66 
75  KeyMap listKeyValues(const Common::String &category, const Common::String &section) const;
76 
77 private:
78  Common::Array<ConfigFile *> _configFiles;
79 
80  static ConfigFileManager *_configFileManager;
81 };
82 
83 } // End of namespace Ultima8
84 } // End of namespace Ultima
85 
86 #endif
void clear()
clear everything
Definition: str.h:59
Definition: config_file_manager.h:38
Definition: path.h:52
Definition: detection.h:27
Definition: hashmap.h:85
Common::Array< Common::String > listSections(const Common::String &category) const
KeyMap listKeyValues(const Common::String &category, const Common::String &section) const
Definition: ini-file.h:58
void clearRoot(const Common::String &category)
clear everything in a root
Definition: config_file_manager.h:33
bool readConfigFile(const Common::Path &fname, const Common::String &category)