rtaglib 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +84 -9
- data/README.txt +0 -0
- data/Rakefile +30 -27
- data/{test/data → data}/440Hz-5sec.flac +0 -0
- data/{test/data → data}/440Hz-5sec.mp3 +0 -0
- data/{test/data → data}/440Hz-5sec.mpc +0 -0
- data/{test/data → data}/440Hz-5sec.ogg +0 -0
- data/{test/data → data}/440Hz-5sec.wv +0 -0
- data/data/test_jason.mp3 +0 -0
- data/data/test_jason.ogg +0 -0
- data/ext/Rakefile +10 -0
- data/ext/tagfile/Rakefile.rb +42 -0
- data/ext/tagfile/rake_ext_conf.rb +29 -0
- data/ext/tagfile/tagfile.c +11 -7
- data/ext/taglib/Rakefile.rb +48 -0
- data/ext/taglib/rake_ext_conf.rb +33 -0
- data/ext/taglib/taglib-mswin32/bin/tag.dll +0 -0
- data/ext/taglib/taglib-mswin32/bin/tag_c.dll +0 -0
- data/ext/taglib/taglib-mswin32/bin/tag_cd.dll +0 -0
- data/ext/taglib/taglib-mswin32/bin/tagd.dll +0 -0
- data/ext/taglib/taglib-mswin32/bin/taglib-config +55 -0
- data/ext/taglib/taglib-mswin32/include/taglib/apefooter.h +173 -0
- data/ext/taglib/taglib-mswin32/include/taglib/apeitem.h +204 -0
- data/ext/taglib/taglib-mswin32/include/taglib/apetag.h +162 -0
- data/ext/taglib/taglib-mswin32/include/taglib/attachedpictureframe.h +220 -0
- data/ext/taglib/taglib-mswin32/include/taglib/audioproperties.h +110 -0
- data/ext/taglib/taglib-mswin32/include/taglib/commentsframe.h +168 -0
- data/ext/taglib/taglib-mswin32/include/taglib/fileref.h +262 -0
- data/ext/taglib/taglib-mswin32/include/taglib/flacfile.h +201 -0
- data/ext/taglib/taglib-mswin32/include/taglib/flacproperties.h +92 -0
- data/ext/taglib/taglib-mswin32/include/taglib/generalencapsulatedobjectframe.h +174 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v1genres.h +66 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v1tag.h +180 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v2extendedheader.h +93 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v2footer.h +82 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v2frame.h +414 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v2framefactory.h +167 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v2header.h +175 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v2synchdata.h +70 -0
- data/ext/taglib/taglib-mswin32/include/taglib/id3v2tag.h +300 -0
- data/ext/taglib/taglib-mswin32/include/taglib/mpcfile.h +175 -0
- data/ext/taglib/taglib-mswin32/include/taglib/mpcproperties.h +85 -0
- data/ext/taglib/taglib-mswin32/include/taglib/mpegfile.h +277 -0
- data/ext/taglib/taglib-mswin32/include/taglib/mpegheader.h +166 -0
- data/ext/taglib/taglib-mswin32/include/taglib/mpegproperties.h +118 -0
- data/ext/taglib/taglib-mswin32/include/taglib/oggfile.h +112 -0
- data/ext/taglib/taglib-mswin32/include/taglib/oggflacfile.h +118 -0
- data/ext/taglib/taglib-mswin32/include/taglib/oggpage.h +203 -0
- data/ext/taglib/taglib-mswin32/include/taglib/oggpageheader.h +232 -0
- data/ext/taglib/taglib-mswin32/include/taglib/relativevolumeframe.h +274 -0
- data/ext/taglib/taglib-mswin32/include/taglib/speexfile.h +99 -0
- data/ext/taglib/taglib-mswin32/include/taglib/speexproperties.h +89 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tag.h +173 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tag_c.h +288 -0
- data/ext/taglib/taglib-mswin32/include/taglib/taglib.h +177 -0
- data/ext/taglib/taglib-mswin32/include/taglib/taglib_export.h +39 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tbytevector.h +409 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tbytevectorlist.h +91 -0
- data/ext/taglib/taglib-mswin32/include/taglib/textidentificationframe.h +258 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tfile.h +271 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tlist.h +252 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tlist.tcc +316 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tmap.h +200 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tmap.tcc +196 -0
- data/ext/taglib/taglib-mswin32/include/taglib/trueaudiofile.h +180 -0
- data/ext/taglib/taglib-mswin32/include/taglib/trueaudioproperties.h +93 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tstring.h +456 -0
- data/ext/taglib/taglib-mswin32/include/taglib/tstringlist.h +115 -0
- data/ext/taglib/taglib-mswin32/include/taglib/uniquefileidentifierframe.h +113 -0
- data/ext/taglib/taglib-mswin32/include/taglib/unknownframe.h +79 -0
- data/ext/taglib/taglib-mswin32/include/taglib/unsynchronizedlyricsframe.h +157 -0
- data/ext/taglib/taglib-mswin32/include/taglib/urllinkframe.h +172 -0
- data/ext/taglib/taglib-mswin32/include/taglib/vorbisfile.h +118 -0
- data/ext/taglib/taglib-mswin32/include/taglib/vorbisproperties.h +125 -0
- data/ext/taglib/taglib-mswin32/include/taglib/wavpackfile.h +164 -0
- data/ext/taglib/taglib-mswin32/include/taglib/wavpackproperties.h +94 -0
- data/ext/taglib/taglib-mswin32/include/taglib/xingheader.h +100 -0
- data/ext/taglib/taglib-mswin32/include/taglib/xiphcomment.h +202 -0
- data/ext/taglib/taglib-mswin32/lib/pkgconfig/taglib_c.pc +12 -0
- data/ext/taglib/taglib-mswin32/lib/tag.lib +0 -0
- data/ext/taglib/taglib-mswin32/lib/tag_c.lib +0 -0
- data/ext/taglib/taglib_i386-mingw32.source +22645 -0
- data/ext/taglib/taglib_i386-mswin32.source +22645 -0
- data/ext/taglib/{taglib.cxx → taglib_x86_64-linux.source} +508 -75
- data/lib/TagLib.rb +3 -2
- data/lib/TagLib_doc.rb +1532 -1526
- data/lib/rtaglib_mswin32.rb +4 -0
- data/lib/tagfile.rb +6 -0
- data/swig/Doxyfile +0 -0
- data/swig/Rakefile +44 -19
- data/swig/TagLib_doc.rb +2755 -0
- data/swig/make_doc.rb +5 -4
- data/swig/process_cxx.rb +2 -2
- data/swig/rake_ext_conf.rb +33 -0
- data/swig/taglib.i +8 -5
- data/swig/test.rb +47 -39
- data/test/test_read.rb +4 -3
- data/test/test_taglib.rb +47 -39
- data/test/test_write.rb +4 -3
- metadata +96 -20
- data/ext/tagfile/extconf.rb +0 -14
- data/ext/taglib/extconf.rb +0 -22
- data/swig/extconf.rb +0 -22
@@ -0,0 +1,252 @@
|
|
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
19
|
+
* 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
|
+
|
33
|
+
namespace TagLib {
|
34
|
+
|
35
|
+
//! A generic, implicitly shared list.
|
36
|
+
|
37
|
+
/*!
|
38
|
+
* This is basic generic list that's somewhere between a std::list and a
|
39
|
+
* QValueList. This class is implicitly shared. For example:
|
40
|
+
*
|
41
|
+
* \code
|
42
|
+
*
|
43
|
+
* TagLib::List<int> l = someOtherIntList;
|
44
|
+
*
|
45
|
+
* \endcode
|
46
|
+
*
|
47
|
+
* The above example is very cheap. This also makes lists suitable for the
|
48
|
+
* return types of functions. The above example will just copy a pointer rather
|
49
|
+
* than copying the data in the list. When your \e shared list's data changes,
|
50
|
+
* only \e then will the data be copied.
|
51
|
+
*/
|
52
|
+
|
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
|
+
|
61
|
+
/*!
|
62
|
+
* Constructs an empty list.
|
63
|
+
*/
|
64
|
+
List();
|
65
|
+
|
66
|
+
/*!
|
67
|
+
* Make a shallow, implicitly shared, copy of \a l. Because this is
|
68
|
+
* implicitly shared, this method is lightweight and suitable for
|
69
|
+
* pass-by-value usage.
|
70
|
+
*/
|
71
|
+
List(const List<T> &l);
|
72
|
+
|
73
|
+
/*!
|
74
|
+
* Destroys this List instance. If auto deletion is enabled and this list
|
75
|
+
* contains a pointer type all of the memebers are also deleted.
|
76
|
+
*/
|
77
|
+
virtual ~List();
|
78
|
+
|
79
|
+
/*!
|
80
|
+
* Returns an STL style iterator to the beginning of the list. See
|
81
|
+
* std::list::const_iterator for the semantics.
|
82
|
+
*/
|
83
|
+
Iterator begin();
|
84
|
+
|
85
|
+
/*!
|
86
|
+
* Returns an STL style constant iterator to the beginning of the list. See
|
87
|
+
* std::list::iterator for the semantics.
|
88
|
+
*/
|
89
|
+
ConstIterator begin() const;
|
90
|
+
|
91
|
+
/*!
|
92
|
+
* Returns an STL style iterator to the end of the list. See
|
93
|
+
* std::list::iterator for the semantics.
|
94
|
+
*/
|
95
|
+
Iterator end();
|
96
|
+
|
97
|
+
/*!
|
98
|
+
* Returns an STL style constant iterator to the end of the list. See
|
99
|
+
* std::list::const_iterator for the semantics.
|
100
|
+
*/
|
101
|
+
ConstIterator end() const;
|
102
|
+
|
103
|
+
/*!
|
104
|
+
* Inserts a copy of \a value before \a it.
|
105
|
+
*/
|
106
|
+
Iterator insert(Iterator it, const T &value);
|
107
|
+
|
108
|
+
/*!
|
109
|
+
* Inserts the \a value into the list. This assumes that the list is
|
110
|
+
* currently sorted. If \a unique is true then the value will not
|
111
|
+
* be inserted if it is already in the list.
|
112
|
+
*/
|
113
|
+
List<T> &sortedInsert(const T &value, bool unique = false);
|
114
|
+
|
115
|
+
/*!
|
116
|
+
* Appends \a item to the end of the list and returns a reference to the
|
117
|
+
* list.
|
118
|
+
*/
|
119
|
+
List<T> &append(const T &item);
|
120
|
+
|
121
|
+
/*!
|
122
|
+
* Appends all of the values in \a l to the end of the list and returns a
|
123
|
+
* reference to the list.
|
124
|
+
*/
|
125
|
+
List<T> &append(const List<T> &l);
|
126
|
+
|
127
|
+
/*!
|
128
|
+
* Prepends \a item to the beginning list and returns a reference to the
|
129
|
+
* list.
|
130
|
+
*/
|
131
|
+
List<T> &prepend(const T &item);
|
132
|
+
|
133
|
+
/*!
|
134
|
+
* Prepends all of the items in \a l to the beginning list and returns a
|
135
|
+
* reference to the list.
|
136
|
+
*/
|
137
|
+
List<T> &prepend(const List<T> &l);
|
138
|
+
|
139
|
+
/*!
|
140
|
+
* Clears the list. If auto deletion is enabled and this list contains a
|
141
|
+
* pointer type the members are also deleted.
|
142
|
+
*
|
143
|
+
* \see setAutoDelete()
|
144
|
+
*/
|
145
|
+
List<T> &clear();
|
146
|
+
|
147
|
+
/*!
|
148
|
+
* Returns the number of elements in the list.
|
149
|
+
*/
|
150
|
+
uint size() const;
|
151
|
+
bool isEmpty() const;
|
152
|
+
|
153
|
+
/*!
|
154
|
+
* Find the first occurrence of \a value.
|
155
|
+
*/
|
156
|
+
Iterator find(const T &value);
|
157
|
+
|
158
|
+
/*!
|
159
|
+
* Find the first occurrence of \a value.
|
160
|
+
*/
|
161
|
+
ConstIterator find(const T &value) const;
|
162
|
+
|
163
|
+
/*!
|
164
|
+
* Returns true if the list contains \a value.
|
165
|
+
*/
|
166
|
+
bool contains(const T &value) const;
|
167
|
+
|
168
|
+
/*!
|
169
|
+
* Erase the item at \a it from the list.
|
170
|
+
*/
|
171
|
+
Iterator erase(Iterator it);
|
172
|
+
|
173
|
+
/*!
|
174
|
+
* Returns a reference to the first item in the list.
|
175
|
+
*/
|
176
|
+
const T &front() const;
|
177
|
+
|
178
|
+
/*!
|
179
|
+
* Returns a reference to the first item in the list.
|
180
|
+
*/
|
181
|
+
T &front();
|
182
|
+
|
183
|
+
/*!
|
184
|
+
* Returns a reference to the last item in the list.
|
185
|
+
*/
|
186
|
+
const T &back() const;
|
187
|
+
|
188
|
+
/*!
|
189
|
+
* Returns a reference to the last item in the list.
|
190
|
+
*/
|
191
|
+
T &back();
|
192
|
+
|
193
|
+
/*!
|
194
|
+
* Auto delete the members of the list when the last reference to the list
|
195
|
+
* passes out of scope. This will have no effect on lists which do not
|
196
|
+
* contain a pointer type.
|
197
|
+
*
|
198
|
+
* \note This relies on partial template instantiation -- most modern C++
|
199
|
+
* compilers should now support this.
|
200
|
+
*/
|
201
|
+
void setAutoDelete(bool autoDelete);
|
202
|
+
|
203
|
+
/*!
|
204
|
+
* Returns a reference to item \a i in the list.
|
205
|
+
*
|
206
|
+
* \warning This method is slow. Use iterators to loop through the list.
|
207
|
+
*/
|
208
|
+
T &operator[](uint i);
|
209
|
+
|
210
|
+
/*!
|
211
|
+
* Returns a const reference to item \a i in the list.
|
212
|
+
*
|
213
|
+
* \warning This method is slow. Use iterators to loop through the list.
|
214
|
+
*/
|
215
|
+
const T &operator[](uint i) const;
|
216
|
+
|
217
|
+
/*!
|
218
|
+
* Make a shallow, implicitly shared, copy of \a l. Because this is
|
219
|
+
* implicitly shared, this method is lightweight and suitable for
|
220
|
+
* pass-by-value usage.
|
221
|
+
*/
|
222
|
+
List<T> &operator=(const List<T> &l);
|
223
|
+
|
224
|
+
/*!
|
225
|
+
* Compares this list with \a l and returns true if all of the elements are
|
226
|
+
* the same.
|
227
|
+
*/
|
228
|
+
bool operator==(const List<T> &l) const;
|
229
|
+
|
230
|
+
protected:
|
231
|
+
/*
|
232
|
+
* If this List is being shared via implicit sharing, do a deep copy of the
|
233
|
+
* data and separate from the shared members. This should be called by all
|
234
|
+
* non-const subclass members.
|
235
|
+
*/
|
236
|
+
void detach();
|
237
|
+
|
238
|
+
private:
|
239
|
+
#ifndef DO_NOT_DOCUMENT
|
240
|
+
template <class TP> class ListPrivate;
|
241
|
+
ListPrivate<T> *d;
|
242
|
+
#endif
|
243
|
+
};
|
244
|
+
|
245
|
+
}
|
246
|
+
|
247
|
+
// Since GCC doesn't support the "export" keyword, we have to include the
|
248
|
+
// implementation.
|
249
|
+
|
250
|
+
#include "tlist.tcc"
|
251
|
+
|
252
|
+
#endif
|
@@ -0,0 +1,316 @@
|
|
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
19
|
+
* 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
|
+
#include <algorithm>
|
27
|
+
|
28
|
+
namespace TagLib {
|
29
|
+
|
30
|
+
////////////////////////////////////////////////////////////////////////////////
|
31
|
+
// public members
|
32
|
+
////////////////////////////////////////////////////////////////////////////////
|
33
|
+
|
34
|
+
// The functionality of List<T>::setAutoDelete() is implemented here partial
|
35
|
+
// template specialization. This is implemented in such a way that calling
|
36
|
+
// setAutoDelete() on non-pointer types will simply have no effect.
|
37
|
+
|
38
|
+
// A base for the generic and specialized private class types. New
|
39
|
+
// non-templatized members should be added here.
|
40
|
+
|
41
|
+
class ListPrivateBase : public RefCounter
|
42
|
+
{
|
43
|
+
public:
|
44
|
+
ListPrivateBase() : autoDelete(false) {}
|
45
|
+
bool autoDelete;
|
46
|
+
};
|
47
|
+
|
48
|
+
// A generic implementation
|
49
|
+
|
50
|
+
template <class T>
|
51
|
+
template <class TP> class List<T>::ListPrivate : public ListPrivateBase
|
52
|
+
{
|
53
|
+
public:
|
54
|
+
ListPrivate() : ListPrivateBase() {}
|
55
|
+
ListPrivate(const std::list<TP> &l) : ListPrivateBase(), list(l) {}
|
56
|
+
void clear() {
|
57
|
+
list.clear();
|
58
|
+
}
|
59
|
+
std::list<TP> list;
|
60
|
+
};
|
61
|
+
|
62
|
+
// A partial specialization for all pointer types that implements the
|
63
|
+
// setAutoDelete() functionality.
|
64
|
+
|
65
|
+
template <class T>
|
66
|
+
template <class TP> class List<T>::ListPrivate<TP *> : public ListPrivateBase
|
67
|
+
{
|
68
|
+
public:
|
69
|
+
ListPrivate() : ListPrivateBase() {}
|
70
|
+
ListPrivate(const std::list<TP *> &l) : ListPrivateBase(), list(l) {}
|
71
|
+
~ListPrivate() {
|
72
|
+
clear();
|
73
|
+
}
|
74
|
+
void clear() {
|
75
|
+
if(autoDelete) {
|
76
|
+
typename std::list<TP *>::const_iterator it = list.begin();
|
77
|
+
for(; it != list.end(); ++it)
|
78
|
+
delete *it;
|
79
|
+
}
|
80
|
+
list.clear();
|
81
|
+
}
|
82
|
+
std::list<TP *> list;
|
83
|
+
};
|
84
|
+
|
85
|
+
////////////////////////////////////////////////////////////////////////////////
|
86
|
+
// public members
|
87
|
+
////////////////////////////////////////////////////////////////////////////////
|
88
|
+
|
89
|
+
template <class T>
|
90
|
+
List<T>::List()
|
91
|
+
{
|
92
|
+
d = new ListPrivate<T>;
|
93
|
+
}
|
94
|
+
|
95
|
+
template <class T>
|
96
|
+
List<T>::List(const List<T> &l) : d(l.d)
|
97
|
+
{
|
98
|
+
d->ref();
|
99
|
+
}
|
100
|
+
|
101
|
+
template <class T>
|
102
|
+
List<T>::~List()
|
103
|
+
{
|
104
|
+
if(d->deref())
|
105
|
+
delete d;
|
106
|
+
}
|
107
|
+
|
108
|
+
template <class T>
|
109
|
+
typename List<T>::Iterator List<T>::begin()
|
110
|
+
{
|
111
|
+
detach();
|
112
|
+
return d->list.begin();
|
113
|
+
}
|
114
|
+
|
115
|
+
template <class T>
|
116
|
+
typename List<T>::ConstIterator List<T>::begin() const
|
117
|
+
{
|
118
|
+
return d->list.begin();
|
119
|
+
}
|
120
|
+
|
121
|
+
template <class T>
|
122
|
+
typename List<T>::Iterator List<T>::end()
|
123
|
+
{
|
124
|
+
detach();
|
125
|
+
return d->list.end();
|
126
|
+
}
|
127
|
+
|
128
|
+
template <class T>
|
129
|
+
typename List<T>::ConstIterator List<T>::end() const
|
130
|
+
{
|
131
|
+
return d->list.end();
|
132
|
+
}
|
133
|
+
|
134
|
+
template <class T>
|
135
|
+
typename List<T>::Iterator List<T>::insert(Iterator it, const T &item)
|
136
|
+
{
|
137
|
+
detach();
|
138
|
+
return d->list.insert(it, item);
|
139
|
+
}
|
140
|
+
|
141
|
+
template <class T>
|
142
|
+
List<T> &List<T>::sortedInsert(const T &value, bool unique)
|
143
|
+
{
|
144
|
+
detach();
|
145
|
+
Iterator it = begin();
|
146
|
+
while(it != end() && *it < value)
|
147
|
+
++it;
|
148
|
+
if(unique && it != end() && *it == value)
|
149
|
+
return *this;
|
150
|
+
insert(it, value);
|
151
|
+
return *this;
|
152
|
+
}
|
153
|
+
|
154
|
+
template <class T>
|
155
|
+
List<T> &List<T>::append(const T &item)
|
156
|
+
{
|
157
|
+
detach();
|
158
|
+
d->list.push_back(item);
|
159
|
+
return *this;
|
160
|
+
}
|
161
|
+
|
162
|
+
template <class T>
|
163
|
+
List<T> &List<T>::append(const List<T> &l)
|
164
|
+
{
|
165
|
+
detach();
|
166
|
+
d->list.insert(d->list.end(), l.begin(), l.end());
|
167
|
+
return *this;
|
168
|
+
}
|
169
|
+
|
170
|
+
template <class T>
|
171
|
+
List<T> &List<T>::prepend(const T &item)
|
172
|
+
{
|
173
|
+
detach();
|
174
|
+
d->list.push_front(item);
|
175
|
+
return *this;
|
176
|
+
}
|
177
|
+
|
178
|
+
template <class T>
|
179
|
+
List<T> &List<T>::prepend(const List<T> &l)
|
180
|
+
{
|
181
|
+
detach();
|
182
|
+
d->list.insert(d->list.begin(), l.begin(), l.end());
|
183
|
+
return *this;
|
184
|
+
}
|
185
|
+
|
186
|
+
template <class T>
|
187
|
+
List<T> &List<T>::clear()
|
188
|
+
{
|
189
|
+
detach();
|
190
|
+
d->clear();
|
191
|
+
return *this;
|
192
|
+
}
|
193
|
+
|
194
|
+
template <class T>
|
195
|
+
TagLib::uint List<T>::size() const
|
196
|
+
{
|
197
|
+
return d->list.size();
|
198
|
+
}
|
199
|
+
|
200
|
+
template <class T>
|
201
|
+
bool List<T>::isEmpty() const
|
202
|
+
{
|
203
|
+
return d->list.empty();
|
204
|
+
}
|
205
|
+
|
206
|
+
template <class T>
|
207
|
+
typename List<T>::Iterator List<T>::find(const T &value)
|
208
|
+
{
|
209
|
+
return std::find(d->list.begin(), d->list.end(), value);
|
210
|
+
}
|
211
|
+
|
212
|
+
template <class T>
|
213
|
+
typename List<T>::ConstIterator List<T>::find(const T &value) const
|
214
|
+
{
|
215
|
+
return std::find(d->list.begin(), d->list.end(), value);
|
216
|
+
}
|
217
|
+
|
218
|
+
template <class T>
|
219
|
+
bool List<T>::contains(const T &value) const
|
220
|
+
{
|
221
|
+
return std::find(d->list.begin(), d->list.end(), value) != d->list.end();
|
222
|
+
}
|
223
|
+
|
224
|
+
template <class T>
|
225
|
+
typename List<T>::Iterator List<T>::erase(Iterator it)
|
226
|
+
{
|
227
|
+
return d->list.erase(it);
|
228
|
+
}
|
229
|
+
|
230
|
+
template <class T>
|
231
|
+
const T &List<T>::front() const
|
232
|
+
{
|
233
|
+
return d->list.front();
|
234
|
+
}
|
235
|
+
|
236
|
+
template <class T>
|
237
|
+
T &List<T>::front()
|
238
|
+
{
|
239
|
+
detach();
|
240
|
+
return d->list.front();
|
241
|
+
}
|
242
|
+
|
243
|
+
template <class T>
|
244
|
+
const T &List<T>::back() const
|
245
|
+
{
|
246
|
+
return d->list.back();
|
247
|
+
}
|
248
|
+
|
249
|
+
template <class T>
|
250
|
+
void List<T>::setAutoDelete(bool autoDelete)
|
251
|
+
{
|
252
|
+
d->autoDelete = autoDelete;
|
253
|
+
}
|
254
|
+
|
255
|
+
template <class T>
|
256
|
+
T &List<T>::back()
|
257
|
+
{
|
258
|
+
detach();
|
259
|
+
return d->list.back();
|
260
|
+
}
|
261
|
+
|
262
|
+
template <class T>
|
263
|
+
T &List<T>::operator[](uint i)
|
264
|
+
{
|
265
|
+
Iterator it = d->list.begin();
|
266
|
+
|
267
|
+
for(uint j = 0; j < i; j++)
|
268
|
+
++it;
|
269
|
+
|
270
|
+
return *it;
|
271
|
+
}
|
272
|
+
|
273
|
+
template <class T>
|
274
|
+
const T &List<T>::operator[](uint i) const
|
275
|
+
{
|
276
|
+
ConstIterator it = d->list.begin();
|
277
|
+
|
278
|
+
for(uint j = 0; j < i; j++)
|
279
|
+
++it;
|
280
|
+
|
281
|
+
return *it;
|
282
|
+
}
|
283
|
+
|
284
|
+
template <class T>
|
285
|
+
List<T> &List<T>::operator=(const List<T> &l)
|
286
|
+
{
|
287
|
+
if(&l == this)
|
288
|
+
return *this;
|
289
|
+
|
290
|
+
if(d->deref())
|
291
|
+
delete d;
|
292
|
+
d = l.d;
|
293
|
+
d->ref();
|
294
|
+
return *this;
|
295
|
+
}
|
296
|
+
|
297
|
+
template <class T>
|
298
|
+
bool List<T>::operator==(const List<T> &l) const
|
299
|
+
{
|
300
|
+
return d->list == l.d->list;
|
301
|
+
}
|
302
|
+
|
303
|
+
////////////////////////////////////////////////////////////////////////////////
|
304
|
+
// protected members
|
305
|
+
////////////////////////////////////////////////////////////////////////////////
|
306
|
+
|
307
|
+
template <class T>
|
308
|
+
void List<T>::detach()
|
309
|
+
{
|
310
|
+
if(d->count() > 1) {
|
311
|
+
d->deref();
|
312
|
+
d = new ListPrivate<T>(d->list);
|
313
|
+
}
|
314
|
+
}
|
315
|
+
|
316
|
+
} // namespace TagLib
|