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