edbee - Qt Editor Library
Public Member Functions | List of all members
edbee::CascadingQVariantMap Class Reference

A cascading map is a Hierarchical QVariantMap. More...

#include <cascadingqvariantmap.h>

+ Collaboration diagram for edbee::CascadingQVariantMap:

Public Member Functions

 CascadingQVariantMap (CascadingQVariantMap *parent=0)
 
void deleteParents ()
 This helper method deletes all containing parents recursively Tough this doesnt' feel quite correct (it uses references to parent) it makes managing the map a bit easier. More...
 
void setQVariantMap (const QVariantMap &map)
 Sets the variant mapt to the given map. More...
 
CascadingQVariantMaproot ()
 This method finds the 'root variant map. More...
 
CascadingQVariantMapparent () const
 Returns the parent of this map. More...
 
void insert (const QString &key, const QVariant &value)
 Insert the given value at the current cascading level. More...
 
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't have this key, it cascades to a higher-level. If it doesn't find the key if will fallback to the defValue supplied. More...
 
const QString stringValue (const QString &key, const QString &defValue=QString()) const
 Method to quickly fetch a string item. More...
 
int intValue (const QString &key, int defValue=0) const
 Method to quickly fetch int items. More...
 
double doubleValue (const QString &key, double defValue=0.0) const
 Returns a double value. More...
 
bool boolValue (const QString &key, bool defValue=false) const
 Returns the default boolean value. More...
 

Detailed Description

A cascading map is a Hierarchical QVariantMap.

When retrieving an item, it fist tries to find the item at this level, if it does't find the item it tries the parent item

Constructor & Destructor Documentation

◆ CascadingQVariantMap()

edbee::CascadingQVariantMap::CascadingQVariantMap ( edbee::CascadingQVariantMap parent = 0)
explicit

Member Function Documentation

◆ boolValue()

bool edbee::CascadingQVariantMap::boolValue ( const QString &  key,
bool  defValue = false 
) const

Returns the default boolean value.

◆ deleteParents()

void edbee::CascadingQVariantMap::deleteParents ( )

This helper method deletes all containing parents recursively Tough this doesnt' feel quite correct (it uses references to parent) it makes managing the map a bit easier.

◆ doubleValue()

double edbee::CascadingQVariantMap::doubleValue ( const QString &  key,
double  defValue = 0.0 
) const

Returns a double value.

◆ insert()

void edbee::CascadingQVariantMap::insert ( const QString &  key,
const QVariant &  value 
)

Insert the given value at the current cascading level.

Parameters
keythe name of the key to set
valuethe value to set

◆ intValue()

int edbee::CascadingQVariantMap::intValue ( const QString &  key,
int  defValue = 0 
) const

Method to quickly fetch int items.

◆ parent()

CascadingQVariantMap * edbee::CascadingQVariantMap::parent ( ) const

Returns the parent of this map.

◆ root()

CascadingQVariantMap * edbee::CascadingQVariantMap::root ( )

This method finds the 'root variant map.

◆ setQVariantMap()

void edbee::CascadingQVariantMap::setQVariantMap ( const QVariantMap &  map)

Sets the variant mapt to the given map.

◆ stringValue()

const QString edbee::CascadingQVariantMap::stringValue ( const QString &  key,
const QString &  defValue = QString() 
) const

Method to quickly fetch a string item.

◆ value()

const QVariant edbee::CascadingQVariantMap::value ( const QString &  key,
const QVariant &  defValue = QVariant() 
) const

Returns the value of the given key. If the map at this level doesn't have this key, it cascades to a higher-level. If it doesn't find the key if will fallback to the defValue supplied.

Parameters
keythe name of the item to retrieve
defValuethe default value when the item isn't found

The documentation for this class was generated from the following files: