37 #include <boost/shared_ptr.hpp> 183 void mapSetValue(
const QString& key, QVariant value );
203 bool mapGetValue(
const QString& key, QVariant *value_out )
const;
213 bool mapGetInt(
const QString& key,
int *value_out )
const;
223 bool mapGetFloat(
const QString& key,
float *value_out )
const;
233 bool mapGetBool(
const QString& key,
bool *value_out )
const;
243 bool mapGetString(
const QString& key, QString *value_out )
const;
247 void setValue(
const QVariant& value );
308 QMap<QString, Config::NodePtr>::const_iterator
iterator_;
void setValue(const QVariant &value)
Ensures this is a valid Config object, sets the type to Value then sets the value.
Type getType() const
Return the Type of the referenced Node, or Invalid if this Config does not refer to a Node at all...
static Config invalidConfig()
Config()
Default constructor. Creates an empty config object.
int listLength() const
Returns the length of the List in this Node, or 0 if this Node does not have type List...
Config listChildAt(int i) const
Return the i'th child in the list, if the referenced Node has type List. Returns an Invalid Config if...
bool mapGetFloat(const QString &key, float *value_out) const
Convenience function for looking up a named float.
MapIterator()
Private constructor enforces that MapIterators are only made by their friend the Config class...
bool isValid()
Return true if the iterator currently points to a valid entry, false if not.
void makeValid()
If the node pointer is NULL, this sets it to a new empty node.
bool isValid() const
Returns true if the internal Node reference is valid, false if not. Same as (getType() != Invalid)...
boost::shared_ptr< Node > NodePtr
bool mapGetString(const QString &key, QString *value_out) const
Convenience function for looking up a named string.
void start()
Resets the iterator to the start of the map.
void mapSetValue(const QString &key, QVariant value)
Set a named child to the given value.
Configuration data storage class.
QString currentKey()
Return the name of the current map entry.
Type
Possible types a Config Node can have are Map, List, Value, and Empty. Invalid means the Config objec...
QVariant getValue() const
If this config object is valid and is a Value type, this returns its value. Otherwise it returns an i...
Config mapMakeChild(const QString &key)
Create a child node stored with the given key, and return the child.
Iterator class for looping over all entries in a Map type Config Node.
bool mapGetBool(const QString &key, bool *value_out) const
Convenience function for looking up a named boolean.
bool mapGetInt(const QString &key, int *value_out) const
Convenience function for looking up a named integer.
MapIterator mapIterator() const
Return a new iterator for looping over key/value pairs.
Config listAppendNew()
Ensure the referenced Node is of type List, append a new Empty Node to the end of the list...
Config currentChild()
Return a Config reference to the current map entry.
Config mapGetChild(const QString &key) const
If the referenced Node is a Map and it has a child with the given key, return a reference to the chil...
QMap< QString, Config::NodePtr >::const_iterator iterator_
bool mapGetValue(const QString &key, QVariant *value_out) const
Convenience function for looking up a named value.
void copy(const Config &source)
Make this a deep copy of source.
void setType(Type new_type)
Set the type of this Config Node.
void advance()
Advance iterator to next entry.