Doxygen
Loading...
Searching...
No Matches
configimpl.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 *
4 *
5 *
6 * Copyright (C) 1997-2015 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 CONFIGIMPL_H
20#define CONFIGIMPL_H
21
22#include <vector>
23#include <unordered_map>
24#include <string>
25#include <memory>
26#include <iostream>
27
28#include "containers.h"
29#include "qcstring.h"
30#include "config.h"
31#include "construct.h"
32#include "message.h"
33
34class TextStream;
35
36/** Abstract base class for any configuration option.
37 */
39{
40 friend class ConfigImpl;
41
42 public:
44
45 /*! The type of option */
47 {
48 O_Info, //!< A section header
49 O_List, //!< A list of items
50 O_Enum, //!< A fixed set of items
51 O_String, //!< A single item
52 O_Int, //!< An integer value
53 O_Bool, //!< A boolean value
54 O_Obsolete, //!< An obsolete option
55 O_Disabled //!< Disabled compile time option
56 };
57 enum
58 {
59 /*! Maximum length of an option in the config file. Used for
60 * alignment purposes.
61 */
63 };
65 {
66 m_spaces.fill(' ',40);
67 }
68
69 /*! returns the kind of option this is. */
70 OptionType kind() const { return m_kind; }
71 QCString name() const { return m_name; }
72 QCString docs() const { return m_doc; }
73
74 QCString dependsOn() const { return m_dependency; }
75 void addDependency(const char *dep) { m_dependency = dep; }
76 void setEncoding(const QCString &e) { m_encoding = e; }
77 void setUserComment(const QCString &u) { m_userComment += u; }
78
79 protected:
80 virtual void writeTemplate(TextStream &t,bool sl,bool upd) = 0;
81 virtual void compareDoxyfile(TextStream &t,Config::CompareMode compareMode) = 0;
82 virtual void writeXMLDoxyfile(TextStream &t) = 0;
83 virtual void writeXSDDoxyfile(TextStream &t) = 0;
85 virtual void emptyValueToDefault() {}
86 virtual void substEnvVars() = 0;
87 virtual void init() {}
88 virtual bool isDefault() { return true; }
89
90 void writeBoolValue(TextStream &t,bool v,bool initSpace = true);
91 void writeIntValue(TextStream &t,int i,bool initSpace = true);
92 void writeStringValue(TextStream &t,const QCString &s,bool initSpace = true,bool wasQuoted = false);
93 void writeStringList(TextStream &t,const StringVector &l);
94
102};
103
104/** Section marker for grouping the configuration options.
105 */
107{
108 public:
109 ConfigInfo(const char *name,const char *doc)
111 {
112 m_name = name;
113 m_doc = doc;
114 }
115 void writeTemplate(TextStream &t, bool sl,bool) override;
117 void writeXMLDoxyfile(TextStream &) override {}
118 void writeXSDDoxyfile(TextStream &t) override {}
119 void substEnvVars() override {}
120};
121
122/** Class representing a list type option.
123 */
125{
126 public:
128 ConfigList(const char *name,const char *doc)
130 {
131 m_name = name;
132 m_doc = doc;
134 }
135 void addValue(const char *v) { m_defaultValue.emplace_back(v); }
140 void emptyValueToDefault() override { if (m_value.empty() && !m_defaultValue.empty()) m_value=m_defaultValue; };
141 void writeTemplate(TextStream &t,bool sl,bool) override;
142 void compareDoxyfile(TextStream &t,Config::CompareMode compareMode) override;
143 void writeXMLDoxyfile(TextStream &t) override;
144 void writeXSDDoxyfile(TextStream &t) override;
145 void substEnvVars() override;
146 void init() override { m_value = m_defaultValue; }
147 bool isDefault() override;
148 private:
152};
153
154/** Class representing an enum type option.
155 */
157{
158 public:
159 ConfigEnum(const char *name,const char *doc,const char *defVal)
161 {
162 m_name = name;
163 m_doc = doc;
164 m_value = defVal;
165 m_defValue = defVal;
166 }
167 void addValue(const char *v) { m_valueRange.emplace_back(v); }
168 const std::vector<QCString> &values() const { return m_valueRange; }
169 QCString *valueRef() { return &m_value; }
170 void substEnvVars() override;
171 void writeTemplate(TextStream &t,bool sl,bool) override;
172 void convertStrToVal(Config::CompareMode compareMode) override;
173 void compareDoxyfile(TextStream &t,Config::CompareMode compareMode) override;
174 void writeXMLDoxyfile(TextStream &t) override;
175 void writeXSDDoxyfile(TextStream &t) override;
176 void init() override { m_value = m_defValue; }
177 bool isDefault() override { return m_value == m_defValue; }
178
179 private:
180 std::vector<QCString> m_valueRange;
183};
184
185/** Class representing a string type option.
186 */
188{
189 public:
191 ConfigString(const char *name,const char *doc)
193 {
194 m_name = name;
195 m_doc = doc;
197 }
200 void setDefaultValue(const char *v) { m_defValue = v; }
201 QCString *valueRef() { return &m_value; }
202 void writeTemplate(TextStream &t,bool sl,bool) override;
203 void compareDoxyfile(TextStream &t,Config::CompareMode compareMode) override;
204 void writeXMLDoxyfile(TextStream &t) override;
205 void writeXSDDoxyfile(TextStream &t) override;
206 void substEnvVars() override;
207 void init() override { m_value = m_defValue; }
208 void emptyValueToDefault() override { if (m_value.isEmpty()) m_value=m_defValue; };
209 bool isDefault() override { return m_value.stripWhiteSpace() == m_defValue.stripWhiteSpace(); }
210
211 private:
215};
216
217/** Class representing an integer type option.
218 */
220{
221 public:
222 ConfigInt(const char *name,const char *doc,int minVal,int maxVal,int defVal)
224 {
225 m_name = name;
226 m_doc = doc;
227 m_value = defVal;
228 m_defValue = defVal;
231 }
233 int *valueRef() { return &m_value; }
234 int minVal() const { return m_minVal; }
235 int maxVal() const { return m_maxVal; }
236 void convertStrToVal(Config::CompareMode compareMode) override;
237 void substEnvVars() override;
238 void writeTemplate(TextStream &t,bool sl,bool upd) override;
239 void compareDoxyfile(TextStream &t,Config::CompareMode compareMode) override;
240 void writeXMLDoxyfile(TextStream &t) override;
241 void writeXSDDoxyfile(TextStream &t) override;
242 void init() override { m_value = m_defValue; }
243 bool isDefault() override { return m_value == m_defValue; }
244 private:
250};
251
252/** Class representing a Boolean type option.
253 */
255{
256 public:
257 ConfigBool(const char *name,const char *doc,bool defVal)
259 {
260 m_name = name;
261 m_doc = doc;
262 m_value = defVal;
263 m_defValue = defVal;
264 }
266 bool *valueRef() { return &m_value; }
267 void convertStrToVal(Config::CompareMode compareMode) override;
268 void substEnvVars() override;
269 void setValueString(const QCString &v) { m_valueString = v; }
270 void writeTemplate(TextStream &t,bool sl,bool upd) override;
271 void compareDoxyfile(TextStream &t,Config::CompareMode compareMode) override;
272 void writeXMLDoxyfile(TextStream &t) override;
273 void writeXSDDoxyfile(TextStream &t) override;
274 void init() override { m_value = m_defValue; }
275 bool isDefault() override { return m_value == m_defValue; }
276 private:
280};
281
282/** Section marker for obsolete options
283 */
285{
286 public:
289 void writeTemplate(TextStream &,bool,bool) override;
291 void writeXMLDoxyfile(TextStream &) override {}
292 void writeXSDDoxyfile(TextStream &) override {}
293 void substEnvVars() override {}
294 OptionType orgType() const { return m_orgType; }
297 void markAsPresent() { m_present = true; }
298 bool isPresent() const { return m_present; }
299 private:
303 bool m_present = false;
304};
305
306/** Section marker for compile time optional options
307 */
309{
310 public:
313 void writeTemplate(TextStream &,bool,bool) override;
315 void writeXMLDoxyfile(TextStream &) override {}
316 void writeXSDDoxyfile(TextStream &) override;
317 void substEnvVars() override {}
318};
319
320// some convenience macros for access the config options
321#define ConfigImpl_getString(val) ConfigImpl::instance()->getString(__FILE__,__LINE__,val)
322#define ConfigImpl_getInt(val) ConfigImpl::instance()->getInt(__FILE__,__LINE__,val)
323#define ConfigImpl_getList(val) ConfigImpl::instance()->getList(__FILE__,__LINE__,val)
324#define ConfigImpl_getEnum(val) ConfigImpl::instance()->getEnum(__FILE__,__LINE__,val)
325#define ConfigImpl_getBool(val) ConfigImpl::instance()->getBool(__FILE__,__LINE__,val)
326
327
328using ConfigOptionList = std::vector< std::unique_ptr<ConfigOption> >;
329using ConfigOptionMap = std::unordered_map< std::string, ConfigOption* >;
330
331/** Singleton for configuration variables.
332 *
333 * This object holds the global static variables
334 * read from a user-supplied configuration file.
335 * The static member instance() can be used to get
336 * a pointer to the one and only instance.
337 *
338 * Set all variables to their default values by
339 * calling Config::instance()->init()
340 *
341 */
343{
344 public:
345 /////////////////////////////
346 // public API
347 /////////////////////////////
348 ConfigImpl();
349
350 /*! Returns the one and only instance of this class */
352 {
353 if (!m_instance) m_instance = std::make_unique<ConfigImpl>();
354 return m_instance.get();
355 }
356 /*! Delete the instance */
357 static void deleteInstance()
358 {
359 m_instance.reset();
360 }
361
362 /*!
363 * @name Getting configuration values.
364 * @{
365 */
366
367 /*! Returns the value of the string option with name \a fileName.
368 * The arguments \a num and \a name are for debugging purposes only.
369 * There is a convenience function Config_getString() for this.
370 */
371 QCString &getString(const char *fileName,int num,const char *name) const;
372
373 /*! Returns the value of the list option with name \a fileName.
374 * The arguments \a num and \a name are for debugging purposes only.
375 * There is a convenience function Config_getList() for this.
376 */
377 StringVector &getList(const char *fileName,int num,const char *name) const;
378
379 /*! Returns the value of the enum option with name \a fileName.
380 * The arguments \a num and \a name are for debugging purposes only.
381 * There is a convenience function Config_getEnum() for this.
382 */
383 QCString &getEnum(const char *fileName,int num,const char *name) const;
384
385 /*! Returns the value of the integer option with name \a fileName.
386 * The arguments \a num and \a name are for debugging purposes only.
387 * There is a convenience function Config_getInt() for this.
388 */
389 int &getInt(const char *fileName,int num,const char *name) const;
390
391 /*! Returns the value of the boolean option with name \a fileName.
392 * The arguments \a num and \a name are for debugging purposes only.
393 * There is a convenience function Config_getBool() for this.
394 */
395 bool &getBool(const char *fileName,int num,const char *name) const;
396
397 /*! Returns the ConfigOption corresponding with \a name or 0 if
398 * the option is not supported.
399 */
400 ConfigOption *get(const QCString &name) const
401 {
402 auto it = m_dict.find(name.str());
403 return it!=m_dict.end() ? it->second : nullptr;
404 }
405 /* @} */
406
407 /*!
408 * @name Adding configuration options.
409 * @{
410 */
411
412 /*! Starts a new configuration section with \a name and description \a doc.
413 * \returns An object representing the option.
414 */
415 ConfigInfo *addInfo(const char *name,const char *doc)
416 {
417 ConfigInfo *result = new ConfigInfo(name,doc);
418 m_options.push_back(std::unique_ptr<ConfigOption>(result));
419 return result;
420 }
421
422 /*! Adds a new string option with \a name and documentation \a doc.
423 * \returns An object representing the option.
424 */
425 ConfigString *addString(const char *name,
426 const char *doc)
427 {
428 ConfigString *result = new ConfigString(name,doc);
429 m_options.push_back(std::unique_ptr<ConfigOption>(result));
430 m_dict.emplace(name,result);
431 return result;
432 }
433
434 /*! Adds a new enumeration option with \a name and documentation \a doc
435 * and initial value \a defVal.
436 * \returns An object representing the option.
437 */
438 ConfigEnum *addEnum(const char *name,
439 const char *doc,
440 const char *defVal)
441 {
442 ConfigEnum *result = new ConfigEnum(name,doc,defVal);
443 m_options.push_back(std::unique_ptr<ConfigOption>(result));
444 m_dict.emplace(name,result);
445 return result;
446 }
447
448 /*! Adds a new string option with \a name and documentation \a doc.
449 * \returns An object representing the option.
450 */
451 ConfigList *addList(const char *name,
452 const char *doc)
453 {
454 ConfigList *result = new ConfigList(name,doc);
455 m_options.push_back(std::unique_ptr<ConfigOption>(result));
456 m_dict.emplace(name,result);
457 return result;
458 }
459
460 /*! Adds a new integer option with \a name and documentation \a doc.
461 * The integer has a range between \a minVal and \a maxVal and a
462 * default value of \a defVal.
463 * \returns An object representing the option.
464 */
465 ConfigInt *addInt(const char *name,
466 const char *doc,
467 int minVal,int maxVal,int defVal)
468 {
469 ConfigInt *result = new ConfigInt(name,doc,minVal,maxVal,defVal);
470 m_options.push_back(std::unique_ptr<ConfigOption>(result));
471 m_dict.emplace(name,result);
472 return result;
473 }
474
475 /*! Adds a new boolean option with \a name and documentation \a doc.
476 * The boolean has a default value of \a defVal.
477 * \returns An object representing the option.
478 */
479 ConfigBool *addBool(const char *name,
480 const char *doc,
481 bool defVal)
482 {
483 ConfigBool *result = new ConfigBool(name,doc,defVal);
484 m_options.push_back(std::unique_ptr<ConfigOption>(result));
485 m_dict.emplace(name,result);
486 return result;
487 }
488
489 /*! Adds an option that has become obsolete. */
491 {
492 ConfigObsolete *result = new ConfigObsolete(name,orgType);
493 m_obsolete.push_back(std::unique_ptr<ConfigOption>(result));
494 m_dict.emplace(name,result);
495 return result;
496 }
497
498 /*! Adds an option that has been disabled at compile time. */
499 ConfigOption *addDisabled(const char *name)
500 {
501 ConfigDisabled *result = new ConfigDisabled(name);
502 m_disabled.push_back(std::unique_ptr<ConfigOption>(result));
503 m_dict.emplace(name,result);
504 return result;
505 }
506 /*! @} */
507
508 /*! Writes a template configuration to stream \a t. If \a shortIndex
509 * is \c TRUE the description of each configuration option will
510 * be omitted.
511 */
512 void writeTemplate(TextStream &t,bool shortIndex,bool updateOnly);
513
514 /*! Writes a the differences between the current configuration and the
515 * template configuration to stream \a t.
516 */
518
519 /*! Writes a the used settings of the current configuration as XML format
520 * to stream \a t.
521 */
523
524 /*! Writes all possible setting ids to an XSD file for validation
525 * through the stream \a t.
526 */
528
529 void setHeader(const char *header) { m_header = header; }
530
531 /////////////////////////////
532 // internal API
533 /////////////////////////////
534
535 /*! Converts the string values read from the configuration file
536 * to real values for non-string type options (like int, and bools)
537 */
538 void convertStrToVal(Config::CompareMode compareMode);
539
540 /*! Sets default value in case value is empty
541 */
542 void emptyValueToDefault();
543
544 /*! Replaces references to environment variable by the actual value
545 * of the environment variable.
546 */
548
549 /*! Initialize config variables to their default value */
550 void init();
551
552 /*! Parse a configuration data in string \a str.
553 * \returns TRUE if successful, or FALSE if the string could not be
554 * parsed.
555 */
556 bool parseString(const QCString &fn,const QCString &str,bool upd = FALSE);
557
558 /*! Parse a configuration file with name \a fn.
559 * \returns TRUE if successful, FALSE if the file could not be
560 * opened or read.
561 */
562 bool parse(const QCString &fn,bool upd = FALSE);
563
564 /*! Append user start comment
565 */
567 {
568 m_startComment += u;
569 }
570 /*! Append user comment
571 */
573 {
574 m_userComment += u;
575 }
576 /*! Append replacement string
577 */
579 {
580 m_storeRepl += u;
581 }
582 /*! Take the user start comment and reset it internally
583 * \returns user start comment
584 */
586 {
588 m_startComment.clear();
589 return substitute(result,"\r","");
590 }
591 /*! Take the user comment and reset it internally
592 * \returns user comment
593 */
595 {
596 QCString result=m_userComment;
597 m_userComment.clear();
598 return substitute(result,"\r","");
599 }
600 /*! Take the replacement string
601 * \returns the replacement string
602 */
604 {
605 QCString result=m_storeRepl;
606 m_storeRepl.clear();
607 return substitute(result,"\r","");
608 }
609
610 static void config_err_ (fmt::string_view fmt, fmt::format_args args);
611 static void config_term_(fmt::string_view fmt, fmt::format_args args);
612 static void config_warn_(fmt::string_view fmt, fmt::format_args args);
613
614 template<typename ...Args>
615 static void config_err(fmt::format_string<Args...> fmt, Args&&... args)
616 {
617 config_err_(fmt,fmt::make_format_args(args...));
618 }
619
620 template<typename ...Args>
621 static void config_term(fmt::format_string<Args...> fmt, Args&&... args)
622 {
623 config_term_(fmt,fmt::make_format_args(args...));
624 }
625
626 template<typename ...Args>
627 static void config_warn(fmt::format_string<Args...> fmt, Args&&... args)
628 {
629 config_warn_(fmt,fmt::make_format_args(args...));
630 }
631
632 private:
637 static std::unique_ptr<ConfigImpl> m_instance;
642};
643
644#endif
Class representing a Boolean type option.
Definition configimpl.h:255
ConfigBool(const char *name, const char *doc, bool defVal)
Definition configimpl.h:257
void init() override
Definition configimpl.h:274
void writeTemplate(TextStream &t, bool sl, bool upd) override
Definition configimpl.l:572
bool isDefault() override
Definition configimpl.h:275
void writeXMLDoxyfile(TextStream &t) override
Definition configimpl.l:602
bool * valueRef()
Definition configimpl.h:266
void writeXSDDoxyfile(TextStream &t) override
Definition configimpl.l:614
void substEnvVars() override
QCString * valueStringRef()
Definition configimpl.h:265
void compareDoxyfile(TextStream &t, Config::CompareMode compareMode) override
Definition configimpl.l:597
void convertStrToVal(Config::CompareMode compareMode) override
Definition configimpl.l:237
bool m_defValue
Definition configimpl.h:278
QCString m_valueString
Definition configimpl.h:279
void setValueString(const QCString &v)
Definition configimpl.h:269
Section marker for compile time optional options.
Definition configimpl.h:309
void writeXSDDoxyfile(TextStream &) override
Definition configimpl.l:622
void writeXMLDoxyfile(TextStream &) override
Definition configimpl.h:315
ConfigDisabled(const char *name)
Definition configimpl.h:311
void compareDoxyfile(TextStream &, Config::CompareMode) override
Definition configimpl.h:314
void writeTemplate(TextStream &, bool, bool) override
Definition configimpl.l:621
void substEnvVars() override
Definition configimpl.h:317
Class representing an enum type option.
Definition configimpl.h:157
void writeTemplate(TextStream &t, bool sl, bool) override
Definition configimpl.l:446
QCString m_defValue
Definition configimpl.h:182
void writeXSDDoxyfile(TextStream &t) override
Definition configimpl.l:480
void compareDoxyfile(TextStream &t, Config::CompareMode compareMode) override
Definition configimpl.l:463
bool isDefault() override
Definition configimpl.h:177
void writeXMLDoxyfile(TextStream &t) override
Definition configimpl.l:468
void init() override
Definition configimpl.h:176
void addValue(const char *v)
Definition configimpl.h:167
QCString * valueRef()
Definition configimpl.h:169
std::vector< QCString > m_valueRange
Definition configimpl.h:180
const std::vector< QCString > & values() const
Definition configimpl.h:168
ConfigEnum(const char *name, const char *doc, const char *defVal)
Definition configimpl.h:159
void substEnvVars() override
void convertStrToVal(Config::CompareMode compareMode) override
Definition configimpl.l:259
QCString m_value
Definition configimpl.h:181
ConfigInt * addInt(const char *name, const char *doc, int minVal, int maxVal, int defVal)
Definition configimpl.h:465
QCString takeStoreRepl()
Definition configimpl.h:603
ConfigEnum * addEnum(const char *name, const char *doc, const char *defVal)
Definition configimpl.h:438
ConfigOptionList m_options
Definition configimpl.h:633
static void config_term(fmt::format_string< Args... > fmt, Args &&... args)
Definition configimpl.h:621
static void deleteInstance()
Definition configimpl.h:357
QCString m_storeRepl
Definition configimpl.h:640
ConfigOptionList m_obsolete
Definition configimpl.h:634
ConfigOptionMap m_dict
Definition configimpl.h:636
void compareDoxyfile(TextStream &t, Config::CompareMode compareMode)
void convertStrToVal(Config::CompareMode compareMode)
static void config_err(fmt::format_string< Args... > fmt, Args &&... args)
Definition configimpl.h:615
void appendUserComment(const QCString &u)
Definition configimpl.h:572
ConfigOption * addDisabled(const char *name)
Definition configimpl.h:499
static void config_term_(fmt::string_view fmt, fmt::format_args args)
Definition configimpl.l:64
static ConfigImpl * instance()
Definition configimpl.h:351
void init()
ConfigList * addList(const char *name, const char *doc)
Definition configimpl.h:451
void substituteEnvironmentVars()
bool parseString(const QCString &fn, const QCString &str, bool upd=FALSE)
void setHeader(const char *header)
Definition configimpl.h:529
QCString & getEnum(const char *fileName, int num, const char *name) const
Definition configimpl.l:313
bool parse(const QCString &fn, bool upd=FALSE)
QCString takeStartComment()
Definition configimpl.h:585
ConfigOption * get(const QCString &name) const
Definition configimpl.h:400
void appendStoreRepl(const QCString &u)
Definition configimpl.h:578
void appendStartComment(const QCString &u)
Definition configimpl.h:566
void writeXMLDoxyfile(TextStream &t)
StringVector & getList(const char *fileName, int num, const char *name) const
Definition configimpl.l:299
void writeXSDDoxyfile(TextStream &t)
QCString takeUserComment()
Definition configimpl.h:594
static void config_err_(fmt::string_view fmt, fmt::format_args args)
Definition configimpl.l:59
ConfigString * addString(const char *name, const char *doc)
Definition configimpl.h:425
static void config_warn(fmt::format_string< Args... > fmt, Args &&... args)
Definition configimpl.h:627
void writeTemplate(TextStream &t, bool shortIndex, bool updateOnly)
ConfigInfo * addInfo(const char *name, const char *doc)
Definition configimpl.h:415
ConfigBool * addBool(const char *name, const char *doc, bool defVal)
Definition configimpl.h:479
QCString m_startComment
Definition configimpl.h:638
static std::unique_ptr< ConfigImpl > m_instance
Definition configimpl.h:637
static void config_warn_(fmt::string_view fmt, fmt::format_args args)
Definition configimpl.l:71
bool & getBool(const char *fileName, int num, const char *name) const
Definition configimpl.l:341
ConfigOptionList m_disabled
Definition configimpl.h:635
QCString m_userComment
Definition configimpl.h:639
int & getInt(const char *fileName, int num, const char *name) const
Definition configimpl.l:327
ConfigOption * addObsolete(const char *name, ConfigOption::OptionType orgType)
Definition configimpl.h:490
void emptyValueToDefault()
QCString m_header
Definition configimpl.h:641
QCString & getString(const char *fileName, int num, const char *name) const
Definition configimpl.l:285
Section marker for grouping the configuration options.
Definition configimpl.h:107
void substEnvVars() override
Definition configimpl.h:119
void writeXMLDoxyfile(TextStream &) override
Definition configimpl.h:117
void writeXSDDoxyfile(TextStream &t) override
Definition configimpl.h:118
ConfigInfo(const char *name, const char *doc)
Definition configimpl.h:109
void compareDoxyfile(TextStream &, Config::CompareMode) override
Definition configimpl.h:116
void writeTemplate(TextStream &t, bool sl, bool) override
Definition configimpl.l:357
Class representing an integer type option.
Definition configimpl.h:220
ConfigInt(const char *name, const char *doc, int minVal, int maxVal, int defVal)
Definition configimpl.h:222
void init() override
Definition configimpl.h:242
QCString * valueStringRef()
Definition configimpl.h:232
int * valueRef()
Definition configimpl.h:233
bool isDefault() override
Definition configimpl.h:243
int maxVal() const
Definition configimpl.h:235
void writeXMLDoxyfile(TextStream &t) override
Definition configimpl.l:555
void convertStrToVal(Config::CompareMode compareMode) override
Definition configimpl.l:195
void writeXSDDoxyfile(TextStream &t) override
Definition configimpl.l:567
void compareDoxyfile(TextStream &t, Config::CompareMode compareMode) override
Definition configimpl.l:550
int m_defValue
Definition configimpl.h:246
QCString m_valueString
Definition configimpl.h:249
void writeTemplate(TextStream &t, bool sl, bool upd) override
Definition configimpl.l:526
int minVal() const
Definition configimpl.h:234
void substEnvVars() override
Class representing a list type option.
Definition configimpl.h:125
WidgetType m_widgetType
Definition configimpl.h:151
void setWidgetType(WidgetType w)
Definition configimpl.h:136
void substEnvVars() override
StringVector * valueRef()
Definition configimpl.h:138
void writeTemplate(TextStream &t, bool sl, bool) override
Definition configimpl.l:368
void init() override
Definition configimpl.h:146
void addValue(const char *v)
Definition configimpl.h:135
StringVector getDefault()
Definition configimpl.h:139
bool isDefault() override
Definition configimpl.l:385
ConfigList(const char *name, const char *doc)
Definition configimpl.h:128
StringVector m_defaultValue
Definition configimpl.h:150
StringVector m_value
Definition configimpl.h:149
void writeXMLDoxyfile(TextStream &t) override
Definition configimpl.l:422
WidgetType widgetType() const
Definition configimpl.h:137
void emptyValueToDefault() override
Definition configimpl.h:140
void writeXSDDoxyfile(TextStream &t) override
Definition configimpl.l:441
void compareDoxyfile(TextStream &t, Config::CompareMode compareMode) override
Definition configimpl.l:417
Section marker for obsolete options.
Definition configimpl.h:285
void writeXSDDoxyfile(TextStream &) override
Definition configimpl.h:292
OptionType m_orgType
Definition configimpl.h:300
ConfigObsolete(const char *name, OptionType orgType)
Definition configimpl.h:287
void markAsPresent()
Definition configimpl.h:297
bool isPresent() const
Definition configimpl.h:298
StringVector m_listvalue
Definition configimpl.h:301
QCString m_valueString
Definition configimpl.h:302
void writeTemplate(TextStream &, bool, bool) override
Definition configimpl.l:619
StringVector * valueListRef()
Definition configimpl.h:295
QCString * valueStringRef()
Definition configimpl.h:296
OptionType orgType() const
Definition configimpl.h:294
void substEnvVars() override
Definition configimpl.h:293
void writeXMLDoxyfile(TextStream &) override
Definition configimpl.h:291
void compareDoxyfile(TextStream &, Config::CompareMode) override
Definition configimpl.h:290
Abstract base class for any configuration option.
Definition configimpl.h:39
virtual void convertStrToVal(Config::CompareMode)
Definition configimpl.h:84
void setEncoding(const QCString &e)
Definition configimpl.h:76
virtual void init()
Definition configimpl.h:87
QCString m_doc
Definition configimpl.h:97
void addDependency(const char *dep)
Definition configimpl.h:75
virtual void writeXMLDoxyfile(TextStream &t)=0
void writeStringValue(TextStream &t, const QCString &s, bool initSpace=true, bool wasQuoted=false)
Definition configimpl.l:139
QCString docs() const
Definition configimpl.h:72
ConfigOption(OptionType t)
Definition configimpl.h:64
QCString m_encoding
Definition configimpl.h:99
QCString m_name
Definition configimpl.h:96
QCString m_dependency
Definition configimpl.h:98
virtual void writeTemplate(TextStream &t, bool sl, bool upd)=0
void setUserComment(const QCString &u)
Definition configimpl.h:77
QCString m_userComment
Definition configimpl.h:100
OptionType m_kind
Definition configimpl.h:101
void writeIntValue(TextStream &t, int i, bool initSpace=true)
Definition configimpl.l:133
void writeStringList(TextStream &t, const StringVector &l)
Definition configimpl.l:171
virtual void writeXSDDoxyfile(TextStream &t)=0
friend class ConfigImpl
Definition configimpl.h:40
QCString dependsOn() const
Definition configimpl.h:74
QCString m_spaces
Definition configimpl.h:95
virtual void emptyValueToDefault()
Definition configimpl.h:85
QCString name() const
Definition configimpl.h:71
virtual void compareDoxyfile(TextStream &t, Config::CompareMode compareMode)=0
@ O_Disabled
Disabled compile time option.
Definition configimpl.h:55
@ O_List
A list of items.
Definition configimpl.h:49
@ O_Enum
A fixed set of items.
Definition configimpl.h:50
@ O_Bool
A boolean value.
Definition configimpl.h:53
@ O_String
A single item.
Definition configimpl.h:51
@ O_Obsolete
An obsolete option.
Definition configimpl.h:54
@ O_Int
An integer value.
Definition configimpl.h:52
@ O_Info
A section header.
Definition configimpl.h:48
virtual void substEnvVars()=0
void writeBoolValue(TextStream &t, bool v, bool initSpace=true)
Definition configimpl.l:127
OptionType kind() const
Definition configimpl.h:70
virtual bool isDefault()
Definition configimpl.h:88
Class representing a string type option.
Definition configimpl.h:188
QCString m_value
Definition configimpl.h:212
void substEnvVars() override
bool isDefault() override
Definition configimpl.h:209
void setWidgetType(WidgetType w)
Definition configimpl.h:198
void writeXSDDoxyfile(TextStream &t) override
Definition configimpl.l:521
WidgetType m_widgetType
Definition configimpl.h:214
WidgetType widgetType() const
Definition configimpl.h:199
void writeXMLDoxyfile(TextStream &t) override
Definition configimpl.l:507
QCString * valueRef()
Definition configimpl.h:201
void writeTemplate(TextStream &t, bool sl, bool) override
Definition configimpl.l:485
void setDefaultValue(const char *v)
Definition configimpl.h:200
void emptyValueToDefault() override
Definition configimpl.h:208
QCString m_defValue
Definition configimpl.h:213
void init() override
Definition configimpl.h:207
void compareDoxyfile(TextStream &t, Config::CompareMode compareMode) override
Definition configimpl.l:502
ConfigString(const char *name, const char *doc)
Definition configimpl.h:191
This is an alternative implementation of QCString.
Definition qcstring.h:101
const std::string & str() const
Definition qcstring.h:537
Text streaming class that buffers data.
Definition textstream.h:36
std::vector< std::unique_ptr< ConfigOption > > ConfigOptionList
Definition configimpl.h:328
std::unordered_map< std::string, ConfigOption * > ConfigOptionMap
Definition configimpl.h:329
#define ABSTRACT_BASE_CLASS(cls)
Macro to implement rule of 5 for an abstract base class.
Definition construct.h:20
std::vector< std::string > StringVector
Definition containers.h:33
CompareMode
Definition config.h:54
Definition message.h:144
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition qcstring.cpp:477
#define FALSE
Definition qcstring.h:34