ScummVM API documentation
tt_word.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 TITANIC_TT_WORD_H
23 #define TITANIC_TT_WORD_H
24 
25 #include "titanic/support/exe_resources.h"
26 #include "titanic/support/simple_file.h"
27 #include "titanic/true_talk/tt_string.h"
28 #include "titanic/true_talk/tt_synonym.h"
29 
30 namespace Titanic {
31 
35 enum WordClass {
36  WC_UNKNOWN = 0, WC_ACTION = 1, WC_THING = 2, WC_ABSTRACT = 3,
37  WC_ARTICLE = 4, WC_CONJUNCTION = 5, WC_PRONOUN = 6,
38  WC_PREPOSITION = 7, WC_ADJECTIVE = 8, WC_ADVERB = 9
39 };
40 
41 class TTword {
42 protected:
43  TTstringStatus _status;
44  int _field24;
45  int _field28;
46 protected:
50  uint readNumber(const char *str);
51 
52  bool testFileHandle(SimpleFile *file) const { return true; }
53  bool testFileHandle(FileHandle resHandle) const;
54 public:
55  TTword *_nextP;
56  TTsynonym *_synP;
57  TTstring _text;
58  WordClass _wordClass;
59  int _id;
60  uint _tag;
61 public:
62  TTword(const TTstring &str, WordClass wordClass, int val2);
63  TTword(const TTword *src);
64  virtual ~TTword();
65 
69  void deleteSiblings();
70 
74  int readSyn(SimpleFile *file);
75 
79  void setSyn(TTsynonym *synP);
80 
84  int setSynStr(TTstring &str);
85 
89  bool hasSynonyms() const { return _synP != nullptr; }
90 
94  void appendNode(TTsynonym *node);
95 
99  int load(SimpleFile *file, WordClass wordClass);
100 
108  bool findSynByName(const TTstring &str, TTsynonym *dest, VocabMode mode) const;
109 
110  const char *c_str() const { return _text.c_str(); }
111  operator const char *() const { return c_str(); }
112 
116  const TTstring getText() { return _text; }
117 
121  bool compareTo(const char *str) const;
122 
126  bool compareTo(TTstring *str) const {
127  return compareTo(str->c_str());
128  }
129 
133  TTstringStatus getStatus() const { return _status; }
134 
138  bool isValid() const { return _status == SS_VALID; }
139 
143  TTstringStatus getChainStatus() const;
144 
148  bool isClass(WordClass wordClass) const { return _wordClass == wordClass; }
149 
153  TTword *copyWords();
154 
158  virtual TTword *copy() const;
159 
160  virtual bool proc2(int val) const { return false; }
161  virtual int proc3() const { return -1; }
162  virtual void proc4() {}
163  virtual void proc5() {}
164 
168  virtual bool checkTag() const { return false; }
169 
173  virtual bool compareTagTo(uint tag) const { return false; }
174 
178  virtual uint getTag() const { return 0; }
179 
180  virtual bool proc9(int val) const { return false; }
181  virtual int proc10() const { return 0; }
182  virtual void proc11() {}
183  virtual bool proc12(int val) const { return false; }
184  virtual int proc13() const { return 0; }
185  virtual bool proc14(int val) const { return false; }
186  virtual int proc15() const { return -1; }
187  virtual bool proc16() const { return false; }
188  virtual bool proc17() const { return false; }
189  virtual bool proc18() const { return false; }
190  virtual bool comparePronounTo(int val) const { return false; }
191  virtual int proc20() const { return 0; }
192 
196  virtual FileHandle getSynFile() const;
197 
202  virtual bool checkSynFile(FileHandle file) const;
203 
207  virtual void setSynFile(FileHandle file);
208 
212  virtual int save(SimpleFile *file) const { return 0; }
213 };
214 
215 } // End of namespace Titanic
216 
217 #endif /* TITANIC_TT_WORD_H */
const char * c_str() const
Definition: tt_string.h:128
virtual FileHandle getSynFile() const
virtual uint getTag() const
Definition: tt_word.h:178
void appendNode(TTsynonym *node)
void setSyn(TTsynonym *synP)
Definition: tt_synonym.h:30
int load(SimpleFile *file, WordClass wordClass)
Definition: simple_file.h:49
virtual bool compareTagTo(uint tag) const
Definition: tt_word.h:173
virtual bool checkTag() const
Definition: tt_word.h:168
const TTstring getText()
Definition: tt_word.h:116
virtual void setSynFile(FileHandle file)
TTword * copyWords()
bool findSynByName(const TTstring &str, TTsynonym *dest, VocabMode mode) const
bool isValid() const
Definition: tt_word.h:138
TTstringStatus getChainStatus() const
virtual TTword * copy() const
void deleteSiblings()
Definition: arm.h:30
uint readNumber(const char *str)
virtual bool checkSynFile(FileHandle file) const
bool hasSynonyms() const
Definition: tt_word.h:89
Definition: tt_string.h:45
TTstringStatus getStatus() const
Definition: tt_word.h:133
bool isClass(WordClass wordClass) const
Definition: tt_word.h:148
Definition: tt_word.h:41
bool compareTo(TTstring *str) const
Definition: tt_word.h:126
virtual int save(SimpleFile *file) const
Definition: tt_word.h:212
bool compareTo(const char *str) const
int readSyn(SimpleFile *file)
int setSynStr(TTstring &str)