Skip to main content

The ConfigEnum Class Reference

Class representing an enum type option. More...

Declaration

class ConfigEnum { ... }

Included Headers

#include <src/configimpl.h>

Base class

classConfigOption

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

Public Constructors Index

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

Public Member Functions Index

voidaddValue (const char *v)
const std::vector< QCString > &values () const
QCString *valueRef ()
voidsubstEnvVars () override
voidwriteTemplate (TextStream &t, bool sl, bool) override
voidconvertStrToVal (Config::CompareMode compareMode) override
voidcompareDoxyfile (TextStream &t, Config::CompareMode compareMode) override
voidwriteXMLDoxyfile (TextStream &t) override
voidwriteXSDDoxyfile (TextStream &t) override
voidinit () override
boolisDefault () override

Private Member Attributes Index

std::vector< QCString >m_valueRange
QCStringm_value
QCStringm_defValue

Description

Class representing an enum type option.

Definition at line 156 of file configimpl.h.

Public Constructors

ConfigEnum()

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

Definition at line 159 of file configimpl.h.

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 }

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

Public Member Functions

addValue()

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

Definition at line 167 of file configimpl.h.

167 void addValue(const char *v) { m_valueRange.emplace_back(v); }

Reference m_valueRange.

compareDoxyfile()

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

Declaration at line 173 of file configimpl.h, definition at line 463 of file configimpl.l.

References isDefault, TRUE and writeTemplate.

convertStrToVal()

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

Declaration at line 172 of file configimpl.h, definition at line 259 of file configimpl.l.

260{
261 if (m_value.isEmpty())
262 {
264 return;
265 }
266 if (compareMode == Config::CompareMode::CompressedNoEnv)
267 {
268 if (containsEnvVar(m_value)) return;
269 }
270 QCString val = m_value.stripWhiteSpace().lower();
271 for (const auto &s : m_valueRange)
272 {
273 if (s.lower() == val)
274 {
275 m_value = s;
276 return;
277 }
278 }
279
280 ConfigImpl::config_warn("argument '{}' for option {} is not a valid enum value\n"
281 "Using the default: {}!\n",m_value,m_name,m_defValue);
283}

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

init()

void ConfigEnum::init ()
inline virtual

Definition at line 176 of file configimpl.h.

176 void init() override { m_value = m_defValue; }

References m_defValue and m_value.

isDefault()

bool ConfigEnum::isDefault ()
inline virtual

Definition at line 177 of file configimpl.h.

177 bool isDefault() override { return m_value == m_defValue; }

References m_defValue and m_value.

Referenced by compareDoxyfile and writeXMLDoxyfile.

substEnvVars()

void ConfigEnum::substEnvVars ()
virtual

Declaration at line 170 of file configimpl.h, definition at line 1526 of file configimpl.l.

References m_value and substEnvVarsInString.

valueRef()

QCString * ConfigEnum::valueRef ()
inline

Definition at line 169 of file configimpl.h.

169 QCString *valueRef() { return &m_value; }

Reference m_value.

Referenced by DocPara::handleDoxyConfig and Config::updateObsolete.

values()

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

Definition at line 168 of file configimpl.h.

168 const std::vector<QCString> &values() const { return m_valueRange; }

Reference m_valueRange.

writeTemplate()

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

Declaration at line 171 of file configimpl.h, definition at line 446 of file configimpl.l.

447{
448 if (!sl)
449 {
450 t << "\n";
452 t << "\n";
453 }
454 else if (!m_userComment.isEmpty())
455 {
457 }
458 t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";
460 t << "\n";
461}

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)
virtual

Declaration at line 174 of file configimpl.h, definition at line 468 of file configimpl.l.

469{
470 t << " <option id='" << m_name << "'";
471 t << " default='" << (isDefault() ? "yes" : "no") << "'";
472 t << " type='string'";
473 t << ">";
474 t << "<value>";
476 t << "</value>";
477 t << "</option>\n";
478}

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

writeXSDDoxyfile()

void ConfigEnum::writeXSDDoxyfile (TextStream & t)
virtual

Declaration at line 175 of file configimpl.h, definition at line 480 of file configimpl.l.

481{
482 t << " <xsd:enumeration value=\"" << m_name << "\"/>\n";
483}

Reference ConfigOption::m_name.

Private Member Attributes

m_defValue

QCString ConfigEnum::m_defValue

Definition at line 182 of file configimpl.h.

Referenced by ConfigEnum, convertStrToVal, init and isDefault.

m_value

QCString ConfigEnum::m_value

m_valueRange

std::vector<QCString> ConfigEnum::m_valueRange

Definition at line 180 of file configimpl.h.

180 std::vector<QCString> m_valueRange;

Referenced by addValue, convertStrToVal and values.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.