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

Member Enumeration Documentation

◆ WidgetType

Enumerator
String 
File 
Dir 
FileAndDir 

Definition at line 126 of file configimpl.h.

Constructor & Destructor Documentation

◆ ConfigList()

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

Definition at line 127 of file configimpl.h.

129 {
130 m_name = name;
131 m_doc = doc;
133 }
WidgetType m_widgetType
Definition configimpl.h:150
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_List
A list of items.
Definition configimpl.h:48

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

134{ m_defaultValue.emplace_back(v); }
StringVector m_defaultValue
Definition configimpl.h:149

References m_defaultValue.

◆ compareDoxyfile()

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

Implements ConfigOption.

Definition at line 427 of file configimpl.l.

428{
429 if (!isDefault()) writeTemplate(t,TRUE,TRUE);
430}
void writeTemplate(TextStream &t, bool sl, bool) override
Definition configimpl.l:378
bool isDefault() override
Definition configimpl.l:395
#define TRUE
Definition qcstring.h:37

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

◆ emptyValueToDefault()

void ConfigList::emptyValueToDefault ( )
inlineoverridevirtual

Reimplemented from ConfigOption.

Definition at line 139 of file configimpl.h.

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

References m_defaultValue, and m_value.

◆ getDefault()

StringVector ConfigList::getDefault ( )
inline

Definition at line 138 of file configimpl.h.

138{ return m_defaultValue; }

References m_defaultValue.

◆ init()

void ConfigList::init ( )
inlineoverridevirtual

Reimplemented from ConfigOption.

Definition at line 145 of file configimpl.h.

References m_defaultValue, and m_value.

◆ isDefault()

bool ConfigList::isDefault ( )
overridevirtual

Reimplemented from ConfigOption.

Definition at line 395 of file configimpl.l.

396{
397 auto get_stripped = [](const std::string &s) { return QCString(s.c_str()).stripWhiteSpace(); };
398 auto is_not_empty = [get_stripped](const std::string &s) { return !get_stripped(s).isEmpty(); };
399 size_t defCnt = std::count_if( m_value.begin(), m_value.end(),is_not_empty);
400 size_t valCnt = std::count_if(m_defaultValue.begin(),m_defaultValue.end(),is_not_empty);
401 if ( valCnt != defCnt)
402 {
403 return false;
404 }
405 auto it1 = m_value.begin();
406 auto it2 = m_defaultValue.begin();
407 while (it1!=m_value.end() && it2!=m_defaultValue.end())
408 {
409 // skip over empty values
410 while (it1!=m_value.end() && !is_not_empty(*it1))
411 {
412 ++it1;
413 }
414 if (it1!=m_value.end()) // non-empty value
415 {
416 if (get_stripped(*it1) != get_stripped(*it2)) // not the default, write as difference
417 {
418 return false;
419 }
420 ++it1;
421 ++it2;
422 }
423 }
424 return true;
425}

References m_defaultValue, m_value, and QCString::stripWhiteSpace().

Referenced by compareDoxyfile(), and writeXMLDoxyfile().

◆ setWidgetType()

void ConfigList::setWidgetType ( WidgetType w)
inline

Definition at line 135 of file configimpl.h.

135{ m_widgetType = w; }

References m_widgetType.

◆ substEnvVars()

void ConfigList::substEnvVars ( )
overridevirtual

Implements ConfigOption.

Definition at line 1519 of file configimpl.l.

1520{
1522}
static void substEnvVarsInStrList(StringVector &sl)

References m_value, and substEnvVarsInStrList().

◆ valueRef()

StringVector * ConfigList::valueRef ( )
inline

Definition at line 137 of file configimpl.h.

137{ return &m_value; }

References m_value.

◆ widgetType()

WidgetType ConfigList::widgetType ( ) const
inline

Definition at line 136 of file configimpl.h.

136{ return m_widgetType; }

References m_widgetType.

◆ writeTemplate()

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

Implements ConfigOption.

Definition at line 378 of file configimpl.l.

379{
380 if (!sl)
381 {
382 t << "\n";
384 t << "\n";
385 }
386 else if (!m_userComment.isEmpty())
387 {
389 }
390 t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "=";
392 t << "\n";
393}
QCString m_userComment
Definition configimpl.h:99
void writeStringList(TextStream &t, const StringVector &l)
Definition configimpl.l:181
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, ConfigOption::MAX_OPTION_LENGTH, and ConfigOption::writeStringList().

Referenced by compareDoxyfile().

◆ writeXMLDoxyfile()

void ConfigList::writeXMLDoxyfile ( TextStream & t)
overridevirtual

Implements ConfigOption.

Definition at line 432 of file configimpl.l.

433{
434 t << " <option id='" << m_name << "'";
435 t << " default='" << (isDefault() ? "yes" : "no") << "'";
436 t << " type='stringlist'";
437 t << ">";
438 t << "\n";
439 for (const auto &p : m_value)
440 {
441 QCString s=p.c_str();
442 t << " <value>";
443 t << "<![CDATA[";
444 writeStringValue(t,s,false);
445 t << "]]>";
446 t << "</value>\n";
447 }
448 t << " </option>\n";
449}
void writeStringValue(TextStream &t, const QCString &s, bool initSpace=true, bool wasQuoted=false)
Definition configimpl.l:149

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

◆ writeXSDDoxyfile()

void ConfigList::writeXSDDoxyfile ( TextStream & t)
overridevirtual

Implements ConfigOption.

Definition at line 451 of file configimpl.l.

452{
453 t << " <xsd:enumeration value=\"" << m_name << "\"/>\n";
454}

References ConfigOption::m_name.

Member Data Documentation

◆ m_defaultValue

StringVector ConfigList::m_defaultValue
private

Definition at line 149 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 150 of file configimpl.h.

Referenced by ConfigList(), setWidgetType(), and widgetType().


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