Public Member Functions | Private Attributes | List of all members
ConfigBool Class Reference

#include <config.h>

Inheritance diagram for ConfigBool:
ConfigOption

Public Member Functions

 ConfigBool (const char *name, const char *doc, bool defVal)
 
QCStringvalueStringRef ()
 
boolvalueRef ()
 
void convertStrToVal ()
 
void substEnvVars ()
 
void setValueString (const QCString &v)
 
void writeTemplate (FTextStream &t, bool sl, bool upd)
 
void init ()
 
- Public Member Functions inherited from ConfigOption
 ConfigOption (OptionType t)
 
virtual ~ConfigOption ()
 
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
void writeBoolValue (FTextStream &t, bool v)
 
void writeIntValue (FTextStream &t, int i)
 
void writeStringValue (FTextStream &t, QCString &s)
 
void writeStringList (FTextStream &t, QStrList &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 226 of file config.h.

Constructor & Destructor Documentation

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

Definition at line 229 of file config.h.

231  {
232  m_name = name;
233  m_doc = doc;
234  m_value = defVal;
235  m_defValue = defVal;
236  }
QCString m_name
Definition: config.h:86
bool m_defValue
Definition: config.h:246
ConfigOption(OptionType t)
Definition: config.h:56
bool m_value
Definition: config.h:245
QCString m_doc
Definition: config.h:87
QCString name() const
Definition: config.h:66
QCString doc

Member Function Documentation

void ConfigBool::convertStrToVal ( )
virtual

Reimplemented from ConfigOption.

Definition at line 807 of file config.cpp.

808 {
810  if (!val.isEmpty())
811  {
812  if (val=="yes" || val=="true" || val=="1" || val=="all")
813  {
814  m_value=TRUE;
815  }
816  else if (val=="no" || val=="false" || val=="0" || val=="none")
817  {
818  m_value=FALSE;
819  }
820  else
821  {
822  config_warn("argument `%s' for option %s is not a valid boolean value\n"
823  "Using the default: %s!\n",m_valueString.data(),m_name.data(),m_value?"YES":"NO");
824  }
825  }
826 }
QCString m_valueString
Definition: config.h:247
QCString stripWhiteSpace() const
Definition: qcstring.cpp:295
QCString m_name
Definition: config.h:86
bool isEmpty() const
Definition: qcstring.h:189
const bool FALSE
Definition: qglobal.h:370
bool m_value
Definition: config.h:245
const char * data() const
Definition: qcstring.h:207
void config_warn(const char *fmt,...)
Definition: config.cpp:676
QCString lower() const
Definition: qcstring.cpp:263
const bool TRUE
Definition: qglobal.h:371
void ConfigBool::init ( )
inlinevirtual

Reimplemented from ConfigOption.

Definition at line 243 of file config.h.

243 { m_value = m_defValue; }
bool m_defValue
Definition: config.h:246
bool m_value
Definition: config.h:245
void ConfigBool::setValueString ( const QCString v)
inline

Definition at line 241 of file config.h.

241 { m_valueString = v; }
QCString m_valueString
Definition: config.h:247
void ConfigBool::substEnvVars ( )
virtual

Implements ConfigOption.

Definition at line 3012 of file config.cpp.

3013 {
3015 }
QCString m_valueString
Definition: config.h:247
static void substEnvVarsInString(QCString &s)
Definition: config.cpp:2897
bool* ConfigBool::valueRef ( )
inline

Definition at line 238 of file config.h.

238 { return &m_value; }
bool m_value
Definition: config.h:245
QCString* ConfigBool::valueStringRef ( )
inline

Definition at line 237 of file config.h.

237 { return &m_valueString; }
QCString m_valueString
Definition: config.h:247
void ConfigBool::writeTemplate ( FTextStream t,
bool  sl,
bool  upd 
)
virtual

Implements ConfigOption.

Definition at line 996 of file config.cpp.

997 {
998  if (!sl)
999  {
1000  t << endl;
1002  t << endl;
1003  }
1004  else if (!m_userComment.isEmpty())
1005  {
1006  t << convertToComment("", m_userComment);
1007  }
1008  t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";
1009  if (upd && !m_valueString.isEmpty())
1010  {
1012  }
1013  else
1014  {
1016  }
1017  t << "\n";
1018 }
QCString m_valueString
Definition: config.h:247
QCString m_spaces
Definition: config.h:85
void writeBoolValue(FTextStream &t, bool v)
Definition: config.cpp:726
QCString m_name
Definition: config.h:86
bool isEmpty() const
Definition: qcstring.h:189
QCString m_userComment
Definition: config.h:90
static QCString convertToComment(const QCString &s, const QCString &u)
Definition: config.cpp:694
uint length() const
Definition: qcstring.h:195
void writeStringValue(FTextStream &t, QCString &s)
Definition: config.cpp:737
QCString left(uint len) const
Definition: qcstring.cpp:213
bool m_value
Definition: config.h:245
QCString m_doc
Definition: config.h:87
QTextStream & endl(QTextStream &s)

Member Data Documentation

bool ConfigBool::m_defValue
private

Definition at line 246 of file config.h.

bool ConfigBool::m_value
private

Definition at line 245 of file config.h.

QCString ConfigBool::m_valueString
private

Definition at line 247 of file config.h.


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