Root/
Source at commit 1322 created 12 years 8 months ago. By meklort, Add doxygen to utils folder | |
---|---|
1 | /******************************************************************************␊ |
2 | *␊ |
3 | * $Id: config.h,v 1.39 2001/03/19 19:27:40 root Exp $␊ |
4 | *␊ |
5 | *␊ |
6 | * Copyright (C) 1997-2011 by Dimitri van Heesch.␊ |
7 | *␊ |
8 | * Permission to use, copy, modify, and distribute this software and its␊ |
9 | * documentation under the terms of the GNU General Public License is hereby ␊ |
10 | * granted. No representations are made about the suitability of this software ␊ |
11 | * for any purpose. It is provided "as is" without express or implied warranty.␊ |
12 | * See the GNU General Public License for more details.␊ |
13 | *␊ |
14 | * Documents produced by Doxygen are derivative works derived from the␊ |
15 | * input used in their production; they are not affected by this license.␊ |
16 | *␊ |
17 | */␊ |
18 | ␊ |
19 | #ifndef CONFIG_H␊ |
20 | #define CONFIG_H␊ |
21 | ␊ |
22 | #include "qtbc.h"␊ |
23 | #include <qstrlist.h>␊ |
24 | #include <qfile.h>␊ |
25 | #include <qdict.h>␊ |
26 | #include <qlist.h>␊ |
27 | #include "ftextstream.h"␊ |
28 | ␊ |
29 | ␊ |
30 | /*! \brief Abstract base class for any configuration option.␊ |
31 | *␊ |
32 | */␊ |
33 | class ConfigOption␊ |
34 | {␊ |
35 | friend class Config;␊ |
36 | ␊ |
37 | public:␊ |
38 | ␊ |
39 | /*! The type of option */␊ |
40 | enum OptionType ␊ |
41 | { ␊ |
42 | O_Info, //<! A section header␊ |
43 | O_List, //<! A list of items␊ |
44 | O_Enum, //<! A fixed set of items␊ |
45 | O_String, //<! A single item␊ |
46 | O_Int, //<! An integer value␊ |
47 | O_Bool, //<! A boolean value␊ |
48 | O_Obsolete //<! An obsolete option␊ |
49 | };␊ |
50 | enum ␊ |
51 | { ␊ |
52 | /*! Maximum length of an option in the config file. Used for ␊ |
53 | * alignment purposes.␊ |
54 | */␊ |
55 | MAX_OPTION_LENGTH = 23 ␊ |
56 | };␊ |
57 | ConfigOption(OptionType t) : m_kind(t) ␊ |
58 | {␊ |
59 | m_spaces.fill(' ',40);␊ |
60 | }␊ |
61 | virtual ~ConfigOption()␊ |
62 | {␊ |
63 | }␊ |
64 | ␊ |
65 | /*! returns the kind of option this is. */␊ |
66 | OptionType kind() const { return m_kind; }␊ |
67 | QCString name() const { return m_name; }␊ |
68 | QCString docs() const { return m_doc; }␊ |
69 | ␊ |
70 | QCString dependsOn() const { return m_dependency; }␊ |
71 | void addDependency(const char *dep) { m_dependency = dep; }␊ |
72 | void setEncoding(const QCString &e) { m_encoding = e; }␊ |
73 | ␊ |
74 | protected:␊ |
75 | virtual void writeTemplate(FTextStream &t,bool sl,bool upd) = 0;␊ |
76 | virtual void convertStrToVal() {}␊ |
77 | virtual void substEnvVars() = 0;␊ |
78 | virtual void writeXML(FTextStream&) {}␊ |
79 | virtual void init() {}␊ |
80 | ␊ |
81 | QCString convertToComment(const QCString &s);␊ |
82 | void writeBoolValue(FTextStream &t,bool v);␊ |
83 | void writeIntValue(FTextStream &t,int i);␊ |
84 | void writeStringValue(FTextStream &t,QCString &s);␊ |
85 | void writeStringList(FTextStream &t,QStrList &l);␊ |
86 | ␊ |
87 | QCString m_spaces;␊ |
88 | QCString m_name;␊ |
89 | QCString m_doc;␊ |
90 | QCString m_dependency;␊ |
91 | QCString m_encoding;␊ |
92 | OptionType m_kind;␊ |
93 | };␊ |
94 | ␊ |
95 | /*! \brief Section marker for grouping the configuration options␊ |
96 | *␊ |
97 | */␊ |
98 | class ConfigInfo : public ConfigOption␊ |
99 | {␊ |
100 | public:␊ |
101 | ConfigInfo(const char *name,const char *doc) ␊ |
102 | : ConfigOption(O_Info)␊ |
103 | {␊ |
104 | m_name = name;␊ |
105 | m_doc = doc;␊ |
106 | }␊ |
107 | void writeTemplate(FTextStream &t, bool sl,bool)␊ |
108 | {␊ |
109 | if (!sl)␊ |
110 | {␊ |
111 | t << "\n";␊ |
112 | }␊ |
113 | t << "#---------------------------------------------------------------------------\n";␊ |
114 | t << "# " << m_doc << endl;␊ |
115 | t << "#---------------------------------------------------------------------------\n";␊ |
116 | }␊ |
117 | void substEnvVars() {}␊ |
118 | };␊ |
119 | ␊ |
120 | /*! \brief Option of the list type.␊ |
121 | *␊ |
122 | */␊ |
123 | class ConfigList : public ConfigOption␊ |
124 | {␊ |
125 | public:␊ |
126 | enum WidgetType { String, File, Dir, FileAndDir };␊ |
127 | ConfigList(const char *name,const char *doc) ␊ |
128 | : ConfigOption(O_List)␊ |
129 | {␊ |
130 | m_name = name;␊ |
131 | m_doc = doc;␊ |
132 | m_widgetType = String;␊ |
133 | }␊ |
134 | void addValue(const char *v) { m_value.append(v); }␊ |
135 | void setWidgetType(WidgetType w) { m_widgetType = w; }␊ |
136 | WidgetType widgetType() const { return m_widgetType; }␊ |
137 | QStrList *valueRef() { return &m_value; }␊ |
138 | void writeTemplate(FTextStream &t,bool sl,bool)␊ |
139 | {␊ |
140 | if (!sl)␊ |
141 | {␊ |
142 | t << endl;␊ |
143 | t << convertToComment(m_doc);␊ |
144 | t << endl;␊ |
145 | }␊ |
146 | t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";␊ |
147 | writeStringList(t,m_value);␊ |
148 | t << "\n";␊ |
149 | }␊ |
150 | void substEnvVars();␊ |
151 | void writeXML(FTextStream&);␊ |
152 | void init() { m_value.clear(); }␊ |
153 | private:␊ |
154 | QStrList m_value;␊ |
155 | WidgetType m_widgetType;␊ |
156 | };␊ |
157 | ␊ |
158 | /*! \brief Option of the enum type.␊ |
159 | *␊ |
160 | */␊ |
161 | class ConfigEnum : public ConfigOption␊ |
162 | {␊ |
163 | public:␊ |
164 | ConfigEnum(const char *name,const char *doc,const char *defVal) ␊ |
165 | : ConfigOption(O_Enum)␊ |
166 | {␊ |
167 | m_name = name;␊ |
168 | m_doc = doc;␊ |
169 | m_value = defVal;␊ |
170 | m_defValue = defVal;␊ |
171 | }␊ |
172 | void addValue(const char *v) { m_valueRange.append(v); }␊ |
173 | QStrListIterator iterator() ␊ |
174 | {␊ |
175 | return QStrListIterator(m_valueRange);␊ |
176 | }␊ |
177 | QCString *valueRef() { return &m_value; }␊ |
178 | void substEnvVars();␊ |
179 | void writeTemplate(FTextStream &t,bool sl,bool)␊ |
180 | {␊ |
181 | if (!sl)␊ |
182 | {␊ |
183 | t << endl;␊ |
184 | t << convertToComment(m_doc);␊ |
185 | t << endl;␊ |
186 | }␊ |
187 | t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";␊ |
188 | writeStringValue(t,m_value);␊ |
189 | t << "\n";␊ |
190 | }␊ |
191 | void writeXML(FTextStream&);␊ |
192 | void init() { m_value = m_defValue.copy(); }␊ |
193 | ␊ |
194 | private:␊ |
195 | QStrList m_valueRange;␊ |
196 | QCString m_value;␊ |
197 | QCString m_defValue;␊ |
198 | };␊ |
199 | ␊ |
200 | /*! \brief Option of the string type.␊ |
201 | *␊ |
202 | */␊ |
203 | class ConfigString : public ConfigOption␊ |
204 | {␊ |
205 | public:␊ |
206 | enum WidgetType { String, File, Dir };␊ |
207 | ConfigString(const char *name,const char *doc) ␊ |
208 | : ConfigOption(O_String)␊ |
209 | {␊ |
210 | m_name = name;␊ |
211 | m_doc = doc;␊ |
212 | m_widgetType = String;␊ |
213 | }␊ |
214 | ~ConfigString()␊ |
215 | {␊ |
216 | }␊ |
217 | void setWidgetType(WidgetType w) { m_widgetType = w; }␊ |
218 | WidgetType widgetType() const { return m_widgetType; }␊ |
219 | void setDefaultValue(const char *v) { m_defValue = v; }␊ |
220 | QCString *valueRef() { return &m_value; }␊ |
221 | void writeTemplate(FTextStream &t,bool sl,bool)␊ |
222 | {␊ |
223 | if (!sl)␊ |
224 | {␊ |
225 | t << endl;␊ |
226 | t << convertToComment(m_doc);␊ |
227 | t << endl;␊ |
228 | }␊ |
229 | t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";␊ |
230 | writeStringValue(t,m_value);␊ |
231 | t << "\n";␊ |
232 | }␊ |
233 | void substEnvVars();␊ |
234 | void writeXML(FTextStream&);␊ |
235 | void init() { m_value = m_defValue.copy(); }␊ |
236 | ␊ |
237 | private:␊ |
238 | QCString m_value;␊ |
239 | QCString m_defValue;␊ |
240 | WidgetType m_widgetType;␊ |
241 | };␊ |
242 | ␊ |
243 | /*! \brief Option of the integer type.␊ |
244 | *␊ |
245 | */␊ |
246 | class ConfigInt : public ConfigOption␊ |
247 | {␊ |
248 | public:␊ |
249 | ConfigInt(const char *name,const char *doc,int minVal,int maxVal,int defVal) ␊ |
250 | : ConfigOption(O_Int)␊ |
251 | {␊ |
252 | m_name = name;␊ |
253 | m_doc = doc;␊ |
254 | m_value = defVal;␊ |
255 | m_defValue = defVal;␊ |
256 | m_minVal = minVal;␊ |
257 | m_maxVal = maxVal;␊ |
258 | }␊ |
259 | QCString *valueStringRef() { return &m_valueString; }␊ |
260 | int *valueRef() { return &m_value; }␊ |
261 | int minVal() const { return m_minVal; }␊ |
262 | int maxVal() const { return m_maxVal; }␊ |
263 | void convertStrToVal();␊ |
264 | void substEnvVars();␊ |
265 | void writeTemplate(FTextStream &t,bool sl,bool upd)␊ |
266 | {␊ |
267 | if (!sl)␊ |
268 | {␊ |
269 | t << endl;␊ |
270 | t << convertToComment(m_doc);␊ |
271 | t << endl;␊ |
272 | }␊ |
273 | t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";␊ |
274 | if (upd && !m_valueString.isEmpty())␊ |
275 | {␊ |
276 | writeStringValue(t,m_valueString);␊ |
277 | }␊ |
278 | else␊ |
279 | {␊ |
280 | writeIntValue(t,m_value);␊ |
281 | }␊ |
282 | t << "\n";␊ |
283 | }␊ |
284 | void writeXML(FTextStream&);␊ |
285 | void init() { m_value = m_defValue; }␊ |
286 | private:␊ |
287 | int m_value;␊ |
288 | int m_defValue;␊ |
289 | int m_minVal;␊ |
290 | int m_maxVal;␊ |
291 | QCString m_valueString;␊ |
292 | };␊ |
293 | ␊ |
294 | /*! \brief Option of the boolean type.␊ |
295 | *␊ |
296 | */␊ |
297 | class ConfigBool : public ConfigOption␊ |
298 | {␊ |
299 | public:␊ |
300 | ConfigBool(const char *name,const char *doc,bool defVal) ␊ |
301 | : ConfigOption(O_Bool)␊ |
302 | {␊ |
303 | m_name = name;␊ |
304 | m_doc = doc;␊ |
305 | m_value = defVal;␊ |
306 | m_defValue = defVal;␊ |
307 | }␊ |
308 | QCString *valueStringRef() { return &m_valueString; }␊ |
309 | bool *valueRef() { return &m_value; }␊ |
310 | void convertStrToVal();␊ |
311 | void substEnvVars();␊ |
312 | void setValueString(const QCString &v) { m_valueString = v; }␊ |
313 | void writeTemplate(FTextStream &t,bool sl,bool upd)␊ |
314 | {␊ |
315 | if (!sl)␊ |
316 | {␊ |
317 | t << endl;␊ |
318 | t << convertToComment(m_doc);␊ |
319 | t << endl;␊ |
320 | }␊ |
321 | t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";␊ |
322 | if (upd && !m_valueString.isEmpty())␊ |
323 | {␊ |
324 | writeStringValue(t,m_valueString);␊ |
325 | }␊ |
326 | else␊ |
327 | {␊ |
328 | writeBoolValue(t,m_value);␊ |
329 | }␊ |
330 | t << "\n";␊ |
331 | }␊ |
332 | void writeXML(FTextStream&);␊ |
333 | void init() { m_value = m_defValue; }␊ |
334 | private:␊ |
335 | bool m_value;␊ |
336 | bool m_defValue;␊ |
337 | QCString m_valueString;␊ |
338 | };␊ |
339 | ␊ |
340 | /*! \brief Section marker for obsolete options␊ |
341 | *␊ |
342 | */␊ |
343 | class ConfigObsolete : public ConfigOption␊ |
344 | {␊ |
345 | public:␊ |
346 | ConfigObsolete(const char *name,OptionType t) : ConfigOption(t) ␊ |
347 | { m_name = name; }␊ |
348 | void writeTemplate(FTextStream &,bool,bool) {}␊ |
349 | void substEnvVars() {}␊ |
350 | void writeXML(FTextStream&);␊ |
351 | };␊ |
352 | ␊ |
353 | ␊ |
354 | // some convenience macros␊ |
355 | #define Config_getString(val) Config::instance()->getString(__FILE__,__LINE__,val)␊ |
356 | #define Config_getInt(val) Config::instance()->getInt(__FILE__,__LINE__,val)␊ |
357 | #define Config_getList(val) Config::instance()->getList(__FILE__,__LINE__,val)␊ |
358 | #define Config_getEnum(val) Config::instance()->getEnum(__FILE__,__LINE__,val)␊ |
359 | #define Config_getBool(val) Config::instance()->getBool(__FILE__,__LINE__,val)␊ |
360 | ␊ |
361 | /*! \brief Singleton for configuration variables.␊ |
362 | *␊ |
363 | * This object holds the global static variables␊ |
364 | * read from a user-supplied configuration file.␊ |
365 | * The static member instance() can be used to get␊ |
366 | * a pointer to the one and only instance.␊ |
367 | * ␊ |
368 | * Set all variables to their default values by␊ |
369 | * calling Config::instance()->init()␊ |
370 | *␊ |
371 | */␊ |
372 | class Config␊ |
373 | {␊ |
374 | public:␊ |
375 | /////////////////////////////␊ |
376 | // public API␊ |
377 | /////////////////////////////␊ |
378 | ␊ |
379 | /*! Returns the one and only instance of this class */␊ |
380 | static Config *instance()␊ |
381 | {␊ |
382 | if (m_instance==0) m_instance = new Config;␊ |
383 | return m_instance;␊ |
384 | }␊ |
385 | /*! Delete the instance */␊ |
386 | static void deleteInstance()␊ |
387 | {␊ |
388 | delete m_instance;␊ |
389 | m_instance=0;␊ |
390 | }␊ |
391 | ␊ |
392 | /*! Returns an iterator that can by used to iterate over the ␊ |
393 | * configuration options.␊ |
394 | */␊ |
395 | QListIterator<ConfigOption> iterator()␊ |
396 | {␊ |
397 | return QListIterator<ConfigOption>(*m_options);␊ |
398 | }␊ |
399 | ␊ |
400 | /*! ␊ |
401 | * @name Getting configuration values.␊ |
402 | * @{␊ |
403 | */␊ |
404 | ␊ |
405 | /*! Returns the value of the string option with name \a fileName. ␊ |
406 | * The arguments \a num and \a name are for debugging purposes only.␊ |
407 | * There is a convenience function Config_getString() for this.␊ |
408 | */␊ |
409 | QCString &getString(const char *fileName,int num,const char *name) const;␊ |
410 | ␊ |
411 | /*! Returns the value of the list option with name \a fileName. ␊ |
412 | * The arguments \a num and \a name are for debugging purposes only.␊ |
413 | * There is a convenience function Config_getList() for this.␊ |
414 | */␊ |
415 | QStrList &getList(const char *fileName,int num,const char *name) const;␊ |
416 | ␊ |
417 | /*! Returns the value of the enum option with name \a fileName. ␊ |
418 | * The arguments \a num and \a name are for debugging purposes only.␊ |
419 | * There is a convenience function Config_getEnum() for this.␊ |
420 | */␊ |
421 | QCString &getEnum(const char *fileName,int num,const char *name) const;␊ |
422 | ␊ |
423 | /*! Returns the value of the integer option with name \a fileName. ␊ |
424 | * The arguments \a num and \a name are for debugging purposes only.␊ |
425 | * There is a convenience function Config_getInt() for this.␊ |
426 | */␊ |
427 | int &getInt(const char *fileName,int num,const char *name) const;␊ |
428 | ␊ |
429 | /*! Returns the value of the boolean option with name \a fileName. ␊ |
430 | * The arguments \a num and \a name are for debugging purposes only.␊ |
431 | * There is a convenience function Config_getBool() for this.␊ |
432 | */␊ |
433 | bool &getBool(const char *fileName,int num,const char *name) const;␊ |
434 | ␊ |
435 | /*! Returns the ConfigOption corresponding with \a name or 0 if␊ |
436 | * the option is not supported.␊ |
437 | */␊ |
438 | ConfigOption *get(const char *name) const␊ |
439 | {␊ |
440 | return m_dict->find(name); ␊ |
441 | }␊ |
442 | /* @} */␊ |
443 | ␊ |
444 | /*! ␊ |
445 | * @name Adding configuration options. ␊ |
446 | * @{␊ |
447 | */␊ |
448 | ␊ |
449 | /*! Starts a new configuration section with \a name and description \a doc.␊ |
450 | * \returns An object representing the option.␊ |
451 | */␊ |
452 | ConfigInfo *addInfo(const char *name,const char *doc)␊ |
453 | {␊ |
454 | ConfigInfo *result = new ConfigInfo(name,doc);␊ |
455 | m_options->append(result);␊ |
456 | return result;␊ |
457 | }␊ |
458 | ␊ |
459 | /*! Adds a new string option with \a name and documentation \a doc.␊ |
460 | * \returns An object representing the option.␊ |
461 | */␊ |
462 | ConfigString *addString(const char *name,␊ |
463 | const char *doc)␊ |
464 | {␊ |
465 | ConfigString *result = new ConfigString(name,doc);␊ |
466 | m_options->append(result);␊ |
467 | m_dict->insert(name,result);␊ |
468 | return result;␊ |
469 | }␊ |
470 | ␊ |
471 | /*! Adds a new enumeration option with \a name and documentation \a doc␊ |
472 | * and initial value \a defVal. ␊ |
473 | * \returns An object representing the option.␊ |
474 | */␊ |
475 | ConfigEnum *addEnum(const char *name,␊ |
476 | const char *doc,␊ |
477 | const char *defVal)␊ |
478 | {␊ |
479 | ConfigEnum *result = new ConfigEnum(name,doc,defVal);␊ |
480 | m_options->append(result);␊ |
481 | m_dict->insert(name,result);␊ |
482 | return result;␊ |
483 | }␊ |
484 | ␊ |
485 | /*! Adds a new string option with \a name and documentation \a doc.␊ |
486 | * \returns An object representing the option.␊ |
487 | */␊ |
488 | ConfigList *addList(const char *name,␊ |
489 | const char *doc)␊ |
490 | {␊ |
491 | ConfigList *result = new ConfigList(name,doc);␊ |
492 | m_options->append(result);␊ |
493 | m_dict->insert(name,result);␊ |
494 | return result;␊ |
495 | }␊ |
496 | ␊ |
497 | /*! Adds a new integer option with \a name and documentation \a doc.␊ |
498 | * The integer has a range between \a minVal and \a maxVal and a␊ |
499 | * default value of \a defVal.␊ |
500 | * \returns An object representing the option.␊ |
501 | */␊ |
502 | ConfigInt *addInt(const char *name,␊ |
503 | const char *doc,␊ |
504 | int minVal,int maxVal,int defVal)␊ |
505 | {␊ |
506 | ConfigInt *result = new ConfigInt(name,doc,minVal,maxVal,defVal);␊ |
507 | m_options->append(result);␊ |
508 | m_dict->insert(name,result);␊ |
509 | return result;␊ |
510 | }␊ |
511 | ␊ |
512 | /*! Adds a new boolean option with \a name and documentation \a doc.␊ |
513 | * The boolean has a default value of \a defVal.␊ |
514 | * \returns An object representing the option.␊ |
515 | */␊ |
516 | ConfigBool *addBool(const char *name,␊ |
517 | const char *doc,␊ |
518 | bool defVal)␊ |
519 | {␊ |
520 | ConfigBool *result = new ConfigBool(name,doc,defVal);␊ |
521 | m_options->append(result);␊ |
522 | m_dict->insert(name,result);␊ |
523 | return result;␊ |
524 | }␊ |
525 | /*! Adds an option that has become obsolete. */␊ |
526 | ConfigOption *addObsolete(const char *name)␊ |
527 | {␊ |
528 | ConfigObsolete *option = new ConfigObsolete(name,ConfigOption::O_Obsolete);␊ |
529 | m_dict->insert(name,option);␊ |
530 | m_obsolete->append(option);␊ |
531 | return option;␊ |
532 | }␊ |
533 | /*! @} */␊ |
534 | ␊ |
535 | /*! Writes a template configuration to stream \a t. If \a shortIndex␊ |
536 | * is \c TRUE the description of each configuration option will␊ |
537 | * be omitted.␊ |
538 | */␊ |
539 | void writeTemplate(FTextStream &t,bool shortIndex,bool updateOnly);␊ |
540 | ␊ |
541 | /** Write XML representation of the config file */␊ |
542 | void writeXML(FTextStream &t);␊ |
543 | ␊ |
544 | /////////////////////////////␊ |
545 | // internal API␊ |
546 | /////////////////////////////␊ |
547 | ␊ |
548 | /*! Converts the string values read from the configuration file␊ |
549 | * to real values for non-string type options (like int, and bools)␊ |
550 | */␊ |
551 | void convertStrToVal();␊ |
552 | ␊ |
553 | /*! Replaces references to environment variable by the actual value␊ |
554 | * of the environment variable.␊ |
555 | */␊ |
556 | void substituteEnvironmentVars();␊ |
557 | ␊ |
558 | /*! Checks if the values of the variable are correct, adjusts them␊ |
559 | * if needed, and report any errors.␊ |
560 | */␊ |
561 | void check();␊ |
562 | ␊ |
563 | /*! Initialize config variables to their default value */␊ |
564 | void init();␊ |
565 | ␊ |
566 | /*! Parse a configuration data in string \a str.␊ |
567 | * \returns TRUE if successful, or FALSE if the string could not be␊ |
568 | * parsed.␊ |
569 | */ ␊ |
570 | bool parseString(const char *fn,const char *str);␊ |
571 | ␊ |
572 | /*! Parse a configuration file with name \a fn.␊ |
573 | * \returns TRUE if successful, FALSE if the file could not be ␊ |
574 | * opened or read.␊ |
575 | */ ␊ |
576 | bool parse(const char *fn);␊ |
577 | ␊ |
578 | /*! Called from the constructor, will add doxygen's default options␊ |
579 | * to the configuration object ␊ |
580 | */␊ |
581 | void create();␊ |
582 | ␊ |
583 | protected:␊ |
584 | ␊ |
585 | Config()␊ |
586 | { ␊ |
587 | m_options = new QList<ConfigOption>;␊ |
588 | m_obsolete = new QList<ConfigOption>;␊ |
589 | m_dict = new QDict<ConfigOption>(257);␊ |
590 | m_options->setAutoDelete(TRUE);␊ |
591 | m_obsolete->setAutoDelete(TRUE);␊ |
592 | m_initialized = FALSE;␊ |
593 | create();␊ |
594 | }␊ |
595 | ~Config()␊ |
596 | {␊ |
597 | delete m_options;␊ |
598 | delete m_obsolete;␊ |
599 | delete m_dict;␊ |
600 | }␊ |
601 | ␊ |
602 | private:␊ |
603 | QList<ConfigOption> *m_options;␊ |
604 | QList<ConfigOption> *m_obsolete;␊ |
605 | QDict<ConfigOption> *m_dict;␊ |
606 | static Config *m_instance;␊ |
607 | bool m_initialized;␊ |
608 | };␊ |
609 | ␊ |
610 | #endif␊ |
611 |