ConfigProperty Class Reference
[Configuration Handling]

#include <SyncEvolutionConfig.h>

Inheritance diagram for ConfigProperty:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 ConfigProperty (const string &name, const string &comment, const string &def=string(""))
virtual ~ConfigProperty ()
virtual string getName () const
virtual string getComment () const
virtual string getDefValue () const
virtual bool checkValue (const string &value, string &error) const
bool isHidden () const
void setHidden (bool hidden)
bool isObligatory () const
void setObligatory (bool obligatory)
void setProperty (ConfigNode &node, const string &value) const
void setProperty (FilterConfigNode &node, const string &value, bool temporarily=false) const
void setDefaultProperty (ConfigNode &node, bool force) const
virtual string getProperty (const ConfigNode &node, bool *isDefault=NULL) const

Static Public Member Functions

static void splitComment (const string &comment, list< string > &commentLines)

Protected Member Functions

void throwValueError (const ConfigNode &node, const string &name, const string &value, const string &error) const


Detailed Description

A property has a name and a comment. Derived classes might have additional code to read and write the property from/to a ConfigNode. They might also one or more of the properties on the fly, therefore the virtual get methods which return a string value and not just a reference.

A default value is returned if the ConfigNode doesn't have a value set (= empty string). Invalid values in the configuration trigger an exception. Setting invalid values does not because it is not known where the value comes from - the caller should check it himself.

Definition at line 60 of file SyncEvolutionConfig.h.


Constructor & Destructor Documentation

ConfigProperty::ConfigProperty ( const string &  name,
const string &  comment,
const string &  def = string("") 
) [inline]

Definition at line 62 of file SyncEvolutionConfig.h.

virtual ConfigProperty::~ConfigProperty (  )  [inline, virtual]

Definition at line 69 of file SyncEvolutionConfig.h.


Member Function Documentation

virtual bool ConfigProperty::checkValue ( const string &  value,
string &  error 
) const [inline, virtual]

Check whether the given value is okay. If not, then set an error string (one line, no punctuation).

Returns:
true if value is okay

Reimplemented in StringConfigProperty, and TypedConfigProperty< T >.

Definition at line 81 of file SyncEvolutionConfig.h.

Referenced by getProperty().

virtual string ConfigProperty::getComment (  )  const [inline, virtual]

virtual string ConfigProperty::getDefValue (  )  const [inline, virtual]

virtual string ConfigProperty::getName (  )  const [inline, virtual]

virtual string ConfigProperty::getProperty ( const ConfigNode node,
bool *  isDefault = NULL 
) const [inline, virtual]

Return values:
isDefault return true if the node had no value set and the default was returned instead

Reimplemented in StringConfigProperty.

Definition at line 112 of file SyncEvolutionConfig.h.

References checkValue(), getDefValue(), getName(), ConfigNode::readProperty(), and throwValueError().

Referenced by PasswordConfigProperty::checkPassword(), PasswordConfigProperty::getCachedProperty(), and ConfigStringCache::getProperty().

bool ConfigProperty::isHidden (  )  const [inline]

Definition at line 86 of file SyncEvolutionConfig.h.

bool ConfigProperty::isObligatory (  )  const [inline]

Definition at line 89 of file SyncEvolutionConfig.h.

void ConfigProperty::setDefaultProperty ( ConfigNode node,
bool  force 
) const [inline]

set default value of a property, marked as default unless forced setting

Definition at line 103 of file SyncEvolutionConfig.h.

References getComment(), getDefValue(), and ConfigNode::setProperty().

void ConfigProperty::setHidden ( bool  hidden  )  [inline]

void ConfigProperty::setObligatory ( bool  obligatory  )  [inline]

void ConfigProperty::setProperty ( FilterConfigNode node,
const string &  value,
bool  temporarily = false 
) const [inline]

void ConfigProperty::setProperty ( ConfigNode node,
const string &  value 
) const [inline]

void ConfigProperty::splitComment ( const string &  comment,
list< string > &  commentLines 
) [static]

split
separated comment into lines without
, appending them to commentLines

Definition at line 35 of file SyncEvolutionConfig.cpp.

Referenced by FileConfigNode::setProperty().

void ConfigProperty::throwValueError ( const ConfigNode node,
const string &  name,
const string &  value,
const string &  error 
) const [protected]


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

Generated on Sat Oct 18 17:17:03 2008 for SyncEvolution and Funambol by  doxygen 1.5.7.1