Debian Codegraph @

src/tools/dlgedit/dlg_module_entry.h

raw
1 /*
2 $Id$
3
4 Copyright (C) 2002 Kai Sterker <[email protected]>
5 Part of the Adonthell Project http://adonthell.linuxgames.com
6
7 Dlgedit 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 2 of the License, or
10 (at your option) any later version.
11
12 Dlgedit 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 Dlgedit; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22 /**
23 * @file dlg_module_entry.h
24 *
25 * @author Kai Sterker
26 * @brief The textual contents of a DlgModule.
27 */
28
29 #ifndef DLG_MODULE_ENTRY_H
30 #define DLG_MODULE_ENTRY_H
31
32 #include <string>
33 #include <vector>
34
35 /**
36 * The %DlgModuleeEntry keeps the custom Python code of a certain
37 * dialogue and a few other settings.
38 */
39 class DlgModuleEntry
40 {
41 public:
42 /**
43 * Create an empty %DlgModuleEntry.
44 */
45 DlgModuleEntry ();
46
47 /**
48 * @name Initialization / Cleanup
49 */
50 //@{
51 /**
52 * Initialize the entry to a sane state. All members are set to
53 * the empty string ("").
54 */
55 void init ();
56 /**
57 * Reset the entry to state after construction time. Erases all quest
58 * and character information. Sets other members to "".
59 */
60 void clear ();
61 //@}
62
63 /**
64 * Attribute access.
65 */
66 //@{
67 /**
68 * Get the project this module is assigned to.
69 * @return the project the module belongs to.
70 */
71 std::string project () { return project_; }
72 /**
73 * Get the description of this module.
74 * @return the module's description.
75 */
76 std::string description () { return description_; }
77 /**
78 * Get the import statements assigned to this module.
79 * @return the module's additional imports.
80 */
81 std::string imports () { return imports_; }
82 /**
83 * Get the constructor code assigned to this module.
84 * @return the module's constructor code.
85 */
86 std::string ctor () { return ctor_; }
87 /**
88 * Get the destructor code assigned to this module.
89 * @return the module's destructor code.
90 */
91 std::string dtor () { return dtor_; }
92 /**
93 * Get the user defined methods of this module.
94 * @return the module's user defined methods.
95 */
96 std::string methods () { return methods_; }
97 /**
98 * Sets the project this dialogue belongs to. Then loads the NPC and
99 * Quest names of this project.
100 * @param p Project name
101 * @return <b>true</b> if NPC's and Quests could be loaded,
102 * <b>false</b> otherwise.
103 */
104 bool setProject (std::string p);
105
106 /**
107 * Set the description of this module.
108 * @param d some text describing the module.
109 */
110 void setDescription (std::string d) { description_ = d; }
111 /**
112 * Set the import statements assigned to this module.
113 * @param i the module's additional imports.
114 */
115 void setImports (std::string i) { imports_ = i; }
116 /**
117 * Set the constructor code assigned to this module.
118 * @param c the module's constructor code.
119 */
120 void setCtor (std::string c) { ctor_ = c; }
121 /**
122 * Set the destructor code assigned to this module.
123 * @param d the module's destructor code.
124 */
125 void setDtor (std::string d) { dtor_ = d; }
126 /**
127 * Set the user defined methods of this module.
128 * @param m the module's user defined methods.
129 */
130 void setMethods (std::string m) { methods_ = m; }
131
132 /**
133 * Test whether the given string represents an available character.
134 * @param c name of the character to check for.
135 * @retorn <b>true</b> if the character exists, <b>false</b> otherwise.
136 */
137 bool isCharacter (const std::string &c);
138 /**
139 * Test whether the given string represents an available quest.
140 * @param q name of the quest to check for.
141 * @retorn <b>true</b> if the quest exists, <b>false</b> otherwise.
142 */
143 bool isQuest (const std::string &q);
144
145 /**
146 * Iterate over the available characters.
147 * @return the character name or the empty string ("") when the
148 * end of the list is reached.
149 */
150 std::string character ();
151 /**
152 * Iterate over the available quests.
153 * @return the quest name or the empty string ("") when the
154 * end of the list is reached.
155 */
156 std::string quest ();
157 //@}
158
159 private:
160 bool loadCharacters ();
161 bool loadQuests ();
162
163 void addCharacter (std::string c);
164 void addQuest (std::string q);
165
166 std::string project_; // project the dialogue belongs to
167 std::string imports_; // additional import statements
168 std::string ctor_; // constructor code
169 std::string dtor_; // destructor code
170 std::string methods_; // user defined methods
171 std::string description_; // Description of the dialogue
172
173 std::vector<std::string> characters;
174 std::vector<std::string> quests;
175 std::vector<std::string>::iterator itc;
176 std::vector<std::string>::iterator itq;
177 };
178
179 #endif // DLG_MODULE_ENTRY_H