rtaglib 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,200 @@
|
|
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_MAP_H
|
27
|
+
#define TAGLIB_MAP_H
|
28
|
+
|
29
|
+
#include <map>
|
30
|
+
using namespace std;
|
31
|
+
|
32
|
+
#include "taglib.h"
|
33
|
+
|
34
|
+
namespace TagLib {
|
35
|
+
|
36
|
+
//! A generic, implicitly shared map.
|
37
|
+
|
38
|
+
/*!
|
39
|
+
* This implements a standard map container that associates a key with a value
|
40
|
+
* and has fast key-based lookups. This map is also implicitly shared making
|
41
|
+
* it suitable for pass-by-value usage.
|
42
|
+
*/
|
43
|
+
|
44
|
+
template <class Key, class T> class Map
|
45
|
+
{
|
46
|
+
public:
|
47
|
+
#ifndef DO_NOT_DOCUMENT
|
48
|
+
#ifdef WANT_CLASS_INSTANTIATION_OF_MAP
|
49
|
+
// Some STL implementations get snippy over the use of the
|
50
|
+
// class keyword to distinguish different templates; Sun Studio
|
51
|
+
// in particular finds multiple specializations in certain rare
|
52
|
+
// cases and complains about that. GCC doesn't seem to mind,
|
53
|
+
// and uses the typedefs further below without the class keyword.
|
54
|
+
// Not all the specializations of Map can use the class keyword
|
55
|
+
// (when T is not actually a class type), so don't apply this
|
56
|
+
// generally.
|
57
|
+
typedef typename std::map<class Key, class T>::iterator Iterator;
|
58
|
+
typedef typename std::map<class Key, class T>::const_iterator ConstIterator;
|
59
|
+
#else
|
60
|
+
typedef typename std::map<Key, T>::iterator Iterator;
|
61
|
+
typedef typename std::map<Key, T>::const_iterator ConstIterator;
|
62
|
+
#endif
|
63
|
+
#endif
|
64
|
+
|
65
|
+
/*!
|
66
|
+
* Constructs an empty Map.
|
67
|
+
*/
|
68
|
+
Map();
|
69
|
+
|
70
|
+
/*!
|
71
|
+
* Make a shallow, implicitly shared, copy of \a m. Because this is
|
72
|
+
* implicitly shared, this method is lightweight and suitable for
|
73
|
+
* pass-by-value usage.
|
74
|
+
*/
|
75
|
+
Map(const Map<Key, T> &m);
|
76
|
+
|
77
|
+
/*!
|
78
|
+
* Destroys this instance of the Map.
|
79
|
+
*/
|
80
|
+
virtual ~Map();
|
81
|
+
|
82
|
+
/*!
|
83
|
+
* Returns an STL style iterator to the beginning of the map. See
|
84
|
+
* std::map::iterator for the semantics.
|
85
|
+
*/
|
86
|
+
Iterator begin();
|
87
|
+
|
88
|
+
/*!
|
89
|
+
* Returns an STL style iterator to the beginning of the map. See
|
90
|
+
* std::map::const_iterator for the semantics.
|
91
|
+
*/
|
92
|
+
ConstIterator begin() const;
|
93
|
+
|
94
|
+
/*!
|
95
|
+
* Returns an STL style iterator to the end of the map. See
|
96
|
+
* std::map::iterator for the semantics.
|
97
|
+
*/
|
98
|
+
Iterator end();
|
99
|
+
|
100
|
+
/*!
|
101
|
+
* Returns an STL style iterator to the end of the map. See
|
102
|
+
* std::map::const_iterator for the semantics.
|
103
|
+
*/
|
104
|
+
ConstIterator end() const;
|
105
|
+
|
106
|
+
/*!
|
107
|
+
* Inserts \a value under \a key in the map. If a value for \a key already
|
108
|
+
* exists it will be overwritten.
|
109
|
+
*/
|
110
|
+
Map<Key, T> &insert(const Key &key, const T &value);
|
111
|
+
|
112
|
+
/*!
|
113
|
+
* Removes all of the elements from elements from the map. This however
|
114
|
+
* will not delete pointers if the mapped type is a pointer type.
|
115
|
+
*/
|
116
|
+
Map<Key, T> &clear();
|
117
|
+
|
118
|
+
/*!
|
119
|
+
* The number of elements in the map.
|
120
|
+
*
|
121
|
+
* \see isEmpty()
|
122
|
+
*/
|
123
|
+
uint size() const;
|
124
|
+
|
125
|
+
/*!
|
126
|
+
* Returns true if the map is empty.
|
127
|
+
*
|
128
|
+
* \see size()
|
129
|
+
*/
|
130
|
+
bool isEmpty() const;
|
131
|
+
|
132
|
+
/*!
|
133
|
+
* Find the first occurrence of \a key.
|
134
|
+
*/
|
135
|
+
Iterator find(const Key &key);
|
136
|
+
|
137
|
+
/*!
|
138
|
+
* Find the first occurrence of \a key.
|
139
|
+
*/
|
140
|
+
ConstIterator find(const Key &key) const;
|
141
|
+
|
142
|
+
/*!
|
143
|
+
* Returns true if the map contains an instance of \a key.
|
144
|
+
*/
|
145
|
+
bool contains(const Key &key) const;
|
146
|
+
|
147
|
+
/*!
|
148
|
+
* Erase the item at \a it from the list.
|
149
|
+
*/
|
150
|
+
Map<Key, T> &erase(Iterator it);
|
151
|
+
|
152
|
+
/*!
|
153
|
+
* Erase the item with \a key from the list.
|
154
|
+
*/
|
155
|
+
Map<Key, T> &erase(const Key &key);
|
156
|
+
|
157
|
+
/*!
|
158
|
+
* Returns a reference to the value associated with \a key.
|
159
|
+
*
|
160
|
+
* \note This has undefined behavior if the key is not present in the map.
|
161
|
+
*/
|
162
|
+
const T &operator[](const Key &key) const;
|
163
|
+
|
164
|
+
/*!
|
165
|
+
* Returns a reference to the value associated with \a key.
|
166
|
+
*
|
167
|
+
* \note This has undefined behavior if the key is not present in the map.
|
168
|
+
*/
|
169
|
+
T &operator[](const Key &key);
|
170
|
+
|
171
|
+
/*!
|
172
|
+
* Make a shallow, implicitly shared, copy of \a m. Because this is
|
173
|
+
* implicitly shared, this method is lightweight and suitable for
|
174
|
+
* pass-by-value usage.
|
175
|
+
*/
|
176
|
+
Map<Key, T> &operator=(const Map<Key, T> &m);
|
177
|
+
|
178
|
+
protected:
|
179
|
+
/*
|
180
|
+
* If this List is being shared via implicit sharing, do a deep copy of the
|
181
|
+
* data and separate from the shared members. This should be called by all
|
182
|
+
* non-const subclass members.
|
183
|
+
*/
|
184
|
+
void detach();
|
185
|
+
|
186
|
+
private:
|
187
|
+
#ifndef DO_NOT_DOCUMENT
|
188
|
+
template <class KeyP, class TP> class MapPrivate;
|
189
|
+
MapPrivate<Key, T> *d;
|
190
|
+
#endif
|
191
|
+
};
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
// Since GCC doesn't support the "export" keyword, we have to include the
|
196
|
+
// implementation.
|
197
|
+
|
198
|
+
#include "tmap.tcc"
|
199
|
+
|
200
|
+
#endif
|
@@ -0,0 +1,196 @@
|
|
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
|
+
namespace TagLib {
|
27
|
+
|
28
|
+
////////////////////////////////////////////////////////////////////////////////
|
29
|
+
// public members
|
30
|
+
////////////////////////////////////////////////////////////////////////////////
|
31
|
+
|
32
|
+
template <class Key, class T>
|
33
|
+
template <class KeyP, class TP>
|
34
|
+
class Map<Key, T>::MapPrivate : public RefCounter
|
35
|
+
{
|
36
|
+
public:
|
37
|
+
MapPrivate() : RefCounter() {}
|
38
|
+
#ifdef WANT_CLASS_INSTANTIATION_OF_MAP
|
39
|
+
MapPrivate(const std::map<class KeyP, class TP>& m) : RefCounter(), map(m) {}
|
40
|
+
std::map<class KeyP, class TP> map;
|
41
|
+
#else
|
42
|
+
MapPrivate(const std::map<KeyP, TP>& m) : RefCounter(), map(m) {}
|
43
|
+
std::map<KeyP, TP> map;
|
44
|
+
#endif
|
45
|
+
};
|
46
|
+
|
47
|
+
template <class Key, class T>
|
48
|
+
Map<Key, T>::Map()
|
49
|
+
{
|
50
|
+
d = new MapPrivate<Key, T>;
|
51
|
+
}
|
52
|
+
|
53
|
+
template <class Key, class T>
|
54
|
+
Map<Key, T>::Map(const Map<Key, T> &m) : d(m.d)
|
55
|
+
{
|
56
|
+
d->ref();
|
57
|
+
}
|
58
|
+
|
59
|
+
template <class Key, class T>
|
60
|
+
Map<Key, T>::~Map()
|
61
|
+
{
|
62
|
+
if(d->deref())
|
63
|
+
delete(d);
|
64
|
+
}
|
65
|
+
|
66
|
+
template <class Key, class T>
|
67
|
+
typename Map<Key, T>::Iterator Map<Key, T>::begin()
|
68
|
+
{
|
69
|
+
detach();
|
70
|
+
return d->map.begin();
|
71
|
+
}
|
72
|
+
|
73
|
+
template <class Key, class T>
|
74
|
+
typename Map<Key, T>::ConstIterator Map<Key, T>::begin() const
|
75
|
+
{
|
76
|
+
return d->map.begin();
|
77
|
+
}
|
78
|
+
|
79
|
+
template <class Key, class T>
|
80
|
+
typename Map<Key, T>::Iterator Map<Key, T>::end()
|
81
|
+
{
|
82
|
+
detach();
|
83
|
+
return d->map.end();
|
84
|
+
}
|
85
|
+
|
86
|
+
template <class Key, class T>
|
87
|
+
typename Map<Key, T>::ConstIterator Map<Key, T>::end() const
|
88
|
+
{
|
89
|
+
return d->map.end();
|
90
|
+
}
|
91
|
+
|
92
|
+
template <class Key, class T>
|
93
|
+
Map<Key, T> &Map<Key, T>::insert(const Key &key, const T &value)
|
94
|
+
{
|
95
|
+
detach();
|
96
|
+
d->map[key] = value;
|
97
|
+
return *this;
|
98
|
+
}
|
99
|
+
|
100
|
+
template <class Key, class T>
|
101
|
+
Map<Key, T> &Map<Key, T>::clear()
|
102
|
+
{
|
103
|
+
detach();
|
104
|
+
d->map.clear();
|
105
|
+
return *this;
|
106
|
+
}
|
107
|
+
|
108
|
+
template <class Key, class T>
|
109
|
+
bool Map<Key, T>::isEmpty() const
|
110
|
+
{
|
111
|
+
return d->map.empty();
|
112
|
+
}
|
113
|
+
|
114
|
+
template <class Key, class T>
|
115
|
+
typename Map<Key, T>::Iterator Map<Key, T>::find(const Key &key)
|
116
|
+
{
|
117
|
+
detach();
|
118
|
+
return d->map.find(key);
|
119
|
+
}
|
120
|
+
|
121
|
+
template <class Key, class T>
|
122
|
+
typename Map<Key,T>::ConstIterator Map<Key, T>::find(const Key &key) const
|
123
|
+
{
|
124
|
+
return d->map.find(key);
|
125
|
+
}
|
126
|
+
|
127
|
+
template <class Key, class T>
|
128
|
+
bool Map<Key, T>::contains(const Key &key) const
|
129
|
+
{
|
130
|
+
return d->map.find(key) != d->map.end();
|
131
|
+
}
|
132
|
+
|
133
|
+
template <class Key, class T>
|
134
|
+
Map<Key, T> &Map<Key,T>::erase(Iterator it)
|
135
|
+
{
|
136
|
+
detach();
|
137
|
+
d->map.erase(it);
|
138
|
+
return *this;
|
139
|
+
}
|
140
|
+
|
141
|
+
template <class Key, class T>
|
142
|
+
Map<Key, T> &Map<Key,T>::erase(const Key &key)
|
143
|
+
{
|
144
|
+
detach();
|
145
|
+
Iterator it = d->map.find(key);
|
146
|
+
if(it != d->map.end())
|
147
|
+
d->map.erase(it);
|
148
|
+
return *this;
|
149
|
+
}
|
150
|
+
|
151
|
+
template <class Key, class T>
|
152
|
+
TagLib::uint Map<Key, T>::size() const
|
153
|
+
{
|
154
|
+
return d->map.size();
|
155
|
+
}
|
156
|
+
|
157
|
+
template <class Key, class T>
|
158
|
+
const T &Map<Key, T>::operator[](const Key &key) const
|
159
|
+
{
|
160
|
+
return d->map[key];
|
161
|
+
}
|
162
|
+
|
163
|
+
template <class Key, class T>
|
164
|
+
T &Map<Key, T>::operator[](const Key &key)
|
165
|
+
{
|
166
|
+
detach();
|
167
|
+
return d->map[key];
|
168
|
+
}
|
169
|
+
|
170
|
+
template <class Key, class T>
|
171
|
+
Map<Key, T> &Map<Key, T>::operator=(const Map<Key, T> &m)
|
172
|
+
{
|
173
|
+
if(&m == this)
|
174
|
+
return *this;
|
175
|
+
|
176
|
+
if(d->deref())
|
177
|
+
delete(d);
|
178
|
+
d = m.d;
|
179
|
+
d->ref();
|
180
|
+
return *this;
|
181
|
+
}
|
182
|
+
|
183
|
+
////////////////////////////////////////////////////////////////////////////////
|
184
|
+
// protected members
|
185
|
+
////////////////////////////////////////////////////////////////////////////////
|
186
|
+
|
187
|
+
template <class Key, class T>
|
188
|
+
void Map<Key, T>::detach()
|
189
|
+
{
|
190
|
+
if(d->count() > 1) {
|
191
|
+
d->deref();
|
192
|
+
d = new MapPrivate<Key, T>(d->map);
|
193
|
+
}
|
194
|
+
}
|
195
|
+
|
196
|
+
} // namespace TagLib
|
@@ -0,0 +1,180 @@
|
|
1
|
+
/***************************************************************************
|
2
|
+
copyright : (C) 2006 by Lukáš Lalinský
|
3
|
+
email : lalinsky@gmail.com
|
4
|
+
|
5
|
+
copyright : (C) 2004 by Allan Sandfeld Jensen
|
6
|
+
email : kde@carewolf.org
|
7
|
+
(original MPC implementation)
|
8
|
+
***************************************************************************/
|
9
|
+
|
10
|
+
/***************************************************************************
|
11
|
+
* This library is free software; you can redistribute it and/or modify *
|
12
|
+
* it under the terms of the GNU Lesser General Public License version *
|
13
|
+
* 2.1 as published by the Free Software Foundation. *
|
14
|
+
* *
|
15
|
+
* This library is distributed in the hope that it will be useful, but *
|
16
|
+
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
17
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
18
|
+
* Lesser General Public License for more details. *
|
19
|
+
* *
|
20
|
+
* You should have received a copy of the GNU Lesser General Public *
|
21
|
+
* License along with this library; if not, write to the Free Software *
|
22
|
+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
23
|
+
* USA *
|
24
|
+
* *
|
25
|
+
* Alternatively, this file is available under the Mozilla Public *
|
26
|
+
* License Version 1.1. You may obtain a copy of the License at *
|
27
|
+
* http://www.mozilla.org/MPL/ *
|
28
|
+
***************************************************************************/
|
29
|
+
|
30
|
+
#ifndef TAGLIB_TRUEAUDIOFILE_H
|
31
|
+
#define TAGLIB_TRUEAUDIOFILE_H
|
32
|
+
|
33
|
+
#include <tfile.h>
|
34
|
+
#include "trueaudioproperties.h"
|
35
|
+
|
36
|
+
namespace TagLib {
|
37
|
+
|
38
|
+
class Tag;
|
39
|
+
|
40
|
+
namespace ID3v2 { class Tag; class FrameFactory; }
|
41
|
+
namespace ID3v1 { class Tag; }
|
42
|
+
|
43
|
+
//! An implementation of TrueAudio metadata
|
44
|
+
|
45
|
+
/*!
|
46
|
+
* This is implementation of TrueAudio metadata.
|
47
|
+
*
|
48
|
+
* This supports ID3v1 and ID3v2 tags as well as reading stream
|
49
|
+
* properties from the file.
|
50
|
+
*/
|
51
|
+
|
52
|
+
namespace TrueAudio {
|
53
|
+
|
54
|
+
//! An implementation of TagLib::File with TrueAudio specific methods
|
55
|
+
|
56
|
+
/*!
|
57
|
+
* This implements and provides an interface for TrueAudio files to the
|
58
|
+
* TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing
|
59
|
+
* the abstract TagLib::File API as well as providing some additional
|
60
|
+
* information specific to TrueAudio files.
|
61
|
+
*/
|
62
|
+
|
63
|
+
class TAGLIB_EXPORT File : public TagLib::File
|
64
|
+
{
|
65
|
+
public:
|
66
|
+
/*!
|
67
|
+
* This set of flags is used for various operations and is suitable for
|
68
|
+
* being OR-ed together.
|
69
|
+
*/
|
70
|
+
enum TagTypes {
|
71
|
+
//! Empty set. Matches no tag types.
|
72
|
+
NoTags = 0x0000,
|
73
|
+
//! Matches ID3v1 tags.
|
74
|
+
ID3v1 = 0x0001,
|
75
|
+
//! Matches ID3v2 tags.
|
76
|
+
ID3v2 = 0x0002,
|
77
|
+
//! Matches all tag types.
|
78
|
+
AllTags = 0xffff
|
79
|
+
};
|
80
|
+
|
81
|
+
/*!
|
82
|
+
* Contructs an TrueAudio file from \a file. If \a readProperties is true the
|
83
|
+
* file's audio properties will also be read using \a propertiesStyle. If
|
84
|
+
* false, \a propertiesStyle is ignored.
|
85
|
+
*/
|
86
|
+
File(FileName file, bool readProperties = true,
|
87
|
+
Properties::ReadStyle propertiesStyle = Properties::Average);
|
88
|
+
|
89
|
+
/*!
|
90
|
+
* Contructs an TrueAudio file from \a file. If \a readProperties is true the
|
91
|
+
* file's audio properties will also be read using \a propertiesStyle. If
|
92
|
+
* false, \a propertiesStyle is ignored. The frames will be created using
|
93
|
+
* \a frameFactory.
|
94
|
+
*/
|
95
|
+
File(FileName file, ID3v2::FrameFactory *frameFactory,
|
96
|
+
bool readProperties = true,
|
97
|
+
Properties::ReadStyle propertiesStyle = Properties::Average);
|
98
|
+
|
99
|
+
/*!
|
100
|
+
* Destroys this instance of the File.
|
101
|
+
*/
|
102
|
+
virtual ~File();
|
103
|
+
|
104
|
+
/*!
|
105
|
+
* Returns the Tag for this file.
|
106
|
+
*/
|
107
|
+
virtual TagLib::Tag *tag() const;
|
108
|
+
|
109
|
+
/*!
|
110
|
+
* Returns the TrueAudio::Properties for this file. If no audio properties
|
111
|
+
* were read then this will return a null pointer.
|
112
|
+
*/
|
113
|
+
virtual Properties *audioProperties() const;
|
114
|
+
|
115
|
+
/*!
|
116
|
+
* Set the ID3v2::FrameFactory to something other than the default.
|
117
|
+
*
|
118
|
+
* \see ID3v2FrameFactory
|
119
|
+
*/
|
120
|
+
void setID3v2FrameFactory(const ID3v2::FrameFactory *factory);
|
121
|
+
|
122
|
+
/*!
|
123
|
+
* Saves the file.
|
124
|
+
*/
|
125
|
+
virtual bool save();
|
126
|
+
|
127
|
+
/*!
|
128
|
+
* Returns a pointer to the ID3v2 tag of the file.
|
129
|
+
*
|
130
|
+
* If \a create is false (the default) this will return a null pointer
|
131
|
+
* if there is no valid ID3v2 tag. If \a create is true it will create
|
132
|
+
* an ID3v1 tag if one does not exist. If there is already an APE tag, the
|
133
|
+
* new ID3v1 tag will be placed after it.
|
134
|
+
*
|
135
|
+
* \note The Tag <b>is still</b> owned by the TrueAudio::File and should not be
|
136
|
+
* deleted by the user. It will be deleted when the file (object) is
|
137
|
+
* destroyed.
|
138
|
+
*/
|
139
|
+
ID3v1::Tag *ID3v1Tag(bool create = false);
|
140
|
+
|
141
|
+
/*!
|
142
|
+
* Returns a pointer to the ID3v1 tag of the file.
|
143
|
+
*
|
144
|
+
* If \a create is false (the default) this will return a null pointer
|
145
|
+
* if there is no valid ID3v1 tag. If \a create is true it will create
|
146
|
+
* an ID3v1 tag if one does not exist. If there is already an APE tag, the
|
147
|
+
* new ID3v1 tag will be placed after it.
|
148
|
+
*
|
149
|
+
* \note The Tag <b>is still</b> owned by the TrueAudio::File and should not be
|
150
|
+
* deleted by the user. It will be deleted when the file (object) is
|
151
|
+
* destroyed.
|
152
|
+
*/
|
153
|
+
ID3v2::Tag *ID3v2Tag(bool create = false);
|
154
|
+
|
155
|
+
/*!
|
156
|
+
* This will remove the tags that match the OR-ed together TagTypes from the
|
157
|
+
* file. By default it removes all tags.
|
158
|
+
*
|
159
|
+
* \note This will also invalidate pointers to the tags
|
160
|
+
* as their memory will be freed.
|
161
|
+
* \note In order to make the removal permanent save() still needs to be called
|
162
|
+
*/
|
163
|
+
void strip(int tags = AllTags);
|
164
|
+
|
165
|
+
private:
|
166
|
+
File(const File &);
|
167
|
+
File &operator=(const File &);
|
168
|
+
|
169
|
+
void read(bool readProperties, Properties::ReadStyle propertiesStyle);
|
170
|
+
void scan();
|
171
|
+
long findID3v1();
|
172
|
+
long findID3v2();
|
173
|
+
|
174
|
+
class FilePrivate;
|
175
|
+
FilePrivate *d;
|
176
|
+
};
|
177
|
+
}
|
178
|
+
}
|
179
|
+
|
180
|
+
#endif
|