ScummVM API documentation
databases.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  * This file is dual-licensed.
22  * In addition to the GPLv3 license mentioned above, this code is also
23  * licensed under LGPL 2.1. See LICENSES/COPYING.LGPL file for the
24  * full text of the license.
25  *
26  */
27 
28 #ifndef GOB_DATABASES_H
29 #define GOB_DATABASES_H
30 
31 #include "common/str.h"
32 #include "common/hashmap.h"
33 #include "common/hash-str.h"
34 #include "common/language.h"
35 
36 #include "gob/dbase.h"
37 
38 namespace Gob {
39 
41 public:
44 
45  void setLanguage(Common::Language language);
46  void setEncodingIsOEM(bool encodingIsOEM) { _encodingIsOEM = encodingIsOEM; }
47  bool encodingIsOEM() const { return _encodingIsOEM; }
48 
49  bool open(const Common::String &id, const Common::Path &file);
50  bool close(const Common::String &id);
51 
52  bool getString(const Common::String &id, Common::String group,
53  Common::String section, Common::String keyword, Common::String &result) const;
54 
55 private:
57 
58  DBMap _databases;
59 
60  Common::String _language;
61  bool _encodingIsOEM = true;
62 
63  int findField(const dBase &db, const Common::String &field, dBase::Type type) const;
64  bool buildMap(const dBase &db, Common::StringMap &map) const;
65 };
66 
67 class Database {
68 public:
69  Database() {}
70  ~Database();
71 
72  bool openTable(const Common::String &id, const Common::Path &file);
73  bool closeTable(const Common::String &id);
74 
75  dBase *getTable(const Common::String &id);
76 
77 private:
79 };
80 
81 } // End of namespace Gob
82 
83 #endif // GOB_DATABASES_H
Definition: str.h:59
Definition: path.h:52
Definition: databases.h:67
Definition: dbase.h:87
Definition: anifile.h:40
Definition: databases.h:40
Language
Definition: language.h:45