TagLib API Documentation
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 <list>
30#include <initializer_list>
31#include <memory>
32
33namespace TagLib {
34
36
53 template <class T> class List
54 {
55 public:
56#ifndef DO_NOT_DOCUMENT
57 using Iterator = typename std::list<T>::iterator;
58 using ConstIterator = typename std::list<T>::const_iterator;
59#endif
60
65
71 List(const List<T> &l);
72
76 List(std::initializer_list<T> init);
77
83
88 Iterator begin();
89
94 ConstIterator begin() const;
95
100 ConstIterator cbegin() const;
101
106 Iterator end();
107
112 ConstIterator end() const;
113
118 ConstIterator cend() const;
119
127 Iterator insert(Iterator it, const T &item);
128
134 List<T> &sortedInsert(const T &value, bool unique = false);
135
140 List<T> &append(const T &item);
141
147
152 List<T> &prepend(const T &item);
153
159
167
173 unsigned int size() const;
174
180 bool isEmpty() const;
181
185 Iterator find(const T &value);
186
190 ConstIterator find(const T &value) const;
191
195 ConstIterator cfind(const T &value) const;
196
200 bool contains(const T &value) const;
201
209 Iterator erase(Iterator it);
210
214 const T &front() const;
215
219 T &front();
220
224 const T &back() const;
225
229 T &back();
230
240
244 bool autoDelete() const;
245
251 T &operator[](unsigned int i);
252
258 const T &operator[](unsigned int i) const;
259
266
272 List<T> &operator=(std::initializer_list<T> init);
273
277 void swap(List<T> &l) noexcept;
278
283 bool operator==(const List<T> &l) const;
284
288 bool operator!=(const List<T> &l) const;
289
293 void sort();
294
300 template<class Compare>
301 void sort(Compare&& comp);
302
303 protected:
309 void detach();
310
311 private:
312#ifndef DO_NOT_DOCUMENT
313 template <class TP> class ListPrivate;
314 std::shared_ptr<ListPrivate<T>> d;
315#endif
316 };
317
318} // namespace TagLib
319
320// Since GCC doesn't support the "export" keyword, we have to include the
321// implementation.
322
323#include "tlist.tcc"
324
325#endif
A generic, implicitly shared list.
Definition: tlist.h:54
T & operator[](unsigned int i)
List< T > & operator=(const List< T > &l)
ConstIterator cbegin() const
Iterator insert(Iterator it, const T &item)
List(const List< T > &l)
List< T > & sortedInsert(const T &value, bool unique=false)
Iterator erase(Iterator it)
List< T > & append(const T &item)
const T & front() const
ConstIterator cend() const
Iterator begin()
ConstIterator find(const T &value) const
void swap(List< T > &l) noexcept
List< T > & clear()
void setAutoDelete(bool autoDelete)
void sort(Compare &&comp)
Iterator find(const T &value)
const T & operator[](unsigned int i) const
ConstIterator cfind(const T &value) const
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 autoDelete() const
bool operator==(const List< T > &l) const
const T & back() const
List< T > & operator=(std::initializer_list< T > init)
List(std::initializer_list< T > init)
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