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

Constructor & Destructor Documentation

◆ ConfigBool()

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

Definition at line 256 of file configimpl.h.

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

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 607 of file configimpl.l.

608{
610}
void writeTemplate(TextStream &t, bool sl, bool upd) override
Definition configimpl.l:582
bool isDefault() override
Definition configimpl.h:274
QCString m_valueString
Definition configimpl.h:278
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 247 of file configimpl.l.

248{
249 if (!m_valueString.stripWhiteSpace().isEmpty())
250 {
251 if (compareMode == Config::CompareMode::CompressedNoEnv)
252 {
253 if (containsEnvVar(m_valueString)) return;
254 }
255 bool isValid=false;
256 bool b = convertStringToBool(m_valueString,isValid);
257 if (isValid)
258 {
259 m_value=b;
260 }
261 else
262 {
263 ConfigImpl::config_warn("argument '%s' for option %s is not a valid boolean value\n"
264 "Using the default: %s!\n",qPrint(m_valueString),qPrint(m_name),m_value?"YES":"NO");
265 }
266 }
267}
static void config_warn(const char *fmt,...)
Definition configimpl.l:78
static bool convertStringToBool(const QCString &str, bool &isValid)
Definition configimpl.l:227
const char * qPrint(const char *s)
Definition qcstring.h:672

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

◆ init()

void ConfigBool::init ( )
inlineoverridevirtual

Reimplemented from ConfigOption.

Definition at line 273 of file configimpl.h.

273{ m_value = m_defValue; }

References m_defValue, and m_value.

◆ isDefault()

bool ConfigBool::isDefault ( )
inlineoverridevirtual

Reimplemented from ConfigOption.

Definition at line 274 of file configimpl.h.

274{ 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 268 of file configimpl.h.

268{ m_valueString = v; }

References m_valueString.

◆ substEnvVars()

void ConfigBool::substEnvVars ( )
overridevirtual

Implements ConfigOption.

Definition at line 1524 of file configimpl.l.

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

References m_valueString, and substEnvVarsInString().

◆ valueRef()

bool * ConfigBool::valueRef ( )
inline

Definition at line 265 of file configimpl.h.

265{ return &m_value; }

References m_value.

◆ valueStringRef()

QCString * ConfigBool::valueStringRef ( )
inline

Definition at line 264 of file configimpl.h.

264{ 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 582 of file configimpl.l.

583{
584 if (!sl)
585 {
586 t << "\n";
588 t << "\n";
589 }
590 else if (!m_userComment.isEmpty())
591 {
593 }
594 QCString spaces = m_spaces.left(MAX_OPTION_LENGTH-m_name.length());
595 t << m_name << spaces << "=";
596 if (upd && !m_valueString.isEmpty())
597 {
599 }
600 else
601 {
603 }
604 t << "\n";
605}
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
void writeBoolValue(TextStream &t, bool v, bool initSpace=true)
Definition configimpl.l:137
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, 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 612 of file configimpl.l.

613{
614 t << " <option id='" << m_name << "'";
615 t << " default='" << (isDefault() ? "yes" : "no") << "'";
616 t << " type='bool'";
617 t << ">";
618 t << "<value>";
619 writeBoolValue(t,m_value,false);
620 t << "</value>";
621 t << "</option>\n";
622}

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

◆ writeXSDDoxyfile()

void ConfigBool::writeXSDDoxyfile ( TextStream & t)
overridevirtual

Implements ConfigOption.

Definition at line 624 of file configimpl.l.

625{
626 t << " <xsd:enumeration value=\"" << m_name << "\"/>\n";
627}

References ConfigOption::m_name.

Member Data Documentation

◆ m_defValue

bool ConfigBool::m_defValue
private

Definition at line 277 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: