Doxygen
Loading...
Searching...
No Matches
ConfigOption Class Referenceabstract

Abstract base class for any configuration option. More...

#include <src/configimpl.h>

+ Inheritance diagram for ConfigOption:
+ Collaboration diagram for ConfigOption:

Public Types

enum  OptionType {
  O_Info , O_List , O_Enum , O_String ,
  O_Int , O_Bool , O_Obsolete , O_Disabled
}
 
enum  { MAX_OPTION_LENGTH = 23 }
 

Public Member Functions

 ConfigOption (OptionType t)
 
OptionType kind () const
 
QCString name () const
 
QCString docs () const
 
QCString dependsOn () const
 
void addDependency (const char *dep)
 
void setEncoding (const QCString &e)
 
void setUserComment (const QCString &u)
 

Protected Member Functions

virtual void writeTemplate (TextStream &t, bool sl, bool upd)=0
 
virtual void compareDoxyfile (TextStream &t, Config::CompareMode compareMode)=0
 
virtual void writeXMLDoxyfile (TextStream &t)=0
 
virtual void writeXSDDoxyfile (TextStream &t)=0
 
virtual void convertStrToVal (Config::CompareMode)
 
virtual void emptyValueToDefault ()
 
virtual void substEnvVars ()=0
 
virtual void init ()
 
virtual bool isDefault ()
 
void writeBoolValue (TextStream &t, bool v, bool initSpace=true)
 
void writeIntValue (TextStream &t, int i, bool initSpace=true)
 
void writeStringValue (TextStream &t, const QCString &s, bool initSpace=true, bool wasQuoted=false)
 
void writeStringList (TextStream &t, const StringVector &l)
 

Protected Attributes

QCString m_spaces
 
QCString m_name
 
QCString m_doc
 
QCString m_dependency
 
QCString m_encoding
 
QCString m_userComment
 
OptionType m_kind
 

Friends

class ConfigImpl
 

Detailed Description

Abstract base class for any configuration option.

Definition at line 37 of file configimpl.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
MAX_OPTION_LENGTH 

Maximum length of an option in the config file. Used for alignment purposes.

Definition at line 56 of file configimpl.h.

57 {
58 /*! Maximum length of an option in the config file. Used for
59 * alignment purposes.
60 */
62 };

◆ OptionType

The type of option

Enumerator
O_Info 

A section header.

O_List 

A list of items.

O_Enum 

A fixed set of items.

O_String 

A single item.

O_Int 

An integer value.

O_Bool 

A boolean value.

O_Obsolete 

An obsolete option.

O_Disabled 

Disabled compile time option.

Definition at line 45 of file configimpl.h.

46 {
47 O_Info, //!< A section header
48 O_List, //!< A list of items
49 O_Enum, //!< A fixed set of items
50 O_String, //!< A single item
51 O_Int, //!< An integer value
52 O_Bool, //!< A boolean value
53 O_Obsolete, //!< An obsolete option
54 O_Disabled //!< Disabled compile time option
55 };
@ O_Disabled
Disabled compile time option.
Definition configimpl.h:54
@ O_List
A list of items.
Definition configimpl.h:48
@ O_Enum
A fixed set of items.
Definition configimpl.h:49
@ O_Bool
A boolean value.
Definition configimpl.h:52
@ O_String
A single item.
Definition configimpl.h:50
@ O_Obsolete
An obsolete option.
Definition configimpl.h:53
@ O_Int
An integer value.
Definition configimpl.h:51
@ O_Info
A section header.
Definition configimpl.h:47

Constructor & Destructor Documentation

◆ ConfigOption()

Member Function Documentation

◆ addDependency()

void ConfigOption::addDependency ( const char * dep)
inline

Definition at line 74 of file configimpl.h.

74{ m_dependency = dep; }
QCString m_dependency
Definition configimpl.h:97

References m_dependency.

◆ compareDoxyfile()

virtual void ConfigOption::compareDoxyfile ( TextStream & t,
Config::CompareMode compareMode )
protectedpure virtual

◆ convertStrToVal()

virtual void ConfigOption::convertStrToVal ( Config::CompareMode )
inlineprotectedvirtual

Reimplemented in ConfigBool, ConfigEnum, and ConfigInt.

Definition at line 83 of file configimpl.h.

83{}

Referenced by ConfigImpl::convertStrToVal().

◆ dependsOn()

QCString ConfigOption::dependsOn ( ) const
inline

Definition at line 73 of file configimpl.h.

73{ return m_dependency; }

References m_dependency.

Referenced by Config::checkAndCorrect(), and ConfigImpl::init().

◆ docs()

QCString ConfigOption::docs ( ) const
inline

Definition at line 71 of file configimpl.h.

71{ return m_doc; }
QCString m_doc
Definition configimpl.h:96

References m_doc.

◆ emptyValueToDefault()

virtual void ConfigOption::emptyValueToDefault ( )
inlineprotectedvirtual

Reimplemented in ConfigList, and ConfigString.

Definition at line 84 of file configimpl.h.

84{}

Referenced by ConfigImpl::emptyValueToDefault().

◆ init()

virtual void ConfigOption::init ( )
inlineprotectedvirtual

Reimplemented in ConfigBool, ConfigEnum, ConfigInt, ConfigList, and ConfigString.

Definition at line 86 of file configimpl.h.

86{}

Referenced by ConfigImpl::init().

◆ isDefault()

virtual bool ConfigOption::isDefault ( )
inlineprotectedvirtual

Reimplemented in ConfigBool, ConfigEnum, ConfigInt, ConfigList, and ConfigString.

Definition at line 87 of file configimpl.h.

87{ return true; }

◆ kind()

OptionType ConfigOption::kind ( ) const
inline

returns the kind of option this is.

Definition at line 69 of file configimpl.h.

69{ return m_kind; }

References m_kind.

Referenced by Config::checkAndCorrect(), DocPara::handleDoxyConfig(), and Config::updateObsolete().

◆ name()

◆ setEncoding()

void ConfigOption::setEncoding ( const QCString & e)
inline

Definition at line 75 of file configimpl.h.

75{ m_encoding = e; }
QCString m_encoding
Definition configimpl.h:98

References m_encoding.

◆ setUserComment()

void ConfigOption::setUserComment ( const QCString & u)
inline

Definition at line 76 of file configimpl.h.

76{ m_userComment += u; }
QCString m_userComment
Definition configimpl.h:99

References m_userComment.

◆ substEnvVars()

virtual void ConfigOption::substEnvVars ( )
protectedpure virtual

◆ writeBoolValue()

void ConfigOption::writeBoolValue ( TextStream & t,
bool v,
bool initSpace = true )
protected

Definition at line 137 of file configimpl.l.

138{
139 if (initSpace) t << " ";
140 if (v) t << "YES"; else t << "NO";
141}

Referenced by ConfigBool::writeTemplate(), and ConfigBool::writeXMLDoxyfile().

◆ writeIntValue()

void ConfigOption::writeIntValue ( TextStream & t,
int i,
bool initSpace = true )
protected

Definition at line 143 of file configimpl.l.

144{
145 if (initSpace) t << " ";
146 t << i;
147}

Referenced by ConfigInt::writeTemplate(), and ConfigInt::writeXMLDoxyfile().

◆ writeStringList()

void ConfigOption::writeStringList ( TextStream & t,
const StringVector & l )
protected

Definition at line 181 of file configimpl.l.

182{
183 bool first=TRUE;
184 for (const auto &p : l)
185 {
186 if (!first) t << " \\\n";
187 QCString s=p.c_str();
188 if (!first)
189 t << " ";
190 bool wasQuoted = ((s.at(0)=='"') && (s.at(s.length()-1)=='"'));
191 if (wasQuoted)
192 {
193 s = s.mid(1,s.length()-2);
194 }
195 writeStringValue(t,s,true,wasQuoted);
196 first=FALSE;
197 }
198}
void writeStringValue(TextStream &t, const QCString &s, bool initSpace=true, bool wasQuoted=false)
Definition configimpl.l:149
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:226
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:578
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34

References QCString::at(), FALSE, QCString::length(), QCString::mid(), TRUE, and writeStringValue().

Referenced by ConfigList::writeTemplate().

◆ writeStringValue()

void ConfigOption::writeStringValue ( TextStream & t,
const QCString & s,
bool initSpace = true,
bool wasQuoted = false )
protected

Definition at line 149 of file configimpl.l.

150{
151 char c = 0;
152 bool needsEscaping=wasQuoted;
153 // convert the string back to it original g_encoding
154 QCString se = configStringRecode(s,"UTF-8",m_encoding);
155 if (se.isEmpty()) return;
156 const char *p=se.data();
157 if (p)
158 {
159 if (initSpace) t << " ";
160 while ((c=*p++)!=0 && !needsEscaping)
161 needsEscaping = (c==' ' || c== ',' || c=='\n' || c=='\t' || c=='"' || c=='#');
162 if (needsEscaping)
163 {
164 t << "\"";
165 p=se.data();
166 while (*p)
167 {
168 if (*p==' ' && *(p+1)=='\0') break; // skip inserted space at the end
169 if (*p=='"') t << "\\"; // escape quotes
170 t << *p++;
171 }
172 t << "\"";
173 }
174 else
175 {
176 t << se;
177 }
178 }
179}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:159
static QCString configStringRecode(const QCString &str, const QCString &fromEncoding, const QCString &toEncoding)
Definition configimpl.l:700

References configStringRecode(), QCString::data(), QCString::isEmpty(), and m_encoding.

Referenced by writeStringList(), ConfigBool::writeTemplate(), ConfigEnum::writeTemplate(), ConfigInt::writeTemplate(), ConfigString::writeTemplate(), ConfigEnum::writeXMLDoxyfile(), ConfigList::writeXMLDoxyfile(), and ConfigString::writeXMLDoxyfile().

◆ writeTemplate()

virtual void ConfigOption::writeTemplate ( TextStream & t,
bool sl,
bool upd )
protectedpure virtual

◆ writeXMLDoxyfile()

virtual void ConfigOption::writeXMLDoxyfile ( TextStream & t)
protectedpure virtual

◆ writeXSDDoxyfile()

virtual void ConfigOption::writeXSDDoxyfile ( TextStream & t)
protectedpure virtual

Friends And Related Symbol Documentation

◆ ConfigImpl

friend class ConfigImpl
friend

Definition at line 39 of file configimpl.h.

References ConfigImpl, and ConfigOption().

Referenced by ConfigImpl.

Member Data Documentation

◆ m_dependency

QCString ConfigOption::m_dependency
protected

Definition at line 97 of file configimpl.h.

Referenced by addDependency(), and dependsOn().

◆ m_doc

◆ m_encoding

QCString ConfigOption::m_encoding
protected

Definition at line 98 of file configimpl.h.

Referenced by setEncoding(), and writeStringValue().

◆ m_kind

OptionType ConfigOption::m_kind
protected

Definition at line 100 of file configimpl.h.

Referenced by ConfigOption(), and kind().

◆ m_name

◆ m_spaces

◆ m_userComment


The documentation for this class was generated from the following files: