GWE::GweFactoryOption Class Reference

Option definition for server initialization. More...

#include <GweFactoryOption.h>

Inheritance diagram for GWE::GweFactoryOption:

Inheritance graph
[legend]
Collaboration diagram for GWE::GweFactoryOption:

Collaboration graph
[legend]
List of all members.

Public Slots

virtual void updateTree ()
virtual void setValue (const QString &value)
virtual void setDescription (const QString &description)
virtual void loadFromXml (const QDomElement &options)
virtual void saveToXml (QDomElement storage)
virtual void setValueOfSubOption (const QString &sub_option_name, const QString &value)

Signals

void valueChanged (const QString &new_value)
void treeUpdated ()

Public Member Functions

 GweFactoryOption (const QString &option_name, const QString &value=0, const QString &description=0)
virtual ~GweFactoryOption ()
QString getOptionName () const
QString getDescription () const
QString getValue () const
bool hasSubOptions () const
QList< GweFactoryOption * > getSubOptions () const
GweFactoryOptiongetSubOption (const QString &option_name)
QString getValueOfSubOption (const QString &option_name)
bool hasPredefinedValues () const
virtual QStringList getPredefinedValues () const

Protected Member Functions

void deleteSubOption (const QString &option_name)
void deleteAllSubOptions ()

Protected Attributes

QString OptionName
QString Description
QString Value
QMap< QString, GweFactoryOption * > SubOptions

Detailed Description

Option definition for server initialization.

Author:
Raphael Langerhorst
Options are ordered hierarchically like a tree structure. The user interface that lets the server administrator define the various options can have these represented in a treelike structure. Based on values of the current option different suboptions (leaves of the tree) are available. Thus only the options that are used are actually displayed.

This class defines the base class for options. All specialisations are implemented in the implementation file of the GWoldEngineFactory class.

To implement a specialised option class, only updateTree() needs to be reimplemented.


Constructor & Destructor Documentation

GWE::GweFactoryOption::GweFactoryOption ( const QString &  option_name,
const QString &  value = 0,
const QString &  description = 0 
)

Constructor. All parameters except the name of the option are optional.

GWE::GweFactoryOption::~GweFactoryOption (  )  [virtual]

Destructor. Deletes all children.


Member Function Documentation

void GWE::GweFactoryOption::deleteAllSubOptions (  )  [protected]

A useful method for clearing all suboptions. This essentially deletes all suboptions and empties the value list.

void GWE::GweFactoryOption::deleteSubOption ( const QString &  option_name  )  [protected]

Deletes only the given sub option.

QString GWE::GweFactoryOption::getDescription (  )  const

Returns:
the option description which explains the option in-depth.

QString GWE::GweFactoryOption::getOptionName (  )  const

Returns:
the name of the option.

QStringList GWE::GweFactoryOption::getPredefinedValues (  )  const [virtual]

Returns:
the list of predefined values that are valid for this option

an empty stringlist if the value can be any string, which means no predefined set of values is available.

Note:
returns an empty list by default, reimplement for different behaviour

GweFactoryOption * GWE::GweFactoryOption::getSubOption ( const QString &  option_name  ) 

Returns:
the sub option with given option name.

QList< GweFactoryOption * > GWE::GweFactoryOption::getSubOptions (  )  const

Returns:
a reference to all suboptions.
Note:
The returned value list is a copy of the internal one. You should get a new one each time treeUpdated is emitted.

QString GWE::GweFactoryOption::getValue (  )  const

Returns:
the value of the option which determines factory behaviour.

QString GWE::GweFactoryOption::getValueOfSubOption ( const QString &  option_name  ) 

Returns:
the value of the given suboption (empty if value does not exist).

bool GWE::GweFactoryOption::hasPredefinedValues (  )  const

If this option has predefined values, you can get the list of values with getPredefinedValues.

Returns:
true when this option can be set to some selected values only, false when the value is freeform (any string).
Note:
returns false if getPredefinedValues returns an empty list

bool GWE::GweFactoryOption::hasSubOptions (  )  const

Returns:
true when this option has sub options.

void GWE::GweFactoryOption::loadFromXml ( const QDomElement &  options  )  [virtual, slot]

Loads the configuration for this option including all suboptions from given XML element (recursive).

void GWE::GweFactoryOption::saveToXml ( QDomElement  storage  )  [virtual, slot]

Saves the configuration for this option including all suboptions to given XML element (recursive).

void GWE::GweFactoryOption::setDescription ( const QString &  description  )  [virtual, slot]

Sets the value of the option.

See also:
Value

void GWE::GweFactoryOption::setValue ( const QString &  value  )  [virtual, slot]

Sets the value of the option.

See also:
Value

void GWE::GweFactoryOption::setValueOfSubOption ( const QString &  sub_option_name,
const QString &  value 
) [virtual, slot]

Set the value of the given sub_option. if the given suboption does not exist, nothing is done.

void GWE::GweFactoryOption::treeUpdated (  )  [signal]

Emitted everytime the options tree is updated.

See also:
updateTree

void GWE::GweFactoryOption::updateTree (  )  [virtual, slot]

Updates recursively the available suboptions based on the current value of this option. This slot should be reimplemented in the specialised option class.

void GWE::GweFactoryOption::valueChanged ( const QString &  new_value  )  [signal]

Emitted every time the value of the option changes.

See also:
setValue


Member Data Documentation

QString GWE::GweFactoryOption::Description [protected]

Description and explaination for the option. Should be displayed in the UI if help is requested.

QString GWE::GweFactoryOption::OptionName [protected]

Holds the name of the option. Thus it is possible to use a class for more than just one option.

QMap<QString,GweFactoryOption*> GWE::GweFactoryOption::SubOptions [protected]

All suboptions in the options tree of this option. The content depends on the value of this option.

QString GWE::GweFactoryOption::Value [protected]

The actual value of the option. This determines the initialization process of the GWE.


The documentation for this class was generated from the following files:
Generated on Thu Nov 16 07:49:37 2006 for G System by  doxygen 1.4.7