![]() |
Miam-Player
0.8.0
A nice music player
|
A generic, implicitly shared list. More...
#include <tlist.h>
Public Types | |
typedef std::list< T >::iterator | Iterator |
typedef std::list< T >::const_iterator | ConstIterator |
Public Member Functions | |
List () | |
Constructs an empty list. More... | |
List (const List< T > &l) | |
Make a shallow, implicitly shared, copy of l. More... | |
virtual | ~List () |
Destroys this List instance. More... | |
Iterator | begin () |
Returns an STL style iterator to the beginning of the list. More... | |
ConstIterator | begin () const |
Returns an STL style constant iterator to the beginning of the list. More... | |
Iterator | end () |
Returns an STL style iterator to the end of the list. More... | |
ConstIterator | end () const |
Returns an STL style constant iterator to the end of the list. More... | |
Iterator | insert (Iterator it, const T &value) |
Inserts a copy of value before it. More... | |
List< T > & | sortedInsert (const T &value, bool unique=false) |
Inserts the value into the list. More... | |
List< T > & | append (const T &item) |
Appends item to the end of the list and returns a reference to the list. More... | |
List< T > & | append (const List< T > &l) |
Appends all of the values in l to the end of the list and returns a reference to the list. More... | |
List< T > & | prepend (const T &item) |
Prepends item to the beginning list and returns a reference to the list. More... | |
List< T > & | prepend (const List< T > &l) |
Prepends all of the items in l to the beginning list and returns a reference to the list. More... | |
List< T > & | clear () |
Clears the list. More... | |
unsigned int | size () const |
Returns the number of elements in the list. More... | |
bool | isEmpty () const |
Returns whether or not the list is empty. More... | |
Iterator | find (const T &value) |
Find the first occurrence of value. More... | |
ConstIterator | find (const T &value) const |
Find the first occurrence of value. More... | |
bool | contains (const T &value) const |
Returns true if the list contains value. More... | |
Iterator | erase (Iterator it) |
Erase the item at it from the list. More... | |
const T & | front () const |
Returns a reference to the first item in the list. More... | |
T & | front () |
Returns a reference to the first item in the list. More... | |
const T & | back () const |
Returns a reference to the last item in the list. More... | |
T & | back () |
Returns a reference to the last item in the list. More... | |
void | setAutoDelete (bool autoDelete) |
Auto delete the members of the list when the last reference to the list passes out of scope. More... | |
T & | operator[] (unsigned int i) |
Returns a reference to item i in the list. More... | |
const T & | operator[] (unsigned int i) const |
Returns a const reference to item i in the list. More... | |
List< T > & | operator= (const List< T > &l) |
Make a shallow, implicitly shared, copy of l. More... | |
bool | operator== (const List< T > &l) const |
Compares this list with l and returns true if all of the elements are the same. More... | |
bool | operator!= (const List< T > &l) const |
Compares this list with l and returns true if the lists differ. More... | |
Protected Member Functions | |
void | detach () |
A generic, implicitly shared list.
This is basic generic list that's somewhere between a std::list and a QValueList. This class is implicitly shared. For example:
The above example is very cheap. This also makes lists suitable for the return types of functions. The above example will just copy a pointer rather than copying the data in the list. When your shared list's data changes, only then will the data be copied.
typedef std::list<T>::const_iterator TagLib::List< T >::ConstIterator |
typedef std::list<T>::iterator TagLib::List< T >::Iterator |
TagLib::List< T >::List | ( | ) |
Constructs an empty list.
TagLib::List< T >::List | ( | const List< T > & | l | ) |
Make a shallow, implicitly shared, copy of l.
Because this is implicitly shared, this method is lightweight and suitable for pass-by-value usage.
|
virtual |
Destroys this List instance.
If auto deletion is enabled and this list contains a pointer type all of the members are also deleted.
List<T>& TagLib::List< T >::append | ( | const T & | item | ) |
Appends item to the end of the list and returns a reference to the list.
List<T>& TagLib::List< T >::append | ( | const List< T > & | l | ) |
Appends all of the values in l to the end of the list and returns a reference to the list.
const T& TagLib::List< T >::back | ( | ) | const |
Returns a reference to the last item in the list.
T& TagLib::List< T >::back | ( | ) |
Returns a reference to the last item in the list.
Iterator TagLib::List< T >::begin | ( | ) |
Returns an STL style iterator to the beginning of the list.
See std::list::const_iterator for the semantics.
ConstIterator TagLib::List< T >::begin | ( | ) | const |
Returns an STL style constant iterator to the beginning of the list.
See std::list::iterator for the semantics.
List<T>& TagLib::List< T >::clear | ( | ) |
Clears the list.
If auto deletion is enabled and this list contains a pointer type the members are also deleted.
bool TagLib::List< T >::contains | ( | const T & | value | ) | const |
Returns true if the list contains value.
|
protected |
Iterator TagLib::List< T >::end | ( | ) |
Returns an STL style iterator to the end of the list.
See std::list::iterator for the semantics.
ConstIterator TagLib::List< T >::end | ( | ) | const |
Returns an STL style constant iterator to the end of the list.
See std::list::const_iterator for the semantics.
Iterator TagLib::List< T >::erase | ( | Iterator | it | ) |
Erase the item at it from the list.
Iterator TagLib::List< T >::find | ( | const T & | value | ) |
Find the first occurrence of value.
ConstIterator TagLib::List< T >::find | ( | const T & | value | ) | const |
Find the first occurrence of value.
const T& TagLib::List< T >::front | ( | ) | const |
Returns a reference to the first item in the list.
T& TagLib::List< T >::front | ( | ) |
Returns a reference to the first item in the list.
Iterator TagLib::List< T >::insert | ( | Iterator | it, |
const T & | value | ||
) |
Inserts a copy of value before it.
bool TagLib::List< T >::isEmpty | ( | ) | const |
Returns whether or not the list is empty.
bool TagLib::List< T >::operator!= | ( | const List< T > & | l | ) | const |
Compares this list with l and returns true if the lists differ.
List<T>& TagLib::List< T >::operator= | ( | const List< T > & | l | ) |
Make a shallow, implicitly shared, copy of l.
Because this is implicitly shared, this method is lightweight and suitable for pass-by-value usage.
bool TagLib::List< T >::operator== | ( | const List< T > & | l | ) | const |
Compares this list with l and returns true if all of the elements are the same.
T& TagLib::List< T >::operator[] | ( | unsigned int | i | ) |
Returns a reference to item i in the list.
const T& TagLib::List< T >::operator[] | ( | unsigned int | i | ) | const |
Returns a const reference to item i in the list.
List<T>& TagLib::List< T >::prepend | ( | const T & | item | ) |
Prepends item to the beginning list and returns a reference to the list.
List<T>& TagLib::List< T >::prepend | ( | const List< T > & | l | ) |
Prepends all of the items in l to the beginning list and returns a reference to the list.
void TagLib::List< T >::setAutoDelete | ( | bool | autoDelete | ) |
Auto delete the members of the list when the last reference to the list passes out of scope.
This will have no effect on lists which do not contain a pointer type.
unsigned int TagLib::List< T >::size | ( | ) | const |
Returns the number of elements in the list.
List<T>& TagLib::List< T >::sortedInsert | ( | const T & | value, |
bool | unique = false |
||
) |
Inserts the value into the list.
This assumes that the list is currently sorted. If unique is true then the value will not be inserted if it is already in the list.