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

#include <config.h>

Inheritance diagram for ConfigInt:
ConfigOption

Public Member Functions

 ConfigInt (const char *name, const char *doc, int minVal, int maxVal, int defVal)
 
QCStringvalueStringRef ()
 
int * valueRef ()
 
int minVal () const
 
int maxVal () const
 
void convertStrToVal ()
 
void substEnvVars ()
 
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

int m_value
 
int m_defValue
 
int m_minVal
 
int m_maxVal
 
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 an integer type option.

Definition at line 195 of file config.h.

Constructor & Destructor Documentation

ConfigInt::ConfigInt ( const char *  name,
const char *  doc,
int  minVal,
int  maxVal,
int  defVal 
)
inline

Definition at line 198 of file config.h.

200  {
201  m_name = name;
202  m_doc = doc;
203  m_value = defVal;
204  m_defValue = defVal;
205  m_minVal = minVal;
206  m_maxVal = maxVal;
207  }
QCString m_name
Definition: config.h:86
ConfigOption(OptionType t)
Definition: config.h:56
int minVal() const
Definition: config.h:210
int m_value
Definition: config.h:217
int maxVal() const
Definition: config.h:211
int m_defValue
Definition: config.h:218
QCString m_doc
Definition: config.h:87
QCString name() const
Definition: config.h:66
int m_minVal
Definition: config.h:219
int m_maxVal
Definition: config.h:220
QCString doc

Member Function Documentation

void ConfigInt::convertStrToVal ( )
virtual

Reimplemented from ConfigOption.

Definition at line 789 of file config.cpp.

790 {
791  if (!m_valueString.isEmpty())
792  {
793  bool ok;
794  int val = m_valueString.toInt(&ok);
795  if (!ok || val<m_minVal || val>m_maxVal)
796  {
797  config_warn("argument `%s' for option %s is not a valid number in the range [%d..%d]!\n"
798  "Using the default: %d!\n",m_valueString.data(),m_name.data(),m_minVal,m_maxVal,m_value);
799  }
800  else
801  {
802  m_value=val;
803  }
804  }
805 }
QCString m_name
Definition: config.h:86
bool isEmpty() const
Definition: qcstring.h:189
int m_value
Definition: config.h:217
int toInt(bool *ok=0) const
Definition: qcstring.cpp:439
const char * data() const
Definition: qcstring.h:207
int m_minVal
Definition: config.h:219
void config_warn(const char *fmt,...)
Definition: config.cpp:676
int m_maxVal
Definition: config.h:220
QCString m_valueString
Definition: config.h:221
void ConfigInt::init ( )
inlinevirtual

Reimplemented from ConfigOption.

Definition at line 215 of file config.h.

215 { m_value = m_defValue; }
int m_value
Definition: config.h:217
int m_defValue
Definition: config.h:218
int ConfigInt::maxVal ( ) const
inline

Definition at line 211 of file config.h.

211 { return m_maxVal; }
int m_maxVal
Definition: config.h:220
int ConfigInt::minVal ( ) const
inline

Definition at line 210 of file config.h.

210 { return m_minVal; }
int m_minVal
Definition: config.h:219
void ConfigInt::substEnvVars ( )
virtual

Implements ConfigOption.

Definition at line 3017 of file config.cpp.

3018 {
3020 }
static void substEnvVarsInString(QCString &s)
Definition: config.cpp:2897
QCString m_valueString
Definition: config.h:221
int* ConfigInt::valueRef ( )
inline

Definition at line 209 of file config.h.

209 { return &m_value; }
int m_value
Definition: config.h:217
QCString* ConfigInt::valueStringRef ( )
inline

Definition at line 208 of file config.h.

208 { return &m_valueString; }
QCString m_valueString
Definition: config.h:221
void ConfigInt::writeTemplate ( FTextStream t,
bool  sl,
bool  upd 
)
virtual

Implements ConfigOption.

Definition at line 972 of file config.cpp.

973 {
974  if (!sl)
975  {
976  t << endl;
978  t << endl;
979  }
980  else if (!m_userComment.isEmpty())
981  {
983  }
985  if (upd && !m_valueString.isEmpty())
986  {
988  }
989  else
990  {
992  }
993  t << "\n";
994 }
QCString m_spaces
Definition: config.h:85
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
int m_value
Definition: config.h:217
void writeIntValue(FTextStream &t, int i)
Definition: config.cpp:732
QCString m_doc
Definition: config.h:87
QTextStream & endl(QTextStream &s)
QCString m_valueString
Definition: config.h:221

Member Data Documentation

int ConfigInt::m_defValue
private

Definition at line 218 of file config.h.

int ConfigInt::m_maxVal
private

Definition at line 220 of file config.h.

int ConfigInt::m_minVal
private

Definition at line 219 of file config.h.

int ConfigInt::m_value
private

Definition at line 217 of file config.h.

QCString ConfigInt::m_valueString
private

Definition at line 221 of file config.h.


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