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

224 {
225 m_name = name;
226 m_doc = doc;
227 m_value = defVal;
228 m_defValue = defVal;
231 }
int maxVal() const
Definition configimpl.h:235
int m_defValue
Definition configimpl.h:246
int minVal() const
Definition configimpl.h:234
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_Int
An integer value.
Definition configimpl.h:52

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

551{
553}
bool isDefault() override
Definition configimpl.h:243
QCString m_valueString
Definition configimpl.h:249
void writeTemplate(TextStream &t, bool sl, bool upd) override
Definition configimpl.l:526
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 195 of file configimpl.l.

196{
197 if (!m_valueString.isEmpty())
198 {
199 if (compareMode == Config::CompareMode::CompressedNoEnv)
200 {
201 if (containsEnvVar(m_valueString)) return;
202 }
203 bool ok = false;
204 int val = m_valueString.toInt(&ok);
205 if (!ok || val<m_minVal || val>m_maxVal)
206 {
207 ConfigImpl::config_warn("argument '{}' for option {} is not a valid number in the range [{}..{}]!\n"
208 "Using the default: {}!\n",m_valueString,m_name,m_minVal,m_maxVal,m_value);
209 }
210 else
211 {
212 m_value=val;
213 }
214 }
215}
static void config_warn(fmt::format_string< Args... > fmt, Args &&... args)
Definition configimpl.h:627

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

◆ init()

void ConfigInt::init ( )
inlineoverridevirtual

Reimplemented from ConfigOption.

Definition at line 242 of file configimpl.h.

242{ m_value = m_defValue; }

References m_defValue, and m_value.

◆ isDefault()

bool ConfigInt::isDefault ( )
inlineoverridevirtual

Reimplemented from ConfigOption.

Definition at line 243 of file configimpl.h.

243{ 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 235 of file configimpl.h.

235{ return m_maxVal; }

References m_maxVal.

Referenced by ConfigInt().

◆ minVal()

int ConfigInt::minVal ( ) const
inline

Definition at line 234 of file configimpl.h.

234{ return m_minVal; }

References m_minVal.

Referenced by ConfigInt().

◆ substEnvVars()

void ConfigInt::substEnvVars ( )
overridevirtual

Implements ConfigOption.

Definition at line 1521 of file configimpl.l.

1522{
1524}
static void substEnvVarsInString(QCString &s)

References m_valueString, and substEnvVarsInString().

◆ valueRef()

int * ConfigInt::valueRef ( )
inline

Definition at line 233 of file configimpl.h.

233{ return &m_value; }

References m_value.

◆ valueStringRef()

QCString * ConfigInt::valueStringRef ( )
inline

Definition at line 232 of file configimpl.h.

232{ 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 526 of file configimpl.l.

527{
528 if (!sl)
529 {
530 t << "\n";
532 t << "\n";
533 }
534 else if (!m_userComment.isEmpty())
535 {
537 }
538 t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";
539 if (upd && !m_valueString.isEmpty())
540 {
542 }
543 else
544 {
546 }
547 t << "\n";
548}
void writeStringValue(TextStream &t, const QCString &s, bool initSpace=true, bool wasQuoted=false)
Definition configimpl.l:139
QCString m_userComment
Definition configimpl.h:100
void writeIntValue(TextStream &t, int i, bool initSpace=true)
Definition configimpl.l:133
QCString m_spaces
Definition configimpl.h:95
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::writeIntValue(), and ConfigOption::writeStringValue().

Referenced by compareDoxyfile().

◆ writeXMLDoxyfile()

void ConfigInt::writeXMLDoxyfile ( TextStream & t)
overridevirtual

Implements ConfigOption.

Definition at line 555 of file configimpl.l.

556{
557 t << " <option id='" << m_name << "'";
558 t << " default='" << (isDefault() ? "yes" : "no") << "'";
559 t << " type='int'";
560 t << ">";
561 t << "<value>";
562 writeIntValue(t,m_value,false);
563 t << "</value>";
564 t << "</option>\n";
565}

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

◆ writeXSDDoxyfile()

void ConfigInt::writeXSDDoxyfile ( TextStream & t)
overridevirtual

Implements ConfigOption.

Definition at line 567 of file configimpl.l.

568{
569 t << " <xsd:enumeration value=\"" << m_name << "\"/>\n";
570}

References ConfigOption::m_name.

Member Data Documentation

◆ m_defValue

int ConfigInt::m_defValue
private

Definition at line 246 of file configimpl.h.

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

◆ m_maxVal

int ConfigInt::m_maxVal
private

Definition at line 248 of file configimpl.h.

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

◆ m_minVal

int ConfigInt::m_minVal
private

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