TagLib::List< T > Class Template Reference
A generic, implicitly shared list.
More...
#include <tlist.h>
Inheritance diagram for TagLib::List< T >:
[legend]List of all members.
Detailed Description
template<class T>
class TagLib::List< T >
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.
Constructor & Destructor Documentation
|
Constructs an empty list. |
|
Make a shallow, implicitly shared, copy of l. Because this is implicitly shared, this method is lightweight and suitable for pass-by-value usage. |
|
Destroys this List instance. If auto deletion is enabled and this list contains a pointer type all of the memebers are also deleted. |
Member Function Documentation
|
Appends all of the values in l to the end of the list and returns a reference to the list. |
|
Appends item to the end of the list and returns a reference to the list.
Reimplemented in TagLib::StringList. |
|
Returns a reference to the last item in the list. |
template<class T> |
const T& TagLib::List< T >::back |
( |
|
) |
const |
|
|
Returns a reference to the last item in the list. |
template<class T> |
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. |
|
Returns an STL style iterator to the beginning of the list. See std::list::const_iterator for the semantics. |
|
Clears the list. If auto deletion is enabled and this list contains a pointer type the members are also deleted.
- See also:
- setAutoDelete()
|
template<class T> |
bool TagLib::List< T >::contains |
( |
const T & |
value |
) |
const |
|
|
Returns true if the list contains value. |
template<class T> |
void TagLib::List< T >::detach |
( |
|
) |
[protected] |
|
template<class T> |
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. |
|
Returns an STL style iterator to the end of the list. See std::list::iterator for the semantics. |
template<class T> |
void TagLib::List< T >::erase |
( |
Iterator |
it |
) |
|
|
|
Erase the item at it from the list. |
template<class T> |
ConstIterator TagLib::List< T >::find |
( |
const T & |
value |
) |
const |
|
|
Find the first occurance of value. |
template<class T> |
Iterator TagLib::List< T >::find |
( |
const T & |
value |
) |
|
|
|
Find the first occurance of value. |
|
Returns a reference to the first item in the list. |
template<class T> |
const T& TagLib::List< T >::front |
( |
|
) |
const |
|
|
Returns a reference to the first item in the list. |
template<class T> |
void TagLib::List< T >::insert |
( |
Iterator |
it, |
|
|
const T & |
value |
|
) |
|
|
|
Inserts a copy of value before it. |
|
Make a shallow, implicitly shared, copy of l. Because this is implicitly shared, this method is lightweight and suitable for pass-by-value usage. |
template<class T> |
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. |
|
Returns a const reference to item i in the list.
- Warning:
- This method is slow. Use iterators to loop through the list.
|
|
Returns a reference to item i in the list.
- Warning:
- This method is slow. Use iterators to loop through the list.
|
template<class T> |
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.
- Note:
- This relies on partial template instantiation -- most modern C++ compilers should now support this.
|
|
Returns the number of elements in the list. |
template<class T> |
void 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. |
The documentation for this class was generated from the following file: