OpenWalnut
1.5.0dev
|
A derivation of WItemSelection which can store a value of any type. More...
#include <WItemSelectionItemTyped.h>
Public Types | |
typedef std::shared_ptr< WItemSelectionItemTyped< T > > | SPtr |
Abbreviation for a shared pointer. More... | |
typedef std::shared_ptr< const WItemSelectionItemTyped< T > > | ConstSPtr |
Abbreviation for a const shared pointer. More... | |
typedef T | ValueType |
The type of the value stored in here. More... | |
Public Types inherited from WItemSelectionItem | |
typedef std::shared_ptr< WItemSelectionItem > | SPtr |
Abbreviation for a shared pointer. More... | |
typedef std::shared_ptr< const WItemSelectionItem > | ConstSPtr |
Abbreviation for a const shared pointer. More... | |
Public Member Functions | |
WItemSelectionItemTyped (T value, std::string name, std::string description="", const char **icon=NULL) | |
Constructs a new item with the specified values. More... | |
virtual | ~WItemSelectionItemTyped () |
Destruction. More... | |
const T | getValue () const |
Returns the value. More... | |
T | getValue () |
Returns the value. More... | |
void | setValue (T value) |
Sets a new value, which is associated with this item. More... | |
Public Member Functions inherited from WItemSelectionItem | |
WItemSelectionItem (std::string name, std::string description="", const char **icon=NULL) | |
Constructs a new item with the specified values. More... | |
virtual | ~WItemSelectionItem () |
Destruction. More... | |
std::string | getName () const |
Returns the name of the item. More... | |
std::string | getDescription () const |
The description of the item. More... | |
const char ** | getIcon () const |
The icon associated with this item. More... | |
template<typename T > | |
T * | getAs () |
Dynamic cast of the object, if a derivative of WItemSelectionItem was add to WItemSelection. More... | |
template<typename T > | |
const T * | getAs () const |
Dynamic cast of the object, if a derivative of WItemSelectionItem was add to WItemSelection. More... | |
bool | operator== (const WItemSelectionItem &other) const |
Compares this and another item using their names only. More... | |
Static Public Member Functions | |
static SPtr | create (T value, std::string name, std::string description="", const char **icon=NULL) |
Create a instance of the item. More... | |
Private Attributes | |
T | m_value |
Value which is stored by this item. More... | |
Additional Inherited Members | |
Protected Attributes inherited from WItemSelectionItem | |
std::string | m_name |
Item name. More... | |
std::string | m_description |
Item description. More... | |
const char ** | m_icon |
Item icon. More... | |
A derivation of WItemSelection which can store a value of any type.
the | type to encapsulate |
Definition at line 43 of file WItemSelectionItemTyped.h.
typedef std::shared_ptr< const WItemSelectionItemTyped< T > > WItemSelectionItemTyped< T >::ConstSPtr |
Abbreviation for a const shared pointer.
Definition at line 54 of file WItemSelectionItemTyped.h.
typedef std::shared_ptr< WItemSelectionItemTyped< T > > WItemSelectionItemTyped< T >::SPtr |
Abbreviation for a shared pointer.
Definition at line 49 of file WItemSelectionItemTyped.h.
typedef T WItemSelectionItemTyped< T >::ValueType |
The type of the value stored in here.
Definition at line 59 of file WItemSelectionItemTyped.h.
|
inline |
Constructs a new item with the specified values.
value | Value which is stored by the item. |
name | Name of item. |
description | Description, can be empty. |
icon | Icon, can be NULL. |
Definition at line 69 of file WItemSelectionItemTyped.h.
|
inlinevirtual |
|
inlinestatic |
Create a instance of the item.
This shortens the rather long call which would be needed to create a shared pointer of this class.
value | the value to store in the instance |
name | the name of item |
description | Description of the item. Can be empty. |
icon | the icon of the item. Can be NULL. |
Definition at line 92 of file WItemSelectionItemTyped.h.
Referenced by WFiberHandler::addFiber(), WFiberHandler::addFiberAt(), WFiberHandler::createProperties(), WColumnPropertyHandler::initializeSelectionItem(), WMProjectionsAsContext::properties(), WMTemplate::properties(), and WFiberHandler::toggleFiber().
|
inline |
Returns the value.
Definition at line 112 of file WItemSelectionItemTyped.h.
References WItemSelectionItemTyped< T >::m_value.
|
inline |
Returns the value.
This const version is especially useful when using reference types for T.
Definition at line 102 of file WItemSelectionItemTyped.h.
References WItemSelectionItemTyped< T >::m_value.
|
inline |
Sets a new value, which is associated with this item.
value | new value which should be stored by this item. |
Definition at line 122 of file WItemSelectionItemTyped.h.
References WItemSelectionItemTyped< T >::m_value.
|
private |
Value which is stored by this item.
Definition at line 131 of file WItemSelectionItemTyped.h.
Referenced by WItemSelectionItemTyped< T >::getValue(), and WItemSelectionItemTyped< T >::setValue().