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

Class representing a Boolean type option. More...

#include <src/configimpl.h>

Inheritance diagram for ConfigBool:
Collaboration diagram for ConfigBool:

Public Member Functions

 ConfigBool (const char *name, const char *doc, bool defVal)
 
QCStringvalueStringRef ()
 
bool * valueRef ()
 
void convertStrToVal (Config::CompareMode compareMode) override
 
void substEnvVars () override
 
void setValueString (const QCString &v)
 
void writeTemplate (TextStream &t, bool sl, bool upd) 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

bool m_value
 
bool m_defValue
 
QCString m_valueString
 

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 a Boolean type option.

Definition at line 254 of file configimpl.h.

Constructor & Destructor Documentation

◆ ConfigBool()

ConfigBool::ConfigBool ( const char * name,
const char * doc,
bool defVal )
inline

Definition at line 257 of file configimpl.h.

259 {
260 m_name = name;
261 m_doc = doc;
262 m_value = defVal;
263 m_defValue = defVal;
264 }
bool m_defValue
Definition configimpl.h:278
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_Bool
A boolean value.
Definition configimpl.h:53

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

Member Function Documentation

◆ compareDoxyfile()

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

Implements ConfigOption.

Definition at line 597 of file configimpl.l.

598{
600}
void writeTemplate(TextStream &t, bool sl, bool upd) override
Definition configimpl.l:572
bool isDefault() override
Definition configimpl.h:275
QCString m_valueString
Definition configimpl.h:279
static bool containsEnvVar(QCString &str)
#define TRUE
Definition qcstring.h:37

References Config::CompressedNoEnv, containsEnvVar(), isDefault(), m_valueString, TRUE, and writeTemplate().

◆ convertStrToVal()

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

Reimplemented from ConfigOption.

Definition at line 237 of file configimpl.l.

238{
239 if (!m_valueString.stripWhiteSpace().isEmpty())
240 {
241 if (compareMode == Config::CompareMode::CompressedNoEnv)
242 {
243 if (containsEnvVar(m_valueString)) return;
244 }
245 bool isValid=false;
246 bool b = convertStringToBool(m_valueString,isValid);
247 if (isValid)
248 {
249 m_value=b;
250 }
251 else
252 {
253 ConfigImpl::config_warn("argument '{}' for option {} is not a valid boolean value\n"
254 "Using the default: {}!\n",m_valueString,m_name,m_value?"YES":"NO");
255 }
256 }
257}
static void config_warn(fmt::format_string< Args... > fmt, Args &&... args)
Definition configimpl.h:627
static bool convertStringToBool(const QCString &str, bool &isValid)
Definition configimpl.l:217

References Config::CompressedNoEnv, ConfigImpl::config_warn(), containsEnvVar(), convertStringToBool(), ConfigOption::m_name, m_value, and m_valueString.

◆ init()

void ConfigBool::init ( )
inlineoverridevirtual

Reimplemented from ConfigOption.

Definition at line 274 of file configimpl.h.

274{ m_value = m_defValue; }

References m_defValue, and m_value.

◆ isDefault()

bool ConfigBool::isDefault ( )
inlineoverridevirtual

Reimplemented from ConfigOption.

Definition at line 275 of file configimpl.h.

275{ return m_value == m_defValue; }

References m_defValue, and m_value.

Referenced by compareDoxyfile(), and writeXMLDoxyfile().

◆ setValueString()

void ConfigBool::setValueString ( const QCString & v)
inline

Definition at line 269 of file configimpl.h.

269{ m_valueString = v; }

References m_valueString.

◆ substEnvVars()

void ConfigBool::substEnvVars ( )
overridevirtual

Implements ConfigOption.

Definition at line 1516 of file configimpl.l.

1517{
1519}
static void substEnvVarsInString(QCString &s)

References m_valueString, and substEnvVarsInString().

◆ valueRef()

bool * ConfigBool::valueRef ( )
inline

Definition at line 266 of file configimpl.h.

266{ return &m_value; }

References m_value.

◆ valueStringRef()

QCString * ConfigBool::valueStringRef ( )
inline

Definition at line 265 of file configimpl.h.

265{ return &m_valueString; }

References m_valueString.

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

◆ writeTemplate()

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

Implements ConfigOption.

Definition at line 572 of file configimpl.l.

573{
574 if (!sl)
575 {
576 t << "\n";
578 t << "\n";
579 }
580 else if (!m_userComment.isEmpty())
581 {
583 }
584 QCString spaces = m_spaces.left(MAX_OPTION_LENGTH-m_name.length());
585 t << m_name << spaces << "=";
586 if (upd && !m_valueString.isEmpty())
587 {
589 }
590 else
591 {
593 }
594 t << "\n";
595}
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
void writeBoolValue(TextStream &t, bool v, bool initSpace=true)
Definition configimpl.l:127
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, m_valueString, ConfigOption::MAX_OPTION_LENGTH, ConfigOption::writeBoolValue(), and ConfigOption::writeStringValue().

Referenced by compareDoxyfile().

◆ writeXMLDoxyfile()

void ConfigBool::writeXMLDoxyfile ( TextStream & t)
overridevirtual

Implements ConfigOption.

Definition at line 602 of file configimpl.l.

603{
604 t << " <option id='" << m_name << "'";
605 t << " default='" << (isDefault() ? "yes" : "no") << "'";
606 t << " type='bool'";
607 t << ">";
608 t << "<value>";
609 writeBoolValue(t,m_value,false);
610 t << "</value>";
611 t << "</option>\n";
612}

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

◆ writeXSDDoxyfile()

void ConfigBool::writeXSDDoxyfile ( TextStream & t)
overridevirtual

Implements ConfigOption.

Definition at line 614 of file configimpl.l.

615{
616 t << " <xsd:enumeration value=\"" << m_name << "\"/>\n";
617}

References ConfigOption::m_name.

Member Data Documentation

◆ m_defValue

bool ConfigBool::m_defValue
private

Definition at line 278 of file configimpl.h.

Referenced by ConfigBool(), init(), and isDefault().

◆ m_value

bool ConfigBool::m_value
private

◆ m_valueString

QCString ConfigBool::m_valueString
private

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