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

Class representing a list type option. More...

#include <src/configimpl.h>

+ Inheritance diagram for ConfigList:
+ Collaboration diagram for ConfigList:

Public Types

enum  WidgetType { String , File , Dir , FileAndDir }
 
- 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 }
 

Public Member Functions

 ConfigList (const char *name, const char *doc)
 
void addValue (const char *v)
 
void setWidgetType (WidgetType w)
 
WidgetType widgetType () const
 
StringVectorvalueRef ()
 
StringVector getDefault ()
 
void emptyValueToDefault () override
 
void writeTemplate (TextStream &t, bool sl, bool) override
 
void compareDoxyfile (TextStream &t, Config::CompareMode compareMode) override
 
void writeXMLDoxyfile (TextStream &t) override
 
void writeXSDDoxyfile (TextStream &t) override
 
void substEnvVars () 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

StringVector m_value
 
StringVector m_defaultValue
 
WidgetType m_widgetType
 

Additional Inherited Members

- Protected Member Functions inherited from ConfigOption
virtual void convertStrToVal (Config::CompareMode)
 
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 a list type option.

Definition at line 124 of file configimpl.h.

Member Enumeration Documentation

◆ WidgetType

Enumerator
String 
File 
Dir 
FileAndDir 

Definition at line 127 of file configimpl.h.

Constructor & Destructor Documentation

◆ ConfigList()

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

Definition at line 128 of file configimpl.h.

130 {
131 m_name = name;
132 m_doc = doc;
134 }
WidgetType m_widgetType
Definition configimpl.h:151
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_List
A list of items.
Definition configimpl.h:49

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

Member Function Documentation

◆ addValue()

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

Definition at line 135 of file configimpl.h.

135{ m_defaultValue.emplace_back(v); }
StringVector m_defaultValue
Definition configimpl.h:150

References m_defaultValue.

◆ compareDoxyfile()

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

Implements ConfigOption.

Definition at line 417 of file configimpl.l.

418{
419 if (!isDefault()) writeTemplate(t,TRUE,TRUE);
420}
void writeTemplate(TextStream &t, bool sl, bool) override
Definition configimpl.l:368
bool isDefault() override
Definition configimpl.l:385
#define TRUE
Definition qcstring.h:37

References isDefault(), TRUE, and writeTemplate().

◆ emptyValueToDefault()

void ConfigList::emptyValueToDefault ( )
inlineoverridevirtual

Reimplemented from ConfigOption.

Definition at line 140 of file configimpl.h.

140{ if (m_value.empty() && !m_defaultValue.empty()) m_value=m_defaultValue; };
StringVector m_value
Definition configimpl.h:149

References m_defaultValue, and m_value.

◆ getDefault()

StringVector ConfigList::getDefault ( )
inline

Definition at line 139 of file configimpl.h.

139{ return m_defaultValue; }

References m_defaultValue.

◆ init()

void ConfigList::init ( )
inlineoverridevirtual

Reimplemented from ConfigOption.

Definition at line 146 of file configimpl.h.

References m_defaultValue, and m_value.

◆ isDefault()

bool ConfigList::isDefault ( )
overridevirtual

Reimplemented from ConfigOption.

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.

136{ m_widgetType = w; }

References m_widgetType.

◆ substEnvVars()

void ConfigList::substEnvVars ( )
overridevirtual

Implements ConfigOption.

Definition at line 1511 of file configimpl.l.

1512{
1514}
static void substEnvVarsInStrList(StringVector &sl)

References m_value, and substEnvVarsInStrList().

◆ valueRef()

StringVector * ConfigList::valueRef ( )
inline

Definition at line 138 of file configimpl.h.

138{ return &m_value; }

References m_value.

◆ widgetType()

WidgetType ConfigList::widgetType ( ) const
inline

Definition at line 137 of file configimpl.h.

137{ return m_widgetType; }

References m_widgetType.

◆ writeTemplate()

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

Implements ConfigOption.

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}
QCString m_userComment
Definition configimpl.h:100
void writeStringList(TextStream &t, const StringVector &l)
Definition configimpl.l:171
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, ConfigOption::MAX_OPTION_LENGTH, and ConfigOption::writeStringList().

Referenced by compareDoxyfile().

◆ writeXMLDoxyfile()

void ConfigList::writeXMLDoxyfile ( TextStream & t)
overridevirtual

Implements ConfigOption.

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}
void writeStringValue(TextStream &t, const QCString &s, bool initSpace=true, bool wasQuoted=false)
Definition configimpl.l:139

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

◆ writeXSDDoxyfile()

void ConfigList::writeXSDDoxyfile ( TextStream & t)
overridevirtual

Implements ConfigOption.

Definition at line 441 of file configimpl.l.

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

References ConfigOption::m_name.

Member Data Documentation

◆ m_defaultValue

StringVector ConfigList::m_defaultValue
private

Definition at line 150 of file configimpl.h.

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

◆ m_value

StringVector ConfigList::m_value
private

◆ m_widgetType

WidgetType ConfigList::m_widgetType
private

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: