Geddei::Properties Class Reference
[Geddei's core classes.]

A set of name/value pairs that act as attributes to a Processor object. More...

#include <properties.h>

Inheritance diagram for Geddei::Properties:

Inheritance graph
[legend]
List of all members.

Public Member Functions

const QVariant & get (const QString &key) const
const QStringList keys () const
Propertiesoperator() (const QString &key, const QVariant &value)
QVariant & operator[] (const QString &key)
const QVariant & operator[] (const QString &key) const
 Properties (const PropertiesInfo &info)
 Properties ()
 Properties (const QString &key, const QVariant &value)
void set (const Properties &pairs)
void set (const QString &key, const QVariant value)
const uint size () const

Friends

class ::NodeServerSession
class DRCoupling
class rGeddei::RemoteSession
class RSCoupling

Detailed Description

A set of name/value pairs that act as attributes to a Processor object.

Author:
Gav Wood <gav@cs.york.ac.uk>
Properties is a simple class to store a set of name-value pairs. The values are allowed to be of any valid Qt type.

The only real "magic" is its cool convenience construction method from a string.


Constructor & Destructor Documentation

Geddei::Properties::Properties ( const QString &  key,
const QVariant &  value 
) [inline]

Constructor for initialising a Properties object with one key/value pair in it.

Parameters:
key The key of the key/value pair that will be in the object.
value The value of the key/value pair that will be in the object.

Geddei::Properties::Properties (  )  [inline]

Basic constructor. Creates an empty Properties object.


Member Function Documentation

const QVariant& Geddei::Properties::get ( const QString &  key  )  const [inline]

Retrieve a value from the mapping.

Example, assuming P is an already populated Properties object:

 QString s = P.get("stringKey").toString();
 int i = P.get("intKey").toInt();

Parameters:
key The key whose value is to be retrieved.
Returns:
A QVariant object (which acts similarly to a union of all types supported) containing the data mapped to key .

Properties& Geddei::Properties::operator() ( const QString &  key,
const QVariant &  value 
) [inline]

Operator to add a key value pair to an existing Properties object.

Typical use would be with a constructor:

 Properties p = Properties("a", 1)("b", 2)("c", 3);

It may be used similarly inline when calling methods with Properties arguments:

 someObject.someMethod(Properties("a", 1)("b", 2)("c", 3));

Parameters:
key The key of the pair to be added.
value The value of the pair to be added.
Returns:
A reference to this, with the new pair having been added.

QVariant& Geddei::Properties::operator[] ( const QString &  key  )  [inline]

Subscript operator giving full access to the mapping. This can be used for writing to the mapping.

Example; both lines are semanticly equivalent:

 P.set("stringKey", "Boo!");
 P["stringKey"] = "Boo!";

Parameters:
key The key of the value to be retrieved.
Returns:
A reference to the value whose key is key .
See also:
set()

const QVariant& Geddei::Properties::operator[] ( const QString &  key  )  const [inline]

Subscript operator giving const access to the mapping.

Functions the same as get().

Parameters:
key The key of the value to be retrieved.
Returns:
The value whose key is key .
See also:
get()

void Geddei::Properties::set ( const QString &  key,
const QVariant  value 
) [inline]

Set a value in the mapping.

Example:

 Properties P;
 QString s = P.set("stringKey", "Hello world");
 int i = P.get("intKey", 69);

Parameters:
key The key of the value to be set.
value The value intended for key key .


The documentation for this class was generated from the following files:
Generated on Fri Nov 10 21:58:35 2006 for Exscalibar by  doxygen 1.5.1