#include <track.h>
Inheritance diagram for itunesdb::TrackPtrList:
Public Types | |
typedef Comparator< itunesdb::Track > | 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 | |
TrackPtrList () | |
Creates an empty TrackPtrList. | |
template<typename IterT> | |
TrackPtrList (IterT elements) | |
Creates a TrackPtrList and fills in the itunesdb::Track pointers returned by the given utils::RangeIterator. | |
bool | hasDirtyTracks () const |
Returns true if this list contains tracks not in sync with the database. | |
bool | hasRecentlyPlayedTracks () const |
Returns true if this list contains tracks being played after the last sync. | |
TrackPtrList * | getTracksBy (TrackPredicate &predicate, itunesdb::TrackPtrList &buffer) const |
Returns all the Tracks where the given predicate returned true. | |
Track * | findFirstTrackBy (TrackPredicate &predicate) const |
Returns the first Track where the given predicate returned true. | |
bool | removeIfTrue (TrackPredicate &predicate) |
Removes the elements the given predicate returns true. | |
bool | removeAllRefs (itunesdb::Track *track) |
Removes all references to the given track. | |
void | setDefaultSortOrder () |
Sets the sort order to default ( Artist/Album/Tracknumber ). | |
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 (itunesdb::Track *item) |
Inserts the given element accordingly to the comparator set by setComparator(). | |
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. | |
FilteredIterator< TUnaryPredicate > | filteredElements (const TUnaryPredicate &pred) |
Returns a FilteredIterator over those elements matching the given predicate. | |
FilteredConstIterator< TUnaryPredicate > | filteredElements (const TUnaryPredicate &pred) const |
Returns a FilteredConstIterator over those elements matching the given predicate. | |
void | append (itunesdb::Track *item) |
Appends the given element at the end of the container disregarding any comparator. | |
itunesdb::Track * | operator[] (unsigned int pos) const |
An operator to access the element at the given position. | |
itunesdb::Track *& | operator[] (unsigned int pos) |
An operator to access the element at the given position. | |
itunesdb::Track * | last () const |
Returns a pointer to the last element. | |
void | clear () |
Removes all elements. |
The default sort order is set to Artist - Album - tracknumber
itunesdb::TrackComparators for a collection of predefined comparators
typedef Comparator<itunesdb::Track > itunesdb::utils::SortablePtrVector< itunesdb::Track >::SortableVectorElemComparator [inherited] |
Comparator Type definition.
typedef QTPOD_SHARED_PTR_IMPL_DEF< SortableVectorElemComparator > itunesdb::utils::SortablePtrVector< itunesdb::Track >::ComparatorPtr [inherited] |
Shared Pointer type managing the pointer to the comparator.
typedef FilteredIterator itunesdb::utils::SortablePtrVector< itunesdb::Track >::Iterator [inherited] |
An unfiltered Iterator over all elements of this container.
typedef FilteredConstIterator itunesdb::utils::SortablePtrVector< itunesdb::Track >::ConstIterator [inherited] |
A const Iterator over all elements of this container.
RangeIterator
for more details
itunesdb::TrackPtrList::TrackPtrList | ( | ) |
Creates an empty TrackPtrList.
The default sort order ist set accordingly to setDefaultSortOrder()
itunesdb::TrackPtrList::TrackPtrList | ( | IterT | elements | ) | [inline] |
Creates a TrackPtrList and fills in the itunesdb::Track pointers returned by the given utils::RangeIterator.
The default sort order ist set accordingly to setDefaultSortOrder()
elements | the Tracks to be filled in to the list |
bool itunesdb::TrackPtrList::hasDirtyTracks | ( | ) | const |
Returns true if this list contains tracks not in sync with the database.
bool itunesdb::TrackPtrList::hasRecentlyPlayedTracks | ( | ) | const |
Returns true if this list contains tracks being played after the last sync.
TrackPtrList * itunesdb::TrackPtrList::getTracksBy | ( | TrackPredicate & | predicate, | |
itunesdb::TrackPtrList & | buffer | |||
) | const |
Returns all the Tracks where the given predicate returned true.
Track * itunesdb::TrackPtrList::findFirstTrackBy | ( | TrackPredicate & | predicate | ) | const |
Returns the first Track where the given predicate returned true.
The given trackpredicate needs to contain a method that gets a track, and returns a bool if it's the desired track
bool itunesdb::TrackPtrList::removeIfTrue | ( | TrackPredicate & | predicate | ) |
Removes the elements the given predicate returns true.
bool itunesdb::TrackPtrList::removeAllRefs | ( | itunesdb::Track * | track | ) |
Removes all references to the given track.
void itunesdb::TrackPtrList::setDefaultSortOrder | ( | ) |
Sets the sort order to default ( Artist/Album/Tracknumber ).
void itunesdb::utils::SortablePtrVector< itunesdb::Track >::setComparator | ( | SortableVectorElemComparator * | comparator | ) | [inline, inherited] |
Sets the comparator for this container to by used by sort() and inSort().
comparator | the comparator to be set. The pointer is owned by the container and will be deleted if a new comparator is set. |
void itunesdb::utils::SortablePtrVector< itunesdb::Track >::setComparator | ( | const ComparatorPtr & | comparator | ) | [inline, inherited] |
const ComparatorPtr& itunesdb::utils::SortablePtrVector< itunesdb::Track >::getComparator | ( | ) | const [inline, inherited] |
Returns the currently used comparator for sorting.
void itunesdb::utils::SortablePtrVector< itunesdb::Track >::sort | ( | ) | [inline, inherited] |
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< itunesdb::Track >::randomize | ( | ) | [inline, inherited] |
Randomizes the order of the elements.
unsigned int itunesdb::utils::SortablePtrVector< itunesdb::Track >::inSort | ( | itunesdb::Track * | item | ) | [inline, inherited] |
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< itunesdb::Track >::addAll | ( | IterT | elemIter | ) | [inline, inherited] |
Adds all elements delivered by the given Iterator.
bool itunesdb::utils::SortablePtrVector< itunesdb::Track >::remove | ( | unsigned int | pos | ) | [inline, inherited] |
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< itunesdb::Track >::count | ( | ) | const [inline, inherited] |
Returns the number of elements,.
bool itunesdb::utils::SortablePtrVector< itunesdb::Track >::isEmpty | ( | ) | const [inline, inherited] |
Returns true if the number of elements is zero meaning the container is empty, false otherwise.
Iterator itunesdb::utils::SortablePtrVector< itunesdb::Track >::iterator | ( | ) | [inline, inherited] |
Returns a SortablePtrVector::Iterator
over all elements of this Container.
SortablePtrVector::Iterator
over all elements of this Container ConstIterator itunesdb::utils::SortablePtrVector< itunesdb::Track >::iterator | ( | ) | const [inline, inherited] |
Returns a SortablePtrVector::ConstIterator
over all elements of this Container.
SortablePtrVector::ConstIterator
over all elements of this Container ConstIterator itunesdb::utils::SortablePtrVector< itunesdb::Track >::const_iterator | ( | ) | const [inline, inherited] |
Returns a SortablePtrVector::ConstIterator
over all elements of this Container.
SortablePtrVector::ConstIterator
over all elements of this Container FilteredIterator<TUnaryPredicate> itunesdb::utils::SortablePtrVector< itunesdb::Track >::filteredElements | ( | const TUnaryPredicate & | pred | ) | [inline, inherited] |
Returns a FilteredIterator over those elements matching the given predicate.
pred | the predicate used for filtering |
FilteredConstIterator<TUnaryPredicate> itunesdb::utils::SortablePtrVector< itunesdb::Track >::filteredElements | ( | const TUnaryPredicate & | pred | ) | const [inline, inherited] |
Returns a FilteredConstIterator over those elements matching the given predicate.
pred | the predicate used for filtering |
void itunesdb::utils::SortablePtrVector< itunesdb::Track >::append | ( | itunesdb::Track * | item | ) | [inline, inherited] |
Appends the given element at the end of the container disregarding any comparator.
item | the element to be appended. |
itunesdb::Track * itunesdb::utils::SortablePtrVector< itunesdb::Track >::operator[] | ( | unsigned int | pos | ) | const [inline, inherited] |
An operator to access the element at the given position.
pos | the position of the element to be returned |
itunesdb::Track *& itunesdb::utils::SortablePtrVector< itunesdb::Track >::operator[] | ( | unsigned int | pos | ) | [inline, inherited] |
An operator to access the element at the given position.
pos | the position of the element to be returned |
itunesdb::Track * itunesdb::utils::SortablePtrVector< itunesdb::Track >::last | ( | ) | const [inline, inherited] |
Returns a pointer to the last element.
void itunesdb::utils::SortablePtrVector< itunesdb::Track >::clear | ( | ) | [inline, inherited] |
Removes all elements.