37 #include <boost/shared_ptr.hpp> 189 void mapSetValue(
const QString& key, QVariant value);
209 bool mapGetValue(
const QString& key, QVariant* value_out)
const;
219 bool mapGetInt(
const QString& key,
int* value_out)
const;
229 bool mapGetFloat(
const QString& key,
float* value_out)
const;
239 bool mapGetBool(
const QString& key,
bool* value_out)
const;
249 bool mapGetString(
const QString& key, QString* value_out)
const;
253 void setValue(
const QVariant& value);
314 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.
static Config invalidConfig()
QVariant getValue() const
If this config object is valid and is a Value type, this returns its value. Otherwise it returns an i...
Config()
Default constructor. Creates an empty config object.
MapIterator()
Private constructor enforces that MapIterators are only made by their friend the Config class...
int listLength() const
Returns the length of the List in this Node, or 0 if this Node does not have type List...
bool isValid()
Return true if the iterator currently points to a valid entry, false if not.
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...
bool mapGetString(const QString &key, QString *value_out) const
Convenience function for looking up a named string.
void makeValid()
If the node pointer is NULL, this sets it to a new empty node.
boost::shared_ptr< Node > NodePtr
void start()
Resets the iterator to the start of the map.
bool isValid() const
Returns true if the internal Node reference is valid, false if not. Same as (getType() != Invalid)...
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...
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 mapGetValue(const QString &key, QVariant *value_out) const
Convenience function for looking up a named value.
bool mapGetFloat(const QString &key, float *value_out) const
Convenience function for looking up a named float.
Type getType() const
Return the Type of the referenced Node, or Invalid if this Config does not refer to a Node at all...
bool mapGetBool(const QString &key, bool *value_out) const
Convenience function for looking up a named boolean.
Config listAppendNew()
Ensure the referenced Node is of type List, append a new Empty Node to the end of the 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...
Config currentChild()
Return a Config reference to the current map entry.
MapIterator mapIterator() const
Return a new iterator for looping over key/value pairs.
QMap< QString, Config::NodePtr >::const_iterator iterator_
bool mapGetInt(const QString &key, int *value_out) const
Convenience function for looking up a named integer.
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.