Doxygen
Loading...
Searching...
No Matches
ConfigEnum Class Reference

Class representing an enum type option. More...

#include <src/configimpl.h>

+ Inheritance diagram for ConfigEnum:
+ Collaboration diagram for ConfigEnum:

Public Member Functions

 ConfigEnum (const char *name, const char *doc, const char *defVal)
 
void addValue (const char *v)
 
const std::vector< QCString > & values () const
 
QCStringvalueRef ()
 
void substEnvVars () override
 
void writeTemplate (TextStream &t, bool sl, bool) override
 
void convertStrToVal (Config::CompareMode compareMode) override
 
void compareDoxyfile (TextStream &t, Config::CompareMode compareMode) override
 
void writeXMLDoxyfile (TextStream &t) override
 
void writeXSDDoxyfile (TextStream &t) override
 
void init () override
 
bool isDefault () override
 
- Public Member Functions inherited from ConfigOption
 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)
 

Private Attributes

std::vector< QCStringm_valueRange
 
QCString m_value
 
QCString m_defValue
 

Additional Inherited Members

- Public Types inherited from ConfigOption
enum  OptionType {
  O_Info , O_List , O_Enum , O_String ,
  O_Int , O_Bool , O_Obsolete , O_Disabled
}
 
enum  { MAX_OPTION_LENGTH = 23 }
 
- Protected Member Functions inherited from ConfigOption
virtual void emptyValueToDefault ()
 
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 inherited from ConfigOption
QCString m_spaces
 
QCString m_name
 
QCString m_doc
 
QCString m_dependency
 
QCString m_encoding
 
QCString m_userComment
 
OptionType m_kind
 

Detailed Description

Class representing an enum type option.

Definition at line 155 of file configimpl.h.

Constructor & Destructor Documentation

◆ ConfigEnum()

ConfigEnum::ConfigEnum ( const char * name,
const char * doc,
const char * defVal )
inline

Definition at line 158 of file configimpl.h.

160 {
161 m_name = name;
162 m_doc = doc;
163 m_value = defVal;
164 m_defValue = defVal;
165 }
QCString m_defValue
Definition configimpl.h:181
QCString m_value
Definition configimpl.h:180
QCString m_doc
Definition configimpl.h:96
ConfigOption(OptionType t)
Definition configimpl.h:63
QCString m_name
Definition configimpl.h:95
QCString name() const
Definition configimpl.h:70
@ O_Enum
A fixed set of items.
Definition configimpl.h:49

References ConfigOption::ConfigOption(), m_defValue, ConfigOption::m_doc, ConfigOption::m_name, m_value, ConfigOption::name(), and ConfigOption::O_Enum.

Member Function Documentation

◆ addValue()

void ConfigEnum::addValue ( const char * v)
inline

Definition at line 166 of file configimpl.h.

166{ m_valueRange.emplace_back(v); }
std::vector< QCString > m_valueRange
Definition configimpl.h:179

References m_valueRange.

◆ compareDoxyfile()

void ConfigEnum::compareDoxyfile ( TextStream & t,
Config::CompareMode compareMode )
overridevirtual

Implements ConfigOption.

Definition at line 473 of file configimpl.l.

474{
475 if (!isDefault()) writeTemplate(t,TRUE,TRUE);
476}
void writeTemplate(TextStream &t, bool sl, bool) override
Definition configimpl.l:456
bool isDefault() override
Definition configimpl.h:176
#define TRUE
Definition qcstring.h:37

References isDefault(), TRUE, and writeTemplate().

◆ convertStrToVal()

void ConfigEnum::convertStrToVal ( Config::CompareMode compareMode)
overridevirtual

Reimplemented from ConfigOption.

Definition at line 269 of file configimpl.l.

270{
271 if (m_value.isEmpty())
272 {
274 return;
275 }
276 if (compareMode == Config::CompareMode::CompressedNoEnv)
277 {
278 if (containsEnvVar(m_value)) return;
279 }
280 QCString val = m_value.stripWhiteSpace().lower();
281 for (const auto &s : m_valueRange)
282 {
283 if (s.lower() == val)
284 {
285 m_value = s;
286 return;
287 }
288 }
289
290 ConfigImpl::config_warn("argument '%s' for option %s is not a valid enum value\n"
291 "Using the default: %s!\n",qPrint(m_value),qPrint(m_name),qPrint(m_defValue));
293}
static void config_warn(const char *fmt,...)
Definition configimpl.l:78
static bool containsEnvVar(QCString &str)
const char * qPrint(const char *s)
Definition qcstring.h:672

References Config::CompressedNoEnv, ConfigImpl::config_warn(), containsEnvVar(), m_defValue, ConfigOption::m_name, m_value, m_valueRange, and qPrint().

◆ init()

void ConfigEnum::init ( )
inlineoverridevirtual

Reimplemented from ConfigOption.

Definition at line 175 of file configimpl.h.

175{ m_value = m_defValue; }

References m_defValue, and m_value.

◆ isDefault()

bool ConfigEnum::isDefault ( )
inlineoverridevirtual

Reimplemented from ConfigOption.

Definition at line 176 of file configimpl.h.

176{ return m_value == m_defValue; }

References m_defValue, and m_value.

Referenced by compareDoxyfile(), and writeXMLDoxyfile().

◆ substEnvVars()

void ConfigEnum::substEnvVars ( )
overridevirtual

Implements ConfigOption.

Definition at line 1534 of file configimpl.l.

1535{
1537}
static void substEnvVarsInString(QCString &s)

References m_value, and substEnvVarsInString().

◆ valueRef()

QCString * ConfigEnum::valueRef ( )
inline

Definition at line 168 of file configimpl.h.

168{ return &m_value; }

References m_value.

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

◆ values()

const std::vector< QCString > & ConfigEnum::values ( ) const
inline

Definition at line 167 of file configimpl.h.

167{ return m_valueRange; }

References m_valueRange.

◆ writeTemplate()

void ConfigEnum::writeTemplate ( TextStream & t,
bool sl,
bool  )
overridevirtual

Implements ConfigOption.

Definition at line 456 of file configimpl.l.

457{
458 if (!sl)
459 {
460 t << "\n";
462 t << "\n";
463 }
464 else if (!m_userComment.isEmpty())
465 {
467 }
468 t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";
470 t << "\n";
471}
void writeStringValue(TextStream &t, const QCString &s, bool initSpace=true, bool wasQuoted=false)
Definition configimpl.l:149
QCString m_userComment
Definition configimpl.h:99
QCString m_spaces
Definition configimpl.h:94
static QCString convertToComment(const QCString &s, const QCString &u)
Definition configimpl.l:98

References convertToComment(), ConfigOption::m_doc, ConfigOption::m_name, ConfigOption::m_spaces, ConfigOption::m_userComment, m_value, ConfigOption::MAX_OPTION_LENGTH, and ConfigOption::writeStringValue().

Referenced by compareDoxyfile().

◆ writeXMLDoxyfile()

void ConfigEnum::writeXMLDoxyfile ( TextStream & t)
overridevirtual

Implements ConfigOption.

Definition at line 478 of file configimpl.l.

479{
480 t << " <option id='" << m_name << "'";
481 t << " default='" << (isDefault() ? "yes" : "no") << "'";
482 t << " type='string'";
483 t << ">";
484 t << "<value>";
485 writeStringValue(t,m_value,false);
486 t << "</value>";
487 t << "</option>\n";
488}

References isDefault(), ConfigOption::m_name, m_value, and ConfigOption::writeStringValue().

◆ writeXSDDoxyfile()

void ConfigEnum::writeXSDDoxyfile ( TextStream & t)
overridevirtual

Implements ConfigOption.

Definition at line 490 of file configimpl.l.

491{
492 t << " <xsd:enumeration value=\"" << m_name << "\"/>\n";
493}

References ConfigOption::m_name.

Member Data Documentation

◆ m_defValue

QCString ConfigEnum::m_defValue
private

Definition at line 181 of file configimpl.h.

Referenced by ConfigEnum(), convertStrToVal(), init(), and isDefault().

◆ m_value

QCString ConfigEnum::m_value
private

◆ m_valueRange

std::vector<QCString> ConfigEnum::m_valueRange
private

Definition at line 179 of file configimpl.h.

Referenced by addValue(), convertStrToVal(), and values().


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