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

Class representing an integer type option. More...

#include <src/configimpl.h>

+ Inheritance diagram for ConfigInt:
+ Collaboration diagram for ConfigInt:

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 (Config::CompareMode compareMode) override
 
void substEnvVars () override
 
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

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
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 integer type option.

Definition at line 218 of file configimpl.h.

Constructor & Destructor Documentation

◆ ConfigInt()

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

Definition at line 221 of file configimpl.h.

223 {
224 m_name = name;
225 m_doc = doc;
226 m_value = defVal;
227 m_defValue = defVal;
230 }
int maxVal() const
Definition configimpl.h:234
int m_defValue
Definition configimpl.h:245
int minVal() const
Definition configimpl.h:233
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_Int
An integer value.
Definition configimpl.h:51

References ConfigOption::ConfigOption(), m_defValue, ConfigOption::m_doc, m_maxVal, m_minVal, ConfigOption::m_name, m_value, maxVal(), minVal(), ConfigOption::name(), and ConfigOption::O_Int.

Member Function Documentation

◆ compareDoxyfile()

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

Implements ConfigOption.

Definition at line 560 of file configimpl.l.

561{
563}
bool isDefault() override
Definition configimpl.h:242
QCString m_valueString
Definition configimpl.h:248
void writeTemplate(TextStream &t, bool sl, bool upd) override
Definition configimpl.l:536
static bool containsEnvVar(QCString &str)
#define TRUE
Definition qcstring.h:37

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

◆ convertStrToVal()

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

Reimplemented from ConfigOption.

Definition at line 205 of file configimpl.l.

206{
207 if (!m_valueString.isEmpty())
208 {
209 if (compareMode == Config::CompareMode::CompressedNoEnv)
210 {
211 if (containsEnvVar(m_valueString)) return;
212 }
213 bool ok = false;
214 int val = m_valueString.toInt(&ok);
215 if (!ok || val<m_minVal || val>m_maxVal)
216 {
217 ConfigImpl::config_warn("argument '%s' for option %s is not a valid number in the range [%d..%d]!\n"
218 "Using the default: %d!\n",qPrint(m_valueString),qPrint(m_name),m_minVal,m_maxVal,m_value);
219 }
220 else
221 {
222 m_value=val;
223 }
224 }
225}
static void config_warn(const char *fmt,...)
Definition configimpl.l:78
const char * qPrint(const char *s)
Definition qcstring.h:672

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

◆ init()

void ConfigInt::init ( )
inlineoverridevirtual

Reimplemented from ConfigOption.

Definition at line 241 of file configimpl.h.

241{ m_value = m_defValue; }

References m_defValue, and m_value.

◆ isDefault()

bool ConfigInt::isDefault ( )
inlineoverridevirtual

Reimplemented from ConfigOption.

Definition at line 242 of file configimpl.h.

242{ return m_value == m_defValue; }

References m_defValue, and m_value.

Referenced by compareDoxyfile(), and writeXMLDoxyfile().

◆ maxVal()

int ConfigInt::maxVal ( ) const
inline

Definition at line 234 of file configimpl.h.

234{ return m_maxVal; }

References m_maxVal.

Referenced by ConfigInt().

◆ minVal()

int ConfigInt::minVal ( ) const
inline

Definition at line 233 of file configimpl.h.

233{ return m_minVal; }

References m_minVal.

Referenced by ConfigInt().

◆ substEnvVars()

void ConfigInt::substEnvVars ( )
overridevirtual

Implements ConfigOption.

Definition at line 1529 of file configimpl.l.

1530{
1532}
static void substEnvVarsInString(QCString &s)

References m_valueString, and substEnvVarsInString().

◆ valueRef()

int * ConfigInt::valueRef ( )
inline

Definition at line 232 of file configimpl.h.

232{ return &m_value; }

References m_value.

◆ valueStringRef()

QCString * ConfigInt::valueStringRef ( )
inline

Definition at line 231 of file configimpl.h.

231{ return &m_valueString; }

References m_valueString.

Referenced by DocPara::handleDoxyConfig().

◆ writeTemplate()

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

Implements ConfigOption.

Definition at line 536 of file configimpl.l.

537{
538 if (!sl)
539 {
540 t << "\n";
542 t << "\n";
543 }
544 else if (!m_userComment.isEmpty())
545 {
547 }
548 t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";
549 if (upd && !m_valueString.isEmpty())
550 {
552 }
553 else
554 {
556 }
557 t << "\n";
558}
void writeStringValue(TextStream &t, const QCString &s, bool initSpace=true, bool wasQuoted=false)
Definition configimpl.l:149
QCString m_userComment
Definition configimpl.h:99
void writeIntValue(TextStream &t, int i, bool initSpace=true)
Definition configimpl.l:143
QCString m_spaces
Definition configimpl.h:94
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::writeIntValue(), and ConfigOption::writeStringValue().

Referenced by compareDoxyfile().

◆ writeXMLDoxyfile()

void ConfigInt::writeXMLDoxyfile ( TextStream & t)
overridevirtual

Implements ConfigOption.

Definition at line 565 of file configimpl.l.

566{
567 t << " <option id='" << m_name << "'";
568 t << " default='" << (isDefault() ? "yes" : "no") << "'";
569 t << " type='int'";
570 t << ">";
571 t << "<value>";
572 writeIntValue(t,m_value,false);
573 t << "</value>";
574 t << "</option>\n";
575}

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

◆ writeXSDDoxyfile()

void ConfigInt::writeXSDDoxyfile ( TextStream & t)
overridevirtual

Implements ConfigOption.

Definition at line 577 of file configimpl.l.

578{
579 t << " <xsd:enumeration value=\"" << m_name << "\"/>\n";
580}

References ConfigOption::m_name.

Member Data Documentation

◆ m_defValue

int ConfigInt::m_defValue
private

Definition at line 245 of file configimpl.h.

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

◆ m_maxVal

int ConfigInt::m_maxVal
private

Definition at line 247 of file configimpl.h.

Referenced by ConfigInt(), convertStrToVal(), and maxVal().

◆ m_minVal

int ConfigInt::m_minVal
private

Definition at line 246 of file configimpl.h.

Referenced by ConfigInt(), convertStrToVal(), and minVal().

◆ m_value

int ConfigInt::m_value
private

◆ m_valueString

QCString ConfigInt::m_valueString
private

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