igor::iItem Class Reference

Item holding generic data and other items. More...

#include <iItem.h>

Public Member Functions

 iItem (const iaString &name="root")
 
template<typename T >
void setValue (const iaString &key, const T &value)
 
template<typename T >
getValue (const iaString &key) const
 
bool hasValue (const iaString &key) const
 
const iaString getName () const
 
iItemPtr addItem (const iaString &name)
 
void removeItem (iItemPtr item)
 
const std::vector< iItemPtrgetItems () const
 
iItemPtr getParent () const
 
void clear ()
 
bool operator== (const iItem &other) const
 
bool operator!= (const iItem &other) const
 
template<>
void setValue (const iaString &key, const iaString &value)
 
template<>
iaString getValue (const iaString &key) const
 
template<>
void setValue (const iaString &key, const bool &value)
 
template<>
bool getValue (const iaString &key) const
 
template<>
void setValue (const iaString &key, const uint64 &value)
 
template<>
uint64 getValue (const iaString &key) const
 

Detailed Description

Item holding generic data and other items.

Useful for small hierarchies since all data is copied a lot

Constructor & Destructor Documentation

◆ iItem()

igor::iItem::iItem ( const iaString name = "root")

ctor

Parameters
namename of the item (must be unique between siblings)

Member Function Documentation

◆ addItem()

iItemPtr igor::iItem::addItem ( const iaString name)

adds item to this item

this item retains ownership

Returns
newly added item
Parameters
namename of the item (must be unique between siblings)

◆ clear()

void igor::iItem::clear ( )

clear item and it's children

◆ getItems()

const std::vector< iItemPtr > igor::iItem::getItems ( ) const
Returns
items of this item

◆ getName()

const iaString igor::iItem::getName ( ) const
Returns
name of item

◆ getParent()

iItemPtr igor::iItem::getParent ( ) const
Returns
parent item. nullptr if root

◆ getValue() [1/4]

template<typename T >
T igor::iItem::getValue ( const iaString key) const
Returns
value for given key

key "name" is a reserved key. Every item has a name

Parameters
keythe given key

◆ getValue() [2/4]

template<>
iaString igor::iItem::getValue ( const iaString &  key) const
inline

◆ getValue() [3/4]

template<>
bool igor::iItem::getValue ( const iaString &  key) const
inline

◆ getValue() [4/4]

template<>
uint64 igor::iItem::getValue ( const iaString &  key) const
inline

◆ hasValue()

bool igor::iItem::hasValue ( const iaString key) const
Returns
true if there is a value for given key

◆ operator!=()

bool igor::iItem::operator!= ( const iItem other) const

compare two items recursively for being not equal

Returns
true if not equal
Parameters
otherthe other item

◆ operator==()

bool igor::iItem::operator== ( const iItem other) const

compare two items recursively for being equal

Returns
true if equal
Parameters
otherthe other item

◆ removeItem()

void igor::iItem::removeItem ( iItemPtr  item)

removes given item from this item

Parameters
itemthe item to remove

◆ setValue() [1/4]

template<>
void igor::iItem::setValue ( const iaString &  key,
const bool &  value 
)
inline

◆ setValue() [2/4]

template<>
void igor::iItem::setValue ( const iaString &  key,
const iaString &  value 
)
inline

◆ setValue() [3/4]

template<typename T >
void igor::iItem::setValue ( const iaString key,
const T &  value 
)

set value for given key

key "name" is a reserved key. Every item has a name

Parameters
keyto set
valueto set

◆ setValue() [4/4]

template<>
void igor::iItem::setValue ( const iaString &  key,
const uint64 value 
)
inline

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