edbee - Qt Editor Library
cascadingqvariantmap.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <QVariantMap>
9 
10 namespace edbee {
11 
17 {
18 public:
20  void deleteParents();
21 
22  void setQVariantMap( const QVariantMap& map );
23 
26  void insert( const QString& key, const QVariant& value );
27 
28 
29  const QVariant value( const QString& key, const QVariant& defValue = QVariant() ) const;
30  const QString stringValue( const QString& key, const QString& defValue = QString() ) const;
31  int intValue( const QString& key, int defValue = 0 ) const;
32  double doubleValue( const QString& key, double defValue = 0.0 ) const;
33  bool boolValue( const QString& key, bool defValue = false ) const;
34 
35 private:
36 
37  CascadingQVariantMap* parentRef_;
38  QVariantMap map_;
39 
40 
41 };
42 
43 
44 } // edbee
const QString stringValue(const QString &key, const QString &defValue=QString()) const
Method to quickly fetch a string item.
Definition: cascadingqvariantmap.cpp:77
void setQVariantMap(const QVariantMap &map)
Sets the variant mapt to the given map.
Definition: cascadingqvariantmap.cpp:30
const QVariant value(const QString &key, const QVariant &defValue=QVariant()) const
Returns the value of the given key. If the map at this level doesn&#39;t have this key, it cascades to a higher-level. If it doesn&#39;t find the key if will fallback to the defValue supplied.
Definition: cascadingqvariantmap.cpp:64
A cascading map is a Hierarchical QVariantMap.
Definition: cascadingqvariantmap.h:16
double doubleValue(const QString &key, double defValue=0.0) const
Returns a double value.
Definition: cascadingqvariantmap.cpp:89
CascadingQVariantMap * parent() const
Returns the parent of this map.
Definition: cascadingqvariantmap.cpp:45
CascadingQVariantMap(CascadingQVariantMap *parent=0)
Definition: cascadingqvariantmap.cpp:13
int intValue(const QString &key, int defValue=0) const
Method to quickly fetch int items.
Definition: cascadingqvariantmap.cpp:83
Copyright 2011-2013 - Reliable Bits Software by Blommers IT.
Definition: commentcommand.cpp:22
void insert(const QString &key, const QVariant &value)
Insert the given value at the current cascading level.
Definition: cascadingqvariantmap.cpp:54
void deleteParents()
This helper method deletes all containing parents recursively Tough this doesnt&#39; feel quite correct (...
Definition: cascadingqvariantmap.cpp:21
CascadingQVariantMap * root()
This method finds the &#39;root variant map.
Definition: cascadingqvariantmap.cpp:36
bool boolValue(const QString &key, bool defValue=false) const
Returns the default boolean value.
Definition: cascadingqvariantmap.cpp:95