Skip to main content

The ConfigList Class Reference

Class representing a list type option. More...

Declaration

class ConfigList { ... }

Included Headers

#include <src/configimpl.h>

Base class

classConfigOption

Abstract base class for any configuration option. More...

Enumerations Index

enumWidgetType { ... }

Public Constructors Index

ConfigList (const char *name, const char *doc)

Public Member Functions Index

voidaddValue (const char *v)
voidsetWidgetType (WidgetType w)
WidgetTypewidgetType () const
StringVector *valueRef ()
StringVectorgetDefault ()
voidemptyValueToDefault () override
voidwriteTemplate (TextStream &t, bool sl, bool) override
voidcompareDoxyfile (TextStream &t, Config::CompareMode compareMode) override
voidwriteXMLDoxyfile (TextStream &t) override
voidwriteXSDDoxyfile (TextStream &t) override
voidsubstEnvVars () override
voidinit () override
boolisDefault () override

Private Member Attributes Index

StringVectorm_value
StringVectorm_defaultValue
WidgetTypem_widgetType

Description

Class representing a list type option.

Definition at line 124 of file configimpl.h.

Enumerations

WidgetType

enum ConfigList::WidgetType
Enumeration values
String
File
Dir
FileAndDir

Definition at line 127 of file configimpl.h.

Public Constructors

ConfigList()

ConfigList::ConfigList (const char * name, const char * doc)
inline

Definition at line 128 of file configimpl.h.

128 ConfigList(const char *name,const char *doc)
130 {
131 m_name = name;
132 m_doc = doc;
134 }

References ConfigOption::ConfigOption, ConfigOption::m_doc, ConfigOption::m_name, m_widgetType, ConfigOption::name, ConfigOption::O_List and String.

Public Member Functions

addValue()

void ConfigList::addValue (const char * v)
inline

Definition at line 135 of file configimpl.h.

135 void addValue(const char *v) { m_defaultValue.emplace_back(v); }

Reference m_defaultValue.

compareDoxyfile()

void ConfigList::compareDoxyfile (TextStream & t, Config::CompareMode compareMode)
virtual

Declaration at line 142 of file configimpl.h, definition at line 417 of file configimpl.l.

References isDefault, TRUE and writeTemplate.

emptyValueToDefault()

void ConfigList::emptyValueToDefault ()
inline virtual

Definition at line 140 of file configimpl.h.

140 void emptyValueToDefault() override { if (m_value.empty() && !m_defaultValue.empty()) m_value=m_defaultValue; };

References m_defaultValue and m_value.

getDefault()

StringVector ConfigList::getDefault ()
inline

Definition at line 139 of file configimpl.h.

Reference m_defaultValue.

init()

void ConfigList::init ()
inline virtual

Definition at line 146 of file configimpl.h.

146 void init() override { m_value = m_defaultValue; }

References m_defaultValue and m_value.

isDefault()

bool ConfigList::isDefault ()
virtual

Declaration at line 147 of file configimpl.h, definition at line 385 of file configimpl.l.

386{
387 auto get_stripped = [](const std::string &s) { return QCString(s.c_str()).stripWhiteSpace(); };
388 auto is_not_empty = [get_stripped](const std::string &s) { return !get_stripped(s).isEmpty(); };
389 size_t defCnt = std::count_if( m_value.begin(), m_value.end(),is_not_empty);
390 size_t valCnt = std::count_if(m_defaultValue.begin(),m_defaultValue.end(),is_not_empty);
391 if ( valCnt != defCnt)
392 {
393 return false;
394 }
395 auto it1 = m_value.begin();
396 auto it2 = m_defaultValue.begin();
397 while (it1!=m_value.end() && it2!=m_defaultValue.end())
398 {
399 // skip over empty values
400 while (it1!=m_value.end() && !is_not_empty(*it1))
401 {
402 ++it1;
403 }
404 if (it1!=m_value.end()) // non-empty value
405 {
406 if (get_stripped(*it1) != get_stripped(*it2)) // not the default, write as difference
407 {
408 return false;
409 }
410 ++it1;
411 ++it2;
412 }
413 }
414 return true;
415}

References m_defaultValue, m_value and QCString::stripWhiteSpace.

Referenced by compareDoxyfile and writeXMLDoxyfile.

setWidgetType()

void ConfigList::setWidgetType (WidgetType w)
inline

Definition at line 136 of file configimpl.h.

Reference m_widgetType.

substEnvVars()

void ConfigList::substEnvVars ()
virtual

Declaration at line 145 of file configimpl.h, definition at line 1511 of file configimpl.l.

References m_value and substEnvVarsInStrList.

valueRef()

StringVector * ConfigList::valueRef ()
inline

Definition at line 138 of file configimpl.h.

Reference m_value.

widgetType()

WidgetType ConfigList::widgetType ()
inline

Definition at line 137 of file configimpl.h.

Reference m_widgetType.

writeTemplate()

void ConfigList::writeTemplate (TextStream & t, bool sl, bool)
virtual

Declaration at line 141 of file configimpl.h, definition at line 368 of file configimpl.l.

369{
370 if (!sl)
371 {
372 t << "\n";
374 t << "\n";
375 }
376 else if (!m_userComment.isEmpty())
377 {
379 }
380 t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";
382 t << "\n";
383}

References convertToComment, ConfigOption::m_doc, ConfigOption::m_name, ConfigOption::m_spaces, ConfigOption::m_userComment, m_value, ConfigOption::MAX_OPTION_LENGTH and ConfigOption::writeStringList.

Referenced by compareDoxyfile.

writeXMLDoxyfile()

void ConfigList::writeXMLDoxyfile (TextStream & t)
virtual

Declaration at line 143 of file configimpl.h, definition at line 422 of file configimpl.l.

423{
424 t << " <option id='" << m_name << "'";
425 t << " default='" << (isDefault() ? "yes" : "no") << "'";
426 t << " type='stringlist'";
427 t << ">";
428 t << "\n";
429 for (const auto &p : m_value)
430 {
431 QCString s=p.c_str();
432 t << " <value>";
433 t << "<![CDATA[";
434 writeStringValue(t,s,false);
435 t << "]]>";
436 t << "</value>\n";
437 }
438 t << " </option>\n";
439}

References isDefault, ConfigOption::m_name, m_value and ConfigOption::writeStringValue.

writeXSDDoxyfile()

void ConfigList::writeXSDDoxyfile (TextStream & t)
virtual

Declaration at line 144 of file configimpl.h, definition at line 441 of file configimpl.l.

442{
443 t << " <xsd:enumeration value=\"" << m_name << "\"/>\n";
444}

Reference ConfigOption::m_name.

Private Member Attributes

m_defaultValue

StringVector ConfigList::m_defaultValue

Definition at line 150 of file configimpl.h.

Referenced by addValue, emptyValueToDefault, getDefault, init and isDefault.

m_value

StringVector ConfigList::m_value

m_widgetType

WidgetType ConfigList::m_widgetType

Definition at line 151 of file configimpl.h.

Referenced by ConfigList, setWidgetType and widgetType.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.