tlist.h
Go to the documentation of this file.
1/***************************************************************************
2 copyright : (C) 2002 - 2008 by Scott Wheeler
3 email : wheeler@kde.org
4 ***************************************************************************/
5
6/***************************************************************************
7 * This library is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU Lesser General Public License version *
9 * 2.1 as published by the Free Software Foundation. *
10 * *
11 * This library is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * Lesser General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with this library; if not, write to the Free Software *
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
19 * 02110-1301 USA *
20 * *
21 * Alternatively, this file is available under the Mozilla Public *
22 * License Version 1.1. You may obtain a copy of the License at *
23 * http://www.mozilla.org/MPL/ *
24 ***************************************************************************/
25
26#ifndef TAGLIB_LIST_H
27#define TAGLIB_LIST_H
28
29#include "taglib.h"
30
31#include <list>
32
33namespace TagLib {
34
36
53 template <class T> class List
54 {
55 public:
56#ifndef DO_NOT_DOCUMENT
57 typedef typename std::list<T>::iterator Iterator;
58 typedef typename std::list<T>::const_iterator ConstIterator;
59#endif
60
65
71 List(const List<T> &l);
72
77 virtual ~List();
78
83 Iterator begin();
84
89 ConstIterator begin() const;
90
95 Iterator end();
96
101 ConstIterator end() const;
102
106 Iterator insert(Iterator it, const T &value);
107
113 List<T> &sortedInsert(const T &value, bool unique = false);
114
119 List<T> &append(const T &item);
120
126
131 List<T> &prepend(const T &item);
132
138
146
152 unsigned int size() const;
153
159 bool isEmpty() const;
160
164 Iterator find(const T &value);
165
169 ConstIterator find(const T &value) const;
170
174 bool contains(const T &value) const;
175
179 Iterator erase(Iterator it);
180
184 const T &front() const;
185
189 T &front();
190
194 const T &back() const;
195
199 T &back();
200
209 void setAutoDelete(bool autoDelete);
210
216 T &operator[](unsigned int i);
217
223 const T &operator[](unsigned int i) const;
224
231
236 bool operator==(const List<T> &l) const;
237
241 bool operator!=(const List<T> &l) const;
242
243 protected:
244 /*
245 * If this List is being shared via implicit sharing, do a deep copy of the
246 * data and separate from the shared members. This should be called by all
247 * non-const subclass members.
248 */
249 void detach();
250
251 private:
252#ifndef DO_NOT_DOCUMENT
253 template <class TP> class ListPrivate;
254 ListPrivate<T> *d;
255#endif
256 };
257
258}
259
260// Since GCC doesn't support the "export" keyword, we have to include the
261// implementation.
262
263#include "tlist.tcc"
264
265#endif
A generic, implicitly shared list.
Definition: tlist.h:54
T & operator[](unsigned int i)
List< T > & operator=(const List< T > &l)
List(const List< T > &l)
List< T > & sortedInsert(const T &value, bool unique=false)
Iterator erase(Iterator it)
List< T > & append(const T &item)
virtual ~List()
const T & front() const
Iterator begin()
ConstIterator find(const T &value) const
List< T > & clear()
void setAutoDelete(bool autoDelete)
Iterator find(const T &value)
const T & operator[](unsigned int i) const
Iterator insert(Iterator it, const T &value)
List< T > & prepend(const T &item)
List< T > & append(const List< T > &l)
ConstIterator begin() const
List< T > & prepend(const List< T > &l)
unsigned int size() const
bool operator==(const List< T > &l) const
const T & back() const
ConstIterator end() const
bool contains(const T &value) const
Iterator end()
bool isEmpty() const
bool operator!=(const List< T > &l) const
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41