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
25namespace Common {
26class SeekableReadStream;
27}
28
29namespace QDEngine {
30
32class qdTextDB {
33public:
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
63private:
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: stream.h:745
Definition: str.h:59
База данных с текстами.
Definition: qd_textdb.h:32
const char * getSound(const char *text_id) const
Возвращает звук к тексту с идентификатором text_id.
bool load(Common::SeekableReadStream *fh, const char *comments_file_name=NULL, bool clear_old_texts=true)
Загрузка базы.
const char * getText(const char *text_id) const
Возвращает текст с идентификатором text_id.
const char * getComment(const char *text_id) const
Возвращает комментарий текста с идентификатором text_id.
void clear()
Очистка базы.
Definition: qd_textdb.h:38
void clear(bool shrinkArray=0)
Definition: hashmap.h:431
Definition: algorithm.h:29
Базовый класс для игровых ресурсов.
Definition: console.h:28