#include <utils.h>
Public Types | |
typedef Comparator< ElemType > | SortableVectorElemComparator |
Comparator Type definition. | |
typedef QTPOD_SHARED_PTR_IMPL_DEF< SortableVectorElemComparator > | ComparatorPtr |
Shared Pointer type managing the pointer to the comparator. | |
typedef FilteredIterator | Iterator |
typedef FilteredConstIterator | ConstIterator |
Public Member Functions | |
SortablePtrVector (bool deleteElements=false) | |
template<typename IterT> | |
SortablePtrVector (IterT elements, bool deleteElements=false) | |
Creates a sortable vector storing pointers to its elements and fills in the objects returned by the given iterator. | |
void | setComparator (SortableVectorElemComparator *comparator) |
Sets the comparator for this container to by used by sort() and inSort(). | |
void | setComparator (const ComparatorPtr &comparator) |
Sets the comparator for this container to by used by sort() and inSort(). | |
const ComparatorPtr & | getComparator () const |
Returns the currently used comparator for sorting. | |
void | sort () |
Sorts the containers element using the comparator set by setComparator(). | |
void | randomize () |
Randomizes the order of the elements. | |
unsigned int | inSort (ElemType *item) |
Inserts the given element accordingly to the comparator set by setComparator(). | |
template<typename IterT> | |
void | addAll (IterT elemIter) |
Adds all elements delivered by the given Iterator. | |
bool | remove (unsigned int pos) |
Removes the element at the given position from the container. | |
unsigned int | count () const |
Returns the number of elements,. | |
bool | isEmpty () const |
Returns true if the number of elements is zero meaning the container is empty, false otherwise. | |
Iterator | iterator () |
Returns a SortablePtrVector::Iterator over all elements of this Container. | |
ConstIterator | iterator () const |
Returns a SortablePtrVector::ConstIterator over all elements of this Container. | |
ConstIterator | const_iterator () const |
Returns a SortablePtrVector::ConstIterator over all elements of this Container. | |
template<typename TUnaryPredicate> | |
FilteredIterator< TUnaryPredicate > | filteredElements (const TUnaryPredicate &pred) |
Returns a FilteredIterator over those elements matching the given predicate. | |
template<typename TUnaryPredicate> | |
FilteredConstIterator< TUnaryPredicate > | filteredElements (const TUnaryPredicate &pred) const |
Returns a FilteredConstIterator over those elements matching the given predicate. | |
void | append (ElemType *item) |
Appends the given element at the end of the container disregarding any comparator. | |
ElemType * | operator[] (unsigned int pos) const |
An operator to access the element at the given position. | |
ElemType *& | operator[] (unsigned int pos) |
An operator to access the element at the given position. | |
ElemType * | last () const |
Returns a pointer to the last element. | |
void | clear () |
Removes all elements. | |
Classes | |
class | ContainerVersionAwareIterator |
struct | FilteredConstIterator |
class | FilteredIterator |
struct | FindFirstNotLessThan |
struct | SmallerBinaryPredicate |
typedef Comparator<ElemType> itunesdb::utils::SortablePtrVector< ElemType >::SortableVectorElemComparator |
Comparator Type definition.
typedef QTPOD_SHARED_PTR_IMPL_DEF< SortableVectorElemComparator > itunesdb::utils::SortablePtrVector< ElemType >::ComparatorPtr |
Shared Pointer type managing the pointer to the comparator.
typedef FilteredIterator itunesdb::utils::SortablePtrVector< ElemType >::Iterator |
An unfiltered Iterator over all elements of this container.
typedef FilteredConstIterator itunesdb::utils::SortablePtrVector< ElemType >::ConstIterator |
A const Iterator over all elements of this container.
RangeIterator
for more details
itunesdb::utils::SortablePtrVector< ElemType >::SortablePtrVector | ( | bool | deleteElements = false |
) | [inline] |
Creates a sortable vector storing pointers to its elements.
deleteElements | if true the container will delete elements being removed from this container. |
itunesdb::utils::SortablePtrVector< ElemType >::SortablePtrVector | ( | IterT | elements, | |
bool | deleteElements = false | |||
) | [inline] |
Creates a sortable vector storing pointers to its elements and fills in the objects returned by the given iterator.
elements | the elements to be filled in to the container | |
deleteElements | if true the container will delete elements being removed from this container. |
void itunesdb::utils::SortablePtrVector< ElemType >::setComparator | ( | SortableVectorElemComparator * | comparator | ) | [inline] |
void itunesdb::utils::SortablePtrVector< ElemType >::setComparator | ( | const ComparatorPtr & | comparator | ) | [inline] |
const ComparatorPtr& itunesdb::utils::SortablePtrVector< ElemType >::getComparator | ( | ) | const [inline] |
Returns the currently used comparator for sorting.
void itunesdb::utils::SortablePtrVector< ElemType >::sort | ( | ) | [inline] |
Sorts the containers element using the comparator set by setComparator().
If no comparator has been set the order is kept unchanged.
void itunesdb::utils::SortablePtrVector< ElemType >::randomize | ( | ) | [inline] |
Randomizes the order of the elements.
unsigned int itunesdb::utils::SortablePtrVector< ElemType >::inSort | ( | ElemType * | item | ) | [inline] |
Inserts the given element accordingly to the comparator set by setComparator().
If no comparator has been set the element will be appended at the end.
item | the element to be inserted |
void itunesdb::utils::SortablePtrVector< ElemType >::addAll | ( | IterT | elemIter | ) | [inline] |
Adds all elements delivered by the given Iterator.
bool itunesdb::utils::SortablePtrVector< ElemType >::remove | ( | unsigned int | pos | ) | [inline] |
Removes the element at the given position from the container.
If the container was created with deleteElements set to true the element will be deleted.
pos | the position of the element to be removed. |
unsigned int itunesdb::utils::SortablePtrVector< ElemType >::count | ( | ) | const [inline] |
Returns the number of elements,.
bool itunesdb::utils::SortablePtrVector< ElemType >::isEmpty | ( | ) | const [inline] |
Returns true if the number of elements is zero meaning the container is empty, false otherwise.
Iterator itunesdb::utils::SortablePtrVector< ElemType >::iterator | ( | ) | [inline] |
Returns a SortablePtrVector::Iterator
over all elements of this Container.
SortablePtrVector::Iterator
over all elements of this Container ConstIterator itunesdb::utils::SortablePtrVector< ElemType >::iterator | ( | ) | const [inline] |
Returns a SortablePtrVector::ConstIterator
over all elements of this Container.
SortablePtrVector::ConstIterator
over all elements of this Container ConstIterator itunesdb::utils::SortablePtrVector< ElemType >::const_iterator | ( | ) | const [inline] |
Returns a SortablePtrVector::ConstIterator
over all elements of this Container.
SortablePtrVector::ConstIterator
over all elements of this Container FilteredIterator<TUnaryPredicate> itunesdb::utils::SortablePtrVector< ElemType >::filteredElements | ( | const TUnaryPredicate & | pred | ) | [inline] |
Returns a FilteredIterator over those elements matching the given predicate.
pred | the predicate used for filtering |
FilteredConstIterator<TUnaryPredicate> itunesdb::utils::SortablePtrVector< ElemType >::filteredElements | ( | const TUnaryPredicate & | pred | ) | const [inline] |
Returns a FilteredConstIterator over those elements matching the given predicate.
pred | the predicate used for filtering |
void itunesdb::utils::SortablePtrVector< ElemType >::append | ( | ElemType * | item | ) | [inline] |
Appends the given element at the end of the container disregarding any comparator.
item | the element to be appended. |
ElemType* itunesdb::utils::SortablePtrVector< ElemType >::operator[] | ( | unsigned int | pos | ) | const [inline] |
An operator to access the element at the given position.
pos | the position of the element to be returned |
ElemType*& itunesdb::utils::SortablePtrVector< ElemType >::operator[] | ( | unsigned int | pos | ) | [inline] |
An operator to access the element at the given position.
pos | the position of the element to be returned |
ElemType* itunesdb::utils::SortablePtrVector< ElemType >::last | ( | ) | const [inline] |
Returns a pointer to the last element.
void itunesdb::utils::SortablePtrVector< ElemType >::clear | ( | ) | [inline] |
Removes all elements.