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 156 of file configimpl.h.

Constructor & Destructor Documentation

◆ ConfigEnum()

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

Definition at line 159 of file configimpl.h.

161 {
162 m_name = name;
163 m_doc = doc;
164 m_value = defVal;
165 m_defValue = defVal;
166 }
QCString m_defValue
Definition configimpl.h:182
QCString m_value
Definition configimpl.h:181
QCString m_doc
Definition configimpl.h:97
ConfigOption(OptionType t)
Definition configimpl.h:64
QCString m_name
Definition configimpl.h:96
QCString name() const
Definition configimpl.h:71
@ O_Enum
A fixed set of items.
Definition configimpl.h:50

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 167 of file configimpl.h.

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

References m_valueRange.

◆ compareDoxyfile()

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

Implements ConfigOption.

Definition at line 463 of file configimpl.l.

464{
465 if (!isDefault()) writeTemplate(t,TRUE,TRUE);
466}
void writeTemplate(TextStream &t, bool sl, bool) override
Definition configimpl.l:446
bool isDefault() override
Definition configimpl.h:177
#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 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}
static void config_warn(fmt::format_string< Args... > fmt, Args &&... args)
Definition configimpl.h:627
static bool containsEnvVar(QCString &str)

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

◆ init()

void ConfigEnum::init ( )
inlineoverridevirtual

Reimplemented from ConfigOption.

Definition at line 176 of file configimpl.h.

176{ m_value = m_defValue; }

References m_defValue, and m_value.

◆ isDefault()

bool ConfigEnum::isDefault ( )
inlineoverridevirtual

Reimplemented from ConfigOption.

Definition at line 177 of file configimpl.h.

177{ 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 1526 of file configimpl.l.

1527{
1529}
static void substEnvVarsInString(QCString &s)

References m_value, and substEnvVarsInString().

◆ valueRef()

QCString * ConfigEnum::valueRef ( )
inline

Definition at line 169 of file configimpl.h.

169{ 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 168 of file configimpl.h.

168{ return m_valueRange; }

References m_valueRange.

◆ writeTemplate()

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

Implements ConfigOption.

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}
void writeStringValue(TextStream &t, const QCString &s, bool initSpace=true, bool wasQuoted=false)
Definition configimpl.l:139
QCString m_userComment
Definition configimpl.h:100
QCString m_spaces
Definition configimpl.h:95
static QCString convertToComment(const QCString &s, const QCString &u)
Definition configimpl.l:88

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 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>";
475 writeStringValue(t,m_value,false);
476 t << "</value>";
477 t << "</option>\n";
478}

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

◆ writeXSDDoxyfile()

void ConfigEnum::writeXSDDoxyfile ( TextStream & t)
overridevirtual

Implements ConfigOption.

Definition at line 480 of file configimpl.l.

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

References ConfigOption::m_name.

Member Data Documentation

◆ m_defValue

QCString ConfigEnum::m_defValue
private

Definition at line 182 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 180 of file configimpl.h.

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


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