OpenWalnut  1.2.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Friends
WItemSelection Class Reference

A class containing a list of named items. More...

#include <WItemSelection.h>

+ Inheritance diagram for WItemSelection:

List of all members.

Public Types

typedef boost::shared_ptr
< WItemSelection
SPtr
 Convenience typedef for a boost::shared_ptr< WItemSelection >
typedef boost::shared_ptr
< const WItemSelection
ConstSPtr
 Convenience typedef for a boost::shared_ptr< const WItemSelection >
- Public Types inherited from WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >
typedef std::vector
< boost::shared_ptr
< WItemSelectionItem >
>::const_iterator 
ConstIterator
 A typedef for the correct const iterator useful to traverse this sequence container.
typedef std::vector
< boost::shared_ptr
< WItemSelectionItem >
>::iterator 
Iterator
 A typedef for the correct iterator to traverse this sequence container.
typedef std::vector
< boost::shared_ptr
< WItemSelectionItem >
>::value_type 
value_type
 The type of the elements.
- Public Types inherited from WSharedObject< std::vector< boost::shared_ptr< WItemSelectionItem > > >
typedef boost::shared_ptr
< WSharedObjectTicketRead
< std::vector
< boost::shared_ptr
< WItemSelectionItem > > > > 
ReadTicket
 Type for read tickets.
typedef boost::shared_ptr
< WSharedObjectTicketWrite
< std::vector
< boost::shared_ptr
< WItemSelectionItem > > > > 
WriteTicket
 Type for write tickets.

Public Member Functions

 WItemSelection ()
 Default constructor.
virtual ~WItemSelection ()
 Destructor.
virtual WItemSelector getSelectorAll ()
 Creates an default selection (all items selected).
virtual WItemSelector getSelectorNone ()
 Creates an default selection (no items selected).
virtual WItemSelector getSelectorFirst ()
 Creates an default selection (first item selected).
virtual WItemSelector getSelectorLast ()
 Creates an default selection (last item selected).
virtual WItemSelector getSelector (size_t item)
 Creates an default selection (a specified items selected).
void addItem (std::string name, std::string description="", const char **icon=NULL)
 Convenience method to add a new item.
- Public Member Functions inherited from WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >
 WSharedSequenceContainer ()
 Default constructor.
virtual ~WSharedSequenceContainer ()
 Destructor.
void push_back (const typename std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type &x)
 Adds a new element at the end of the container.
void push_front (const typename std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type &x)
 Adds a new element at the beginning of the container.
void pop_back ()
 Removes an element from the end.
void clear ()
 Clears the container.
size_t size () const
 The size of the container.
std::vector< boost::shared_ptr
< WItemSelectionItem >
>::value_type
operator[] (size_t n)
 Get item at position n.
const std::vector
< boost::shared_ptr
< WItemSelectionItem >
>::value_type
operator[] (size_t n) const
 Get item at position n.
std::vector< boost::shared_ptr
< WItemSelectionItem >
>::value_type
at (size_t n)
 Get item at position n.
const std::vector
< boost::shared_ptr
< WItemSelectionItem >
>::value_type
at (size_t n) const
 Get item at position n.
void remove (const typename std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type &element)
 Searches and removes the specified element.
WSharedSequenceContainer
< std::vector
< boost::shared_ptr
< WItemSelectionItem >
> >::Iterator 
erase (typename WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator position)
 Erase the element at the specified position.
WSharedSequenceContainer
< std::vector
< boost::shared_ptr
< WItemSelectionItem >
> >::Iterator 
erase (typename WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator first, typename WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator last)
 Erase the specified range of elements.
void replace (const typename std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type &oldValue, const typename std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type &newValue)
 Replaces the specified old value by a new one.
size_t count (const value_type &value)
 Counts the number of occurrences of the specified value inside the container.
void sort (Comparator comp)
 Resorts the container using the specified comparator from its begin to its end.
void sort (typename WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator first, typename WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator last, Comparator comp)
 Resorts the container using the specified comparator between [first,last) in ascending order.
WSharedSequenceContainer
< std::vector
< boost::shared_ptr
< WItemSelectionItem >
> >::Iterator 
find (typename WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator first, typename WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::Iterator last, const typename std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type &value)
 Searches the specified value in the range [first,last).
WSharedSequenceContainer
< std::vector
< boost::shared_ptr
< WItemSelectionItem >
> >::ConstIterator 
find (const typename std::vector< boost::shared_ptr< WItemSelectionItem > >::value_type &value)
 Searches the specified value in the range [begin,end).
- Public Member Functions inherited from WSharedObject< std::vector< boost::shared_ptr< WItemSelectionItem > > >
 WSharedObject ()
 Default constructor.
virtual ~WSharedObject ()
 Destructor.
ReadTicket getReadTicket () const
 Returns a ticket to get read access to the contained data.
WriteTicket getWriteTicket (bool suppressNotify=false) const
 Returns a ticket to get write access to the contained data.
boost::shared_ptr< WConditiongetChangeCondition () const
 This condition fires whenever the encapsulated object changed.

Static Public Member Functions

static boost::shared_ptr
< WItemSelectionItem
Item (std::string name, std::string description="", const char **icon=NULL)
 Convenience method to create a new item.

Friends

class WItemSelector

Detailed Description

A class containing a list of named items.

It is mainly a container for an std::vector but with the difference that there can be so called Selectors which are able to select some subset of the item set. This is especially useful in properties where item selection is needed. The class is kept very restrictive to keep the interface clean and sleek and to keep the item set consistent among several threads. So please do not implement any function that might change the item list, use the provided ones. If the item list changes, existing selectors get invalid automatically using the change condition of the inherited WSharedSequenceContainer.

Definition at line 50 of file WItemSelection.h.


Member Typedef Documentation

typedef boost::shared_ptr< const WItemSelection > WItemSelection::ConstSPtr

Convenience typedef for a boost::shared_ptr< const WItemSelection >

Definition at line 63 of file WItemSelection.h.

typedef boost::shared_ptr< WItemSelection > WItemSelection::SPtr

Convenience typedef for a boost::shared_ptr< WItemSelection >

Definition at line 58 of file WItemSelection.h.


Constructor & Destructor Documentation

WItemSelection::WItemSelection ( )

Default constructor.

Definition at line 36 of file WItemSelection.cpp.

WItemSelection::~WItemSelection ( )
virtual

Destructor.

Definition at line 42 of file WItemSelection.cpp.


Member Function Documentation

void WItemSelection::addItem ( std::string  name,
std::string  description = "",
const char **  icon = NULL 
)

Convenience method to add a new item.

Parameters:
namename of the item
descriptionthe description, can be empty
iconthe icon, can be NULL

Definition at line 103 of file WItemSelection.cpp.

References WSharedSequenceContainer< std::vector< boost::shared_ptr< WItemSelectionItem > > >::push_back().

WItemSelector WItemSelection::getSelector ( size_t  item)
virtual

Creates an default selection (a specified items selected).

The selector gets invalid if another item is added.

Parameters:
itemthe item to select.
Returns:
an selector.

Definition at line 90 of file WItemSelection.cpp.

References WSharedObject< std::vector< boost::shared_ptr< WItemSelectionItem > > >::getReadTicket().

WItemSelector WItemSelection::getSelectorAll ( )
virtual

Creates an default selection (all items selected).

The selector gets invalid if another item is added.

Returns:
an selector.

Definition at line 47 of file WItemSelection.cpp.

References WSharedObject< std::vector< boost::shared_ptr< WItemSelectionItem > > >::getReadTicket().

WItemSelector WItemSelection::getSelectorFirst ( )
virtual

Creates an default selection (first item selected).

The selector gets invalid if another item is added.

Returns:
an selector.

Definition at line 66 of file WItemSelection.cpp.

References WSharedObject< std::vector< boost::shared_ptr< WItemSelectionItem > > >::getReadTicket().

WItemSelector WItemSelection::getSelectorLast ( )
virtual

Creates an default selection (last item selected).

The selector gets invalid if another item is added.

Returns:
an selector.

Definition at line 78 of file WItemSelection.cpp.

References WSharedObject< std::vector< boost::shared_ptr< WItemSelectionItem > > >::getReadTicket().

WItemSelector WItemSelection::getSelectorNone ( )
virtual

Creates an default selection (no items selected).

The selector gets invalid if another item is added.

Returns:
an selector.

Definition at line 59 of file WItemSelection.cpp.

References WSharedObject< std::vector< boost::shared_ptr< WItemSelectionItem > > >::getReadTicket().

static boost::shared_ptr< WItemSelectionItem > WItemSelection::Item ( std::string  name,
std::string  description = "",
const char **  icon = NULL 
)
inlinestatic

Convenience method to create a new item.

Parameters:
namename of the item
descriptionthe description, can be empty
iconthe icon, can be NULL
Returns:
the Item.

Definition at line 121 of file WItemSelection.h.


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