class PropertyList

This class provides a generic hashtable-like interface for perstantly storing arbitrary key/value pairs. More...

Full namefun::PropertyList
Definition#include <fun/PropertyList.h>
InheritsQObject (unknown) [public ], fun::Serializable [public ]
Inherited byConfigFile, SimpleCLParser
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Slots

Signals

Protected Types

Protected Members


Detailed Description

This class provides a generic hashtable-like interface for perstantly storing arbitrary key/value pairs.

 PropertyList ()

PropertyList

 ~PropertyList ()

~PropertyList

QString  getString (const QString &key, QString defaultVal = QString())

getString

[const]

Returns the value corresponding to the given key. If the value has not been set, the given default value is returned.

QString  get (const QString &key, QString defaultVal = QString())

get

[const]

This is the same as calling getString().

int  getInt (const QString &key, int defaultVal = 0)

getInt

[const]

Returns the value corresponding to the given key. If the value has not been set or can't be converted to an int, the given default value is returned. If you need to know whether a value was set but couldn't be converted, use isSet() and isInt().

bool  getBool (const QString &key, bool defaultVal = false)

getBool

[const]

Returns the value corresponding to the given key. If the value has not been set or can't be converted to a bool, the given default value is returned. (See isBool() for the rules.) If you need to know whether a value was set but couldn't be converted, use isSet() and isBool().

double  getDouble (const QString &key, double defaultVal = 0.0)

getDouble

[const]

Returns the value corresponding to the given key. If the value has not been set or can't be converted to a double, the given default value is returned. (See isDouble() for the rules.) If you need to know whether a value was set but couldn't be converted, use isSet() and isDouble().

QColor  getColor (const QString &key, QColor defaultVal = QColor())

getColor

[const]

Returns the value corresponding to the given key. If the value has not been set or can't be converted to a color, the given default value is returned. (See isColor() for the rules.) If you need to know whether a value was set but couldn't be converted, use isSet() and isColor().

QPoint  getPoint ( const QString &key, const QPoint &dflt )

getPoint

[virtual]

Returns the QPoint stored in the given key.

QSize  getSize ( const QString &key, const QSize &dflt )

getSize

[virtual]

A convenience wrapper around getPoint().

bool  isSet (const QString &key)

isSet

[const]

Returns true if a value has been supplied for the given key, false otherwise. Note that a key can be supplied with a null value.

bool  isInt (const QString &key)

isInt

[const]

Returns true if the value has been set for the given key and can be converted to an int. This uses QString::toInt() to determine whether the value can be converted.

bool  isBool (const QString &key)

isBool

[const]

Returns true if the value has been set for the given key and can be converted to a bool. (True if it's "true", "false", "on", "off", "yes", "no", "t", "f", "y", "n", or an integer.)

bool  isDouble (const QString &key)

isDouble

[const]

Returns true if the value has been set for the given key and can be converted to a double. This uses QString::toDouble() to determine whether the value can be converted.

bool  isColor (const QString &key)

isColor

[const]

Returns true if the value has been set for the given key and can be converted to a color. See QColor::setNamedColor() for the rules.

QString  getComment (const QString &key)

getComment

[const]

Gets an element's comment.

bool  isLoaded ()

isLoaded

[const virtual]

Returns true if this ConfigFile has been successfully loaded, or if at least one value has been set().

bool  needsSave ()

needsSave

[const virtual]

Returns true if any of the configuration values have been changed since the file was last loaded or saved.

const QValueList<QString> & keys ()

keys

void  slotEmitUpdate ()

slotEmitUpdate

[slot]

Forces the object to emit a signalChange( QString() ) with an empty String. Receivers can decide if they want to react to a global update or not.

void  set (const QString &key, const QString &val, const QString &comment = QString() )

set

[slot]

Sets the given element to the given string value.

void  set (const QString &key, int val)

set

[slot]

Sets the given element to the given int value.

void  set (const QString &key, bool val)

set

[slot]

Sets the given element to the given bool value.

void  set (const QString &key, double val)

set

[slot]

Sets the given element to the given double value.

void  set (const QString &key, const QColor &val)

set

[slot]

Sets the given element to the given color value. This will be stored in the format #rrggbb.

void  set ( const QString &key, const QPoint &val )

set

[virtual slot]

Puts a QPoint in the list, in the format "x,y".

void  set ( const QString &key, const QSize &dflt )

set

[virtual slot]

A convenience wrapper around set( QString, QPoint ).

void  unset (const QString &key)

unset

[slot]

Removes the given element.

void  setComment (const QString &key, const QString &comment)

setComment

[slot]

Sets the comment which will be printed above an element. Don't include comment characters; they will be added by saveToText() or saveToXML().

void  setNeedsSave (bool needsSave)

setNeedsSave

[slot]

Sets the "needs save" flag to the given value. (The only reason for this is that saveToXML and saveToText are const methods, so they can't change the flag; after saving it, setNeedsSave() yourself.) Too bogus?

bool  mergeIn ( const PropertyList *config )

mergeIn

[virtual slot]

This take a different ConfigFile and merges in any new values and keys. This can be used to easily allow gamesets to modify the global config settings. My idea is to have a qub.ini in any given dir, and have DirView pull that into GConfigFile::global()->mergeIn(). This function will return false when es Fehler gab.

void  deserialize (const Deserializer &ser)

deserialize

[virtual slot]

Tells the object to restore it's state from the given Deserializer.

Reimplemented from Serializable.

void  serialize (Serializer &ser)

serialize

[const virtual slot]

Tells the instance to save it's state to the given Serializer object.

Reimplemented from Serializable.

void  signalChange ( const QString & )

signalChange

[virtual signal]

Emitted when set() is called.

Entry (struct)

Entry

[protected]

QDict data

data

[protected]

typedef QValueList<QString> QVStringList

QVStringList

[protected]

QVStringList order

order

[protected]


Generated by: stephan on cheyenne on Mon Aug 11 14:06:52 2003, using kdoc 2.0a54.