ScummVM API documentation
qd_textdb.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 QDENGINE_QDCORE_TEXTDB_H
23 #define QDENGINE_QDCORE_TEXTDB_H
24 
25 namespace Common {
26 class SeekableReadStream;
27 }
28 
29 namespace QDEngine {
30 
32 class qdTextDB {
33 public:
34  qdTextDB();
35  ~qdTextDB();
36 
38  void clear() {
39  _texts.clear();
40  }
41 
43 
46  const char *getText(const char *text_id) const;
47 
49  const char *getSound(const char *text_id) const;
50 
52  const char *getComment(const char *text_id) const;
53 
55 
59  bool load(Common::SeekableReadStream *fh, const char *comments_file_name = NULL, bool clear_old_texts = true);
60 
61  static qdTextDB &instance();
62 
63 private:
64 
65  struct qdText {
66  qdText(const char *text, const char *snd) : _text(text), _sound(snd) { }
67  qdText() {}
68 
69  Common::String _text;
70  Common::String _sound;
71  Common::String _comment;
72  };
73 
75  qdTextMap _texts;
76 };
77 
78 } // namespace QDEngine
79 
80 #endif // QDENGINE_QDCORE_QD_TEXTDB_H
Definition: str.h:59
void clear()
Очистка базы.
Definition: qd_textdb.h:38
База данных с текстами.
Definition: qd_textdb.h:32
Definition: stream.h:745
Базовый класс для игровых ресурсов.
Definition: console.h:28
Definition: algorithm.h:29