25 #ifndef WITEMSELECTOR_H
26 #define WITEMSELECTOR_H
34 #include <boost/shared_ptr.hpp>
37 #include <boost/signals2/signal.hpp>
40 #include "WItemSelection.h"
41 #include "WItemSelectionItem.h"
153 std::ostream&
operator<<( std::ostream& out )
const;
160 virtual size_t sizeAll()
const;
167 virtual size_t size()
const;
174 virtual bool empty()
const;
184 virtual const boost::shared_ptr< WItemSelectionItem >
atAll(
size_t index )
const;
194 virtual const boost::shared_ptr< WItemSelectionItem >
at(
size_t index )
const;
231 operator unsigned int()
const;
248 WItemSelector( boost::shared_ptr< WItemSelection > selection, IndexList selected );
299 std::ostream& operator<<( std::ostream& out,
const WItemSelector& other );
301 #endif // WITEMSELECTOR_H
IndexList getIndexList() const
Casts the selector to a list of indices currently selected.
WItemSelector newSelector() const
Creates a new selector, but basing on this instance as old one.
virtual size_t size() const
The number of selected items.
virtual size_t getItemIndexOfSelected(size_t index) const
Helps to get the index of an selected item in the WItemSelection.
std::vector< size_t > IndexList
The type used for storing index lists.
bool m_valid
If true the selector is valid.
void invalidate()
Handles the case of invalidation.
IndexList m_selected
The list of items currently selected.
virtual bool empty() const
True if the selection is empty.
virtual const boost::shared_ptr< WItemSelectionItem > at(size_t index) const
Gets the selected item with the given index.
std::ostream & operator<<(std::ostream &out) const
Write a selection in string representation to the given output stream.
virtual size_t sizeAll() const
Gives the count of elements in the set of selectable items.
WItemSelector createSelector(const IndexList &selected) const
Creates a new selector instance using the specified index list.
A class containing a list of named items.
WItemSelection::ReadTicket m_lock
This locks prevents the selection to be modified during selector iteration.
This class represents a subset of a WItemSelection.
boost::shared_ptr< WItemSelection > m_selection
The selection handled by this selector.
virtual const boost::shared_ptr< WItemSelectionItem > atAll(size_t index) const
Gets the item with the given index from the WItemSelection.
WItemSelector(const WItemSelector &other)
Copy constructor.
virtual bool isValid() const
Checks whether the selection is valid anymore.
void unlock()
Unlocks the selection again.
bool operator==(const WItemSelector &other) const
Compares two selector.
virtual ~WItemSelector()
Destructor.
void lock()
Read locks the underlying selection.
boost::signals2::connection m_invalidateSignalConnection
Stores the connection made using WItemSelection::subscribeInvalidateSignal.
boost::shared_ptr< WSharedObjectTicketRead< std::vector< boost::shared_ptr< WItemSelectionItem > > > > ReadTicket
Type for read tickets.
WItemSelector & operator=(const WItemSelector &other)
Copy assignment.