Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ConfigOption Class Referenceabstract

#include <config.h>

Inheritance diagram for ConfigOption:
ConfigBool ConfigDisabled ConfigEnum ConfigInfo ConfigInt ConfigList ConfigObsolete ConfigString

Public Types

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

 ConfigOption (OptionType t)
 
virtual ~ConfigOption ()
 
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)
 

Protected Member Functions

virtual void writeTemplate (FTextStream &t, bool sl, bool upd)=0
 
virtual void convertStrToVal ()
 
virtual void substEnvVars ()=0
 
virtual void init ()
 
void writeBoolValue (FTextStream &t, bool v)
 
void writeIntValue (FTextStream &t, int i)
 
void writeStringValue (FTextStream &t, QCString &s)
 
void writeStringList (FTextStream &t, QStrList &l)
 

Protected Attributes

QCString m_spaces
 
QCString m_name
 
QCString m_doc
 
QCString m_dependency
 
QCString m_encoding
 
QCString m_userComment
 
OptionType m_kind
 

Friends

class Config
 

Detailed Description

Abstract base class for any configuration option.

Definition at line 31 of file config.h.

Member Enumeration Documentation

anonymous enum
Enumerator
MAX_OPTION_LENGTH 

Maximum length of an option in the config file. Used for alignment purposes.

Definition at line 49 of file config.h.

50  {
51  /*! Maximum length of an option in the config file. Used for
52  * alignment purposes.
53  */
54  MAX_OPTION_LENGTH = 23
55  };

The type of option

Enumerator
O_Info 
O_List 
O_Enum 
O_String 
O_Int 
O_Bool 
O_Obsolete 
O_Disabled 

Definition at line 38 of file config.h.

39  {
40  O_Info, //<! A section header
41  O_List, //<! A list of items
42  O_Enum, //<! A fixed set of items
43  O_String, //<! A single item
44  O_Int, //<! An integer value
45  O_Bool, //<! A boolean value
46  O_Obsolete, //<! An obsolete option
47  O_Disabled //<! Disabled compile time option
48  };

Constructor & Destructor Documentation

ConfigOption::ConfigOption ( OptionType  t)
inline

Definition at line 56 of file config.h.

56  : m_kind(t)
57  {
58  m_spaces.fill(' ',40);
59  }
QCString m_spaces
Definition: config.h:85
OptionType m_kind
Definition: config.h:91
bool fill(char c, int len=-1)
Definition: qcstring.h:243
virtual ConfigOption::~ConfigOption ( )
inlinevirtual

Definition at line 60 of file config.h.

61  {
62  }

Member Function Documentation

void ConfigOption::addDependency ( const char *  dep)
inline

Definition at line 70 of file config.h.

70 { m_dependency = dep; }
QCString m_dependency
Definition: config.h:88
virtual void ConfigOption::convertStrToVal ( )
inlineprotectedvirtual

Reimplemented in ConfigBool, and ConfigInt.

Definition at line 76 of file config.h.

76 {}
QCString ConfigOption::dependsOn ( ) const
inline

Definition at line 69 of file config.h.

69 { return m_dependency; }
QCString m_dependency
Definition: config.h:88
QCString ConfigOption::docs ( ) const
inline

Definition at line 67 of file config.h.

67 { return m_doc; }
QCString m_doc
Definition: config.h:87
virtual void ConfigOption::init ( )
inlineprotectedvirtual

Reimplemented in ConfigBool, ConfigInt, ConfigString, ConfigEnum, and ConfigList.

Definition at line 78 of file config.h.

78 {}
OptionType ConfigOption::kind ( ) const
inline

returns the kind of option this is.

Definition at line 65 of file config.h.

65 { return m_kind; }
OptionType m_kind
Definition: config.h:91
QCString ConfigOption::name ( ) const
inline

Definition at line 66 of file config.h.

66 { return m_name; }
QCString m_name
Definition: config.h:86
void ConfigOption::setEncoding ( const QCString e)
inline

Definition at line 71 of file config.h.

71 { m_encoding = e; }
const double e
QCString m_encoding
Definition: config.h:89
void ConfigOption::setUserComment ( const QCString u)
inline

Definition at line 72 of file config.h.

72 { m_userComment += u; }
QCString m_userComment
Definition: config.h:90
virtual void ConfigOption::substEnvVars ( )
protectedpure virtual
void ConfigOption::writeBoolValue ( FTextStream t,
bool  v 
)
protected

Definition at line 726 of file config.cpp.

727 {
728  t << " ";
729  if (v) t << "YES"; else t << "NO";
730 }
void ConfigOption::writeIntValue ( FTextStream t,
int  i 
)
protected

Definition at line 732 of file config.cpp.

733 {
734  t << " " << i;
735 }
void ConfigOption::writeStringList ( FTextStream t,
QStrList l 
)
protected

Definition at line 768 of file config.cpp.

769 {
770  const char *p = l.first();
771  bool first=TRUE;
772  while (p)
773  {
774  QCString s=p;
775  if (!first)
776  t << " ";
777  first=FALSE;
778  writeStringValue(t,s);
779  p = l.next();
780  if (p) t << " \\" << endl;
781  }
782 }
type * first()
Definition: qinternallist.h:87
void writeStringValue(FTextStream &t, QCString &s)
Definition: config.cpp:737
const bool FALSE
Definition: qglobal.h:370
p
Definition: test.py:223
type * next()
Definition: qinternallist.h:89
static QCString * s
Definition: config.cpp:1042
const bool TRUE
Definition: qglobal.h:371
QTextStream & endl(QTextStream &s)
void ConfigOption::writeStringValue ( FTextStream t,
QCString s 
)
protected

Definition at line 737 of file config.cpp.

738 {
739  char c;
740  bool needsEscaping=FALSE;
741  // convert the string back to it original encoding
743  const char *p=se.data();
744  if (p)
745  {
746  t << " ";
747  while ((c=*p++)!=0 && !needsEscaping)
748  needsEscaping = (c==' ' || c=='\n' || c=='\t' || c=='"' || c=='#');
749  if (needsEscaping)
750  {
751  t << "\"";
752  p=se.data();
753  while (*p)
754  {
755  if (*p==' ' && *(p+1)=='\0') break; // skip inserted space at the end
756  if (*p=='"') t << "\\"; // escape quotes
757  t << *p++;
758  }
759  t << "\"";
760  }
761  else
762  {
763  t << se;
764  }
765  }
766 }
static QCString configStringRecode(const QCString &str, const char *fromEncoding, const char *toEncoding)
Definition: config.cpp:1083
const bool FALSE
Definition: qglobal.h:370
p
Definition: test.py:223
const char * data() const
Definition: qcstring.h:207
QCString m_encoding
Definition: config.h:89
Definition: se.py:1
virtual void ConfigOption::writeTemplate ( FTextStream t,
bool  sl,
bool  upd 
)
protectedpure virtual

Friends And Related Function Documentation

friend class Config
friend

Definition at line 33 of file config.h.

Member Data Documentation

QCString ConfigOption::m_dependency
protected

Definition at line 88 of file config.h.

QCString ConfigOption::m_doc
protected

Definition at line 87 of file config.h.

QCString ConfigOption::m_encoding
protected

Definition at line 89 of file config.h.

OptionType ConfigOption::m_kind
protected

Definition at line 91 of file config.h.

QCString ConfigOption::m_name
protected

Definition at line 86 of file config.h.

QCString ConfigOption::m_spaces
protected

Definition at line 85 of file config.h.

QCString ConfigOption::m_userComment
protected

Definition at line 90 of file config.h.


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