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,93 @@
|
|
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_TRUEAUDIOPROPERTIES_H
|
31
|
+
#define TAGLIB_TRUEAUDIOPROPERTIES_H
|
32
|
+
|
33
|
+
#include "audioproperties.h"
|
34
|
+
|
35
|
+
namespace TagLib {
|
36
|
+
|
37
|
+
namespace TrueAudio {
|
38
|
+
|
39
|
+
class File;
|
40
|
+
|
41
|
+
static const uint HeaderSize = 18;
|
42
|
+
|
43
|
+
//! An implementation of audio property reading for TrueAudio
|
44
|
+
|
45
|
+
/*!
|
46
|
+
* This reads the data from an TrueAudio stream found in the AudioProperties
|
47
|
+
* API.
|
48
|
+
*/
|
49
|
+
|
50
|
+
class TAGLIB_EXPORT Properties : public AudioProperties
|
51
|
+
{
|
52
|
+
public:
|
53
|
+
/*!
|
54
|
+
* Create an instance of TrueAudio::Properties with the data read from the
|
55
|
+
* ByteVector \a data.
|
56
|
+
*/
|
57
|
+
Properties(const ByteVector &data, long streamLength, ReadStyle style = Average);
|
58
|
+
|
59
|
+
/*!
|
60
|
+
* Destroys this TrueAudio::Properties instance.
|
61
|
+
*/
|
62
|
+
virtual ~Properties();
|
63
|
+
|
64
|
+
// Reimplementations.
|
65
|
+
|
66
|
+
virtual int length() const;
|
67
|
+
virtual int bitrate() const;
|
68
|
+
virtual int sampleRate() const;
|
69
|
+
virtual int channels() const;
|
70
|
+
|
71
|
+
/*!
|
72
|
+
* Returns number of bits per sample.
|
73
|
+
*/
|
74
|
+
int bitsPerSample() const;
|
75
|
+
|
76
|
+
/*!
|
77
|
+
* Returns the major version number.
|
78
|
+
*/
|
79
|
+
int ttaVersion() const;
|
80
|
+
|
81
|
+
private:
|
82
|
+
Properties(const Properties &);
|
83
|
+
Properties &operator=(const Properties &);
|
84
|
+
|
85
|
+
void read();
|
86
|
+
|
87
|
+
class PropertiesPrivate;
|
88
|
+
PropertiesPrivate *d;
|
89
|
+
};
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
#endif
|
@@ -0,0 +1,456 @@
|
|
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_STRING_H
|
27
|
+
#define TAGLIB_STRING_H
|
28
|
+
|
29
|
+
#include "taglib_export.h"
|
30
|
+
#include "taglib.h"
|
31
|
+
#include "tbytevector.h"
|
32
|
+
|
33
|
+
#include <string>
|
34
|
+
#include <ostream>
|
35
|
+
|
36
|
+
/*!
|
37
|
+
* \relates TagLib::String
|
38
|
+
*
|
39
|
+
* Converts a TagLib::String to a QString without a requirement to link to Qt.
|
40
|
+
*/
|
41
|
+
#define QStringToTString(s) TagLib::String(s.utf8().data(), TagLib::String::UTF8)
|
42
|
+
|
43
|
+
/*!
|
44
|
+
* \relates TagLib::String
|
45
|
+
*
|
46
|
+
* Converts a TagLib::String to a QString without a requirement to link to Qt.
|
47
|
+
*/
|
48
|
+
#define TStringToQString(s) QString::fromUtf8(s.toCString(true))
|
49
|
+
|
50
|
+
namespace TagLib {
|
51
|
+
|
52
|
+
//! A \e wide string class suitable for unicode.
|
53
|
+
|
54
|
+
/*!
|
55
|
+
* This is an implicitly shared \e wide string. For storage it uses
|
56
|
+
* TagLib::wstring, but as this is an <i>implementation detail</i> this of
|
57
|
+
* course could change. Strings are stored internally as UTF-16BE. (Without
|
58
|
+
* the BOM (Byte Order Mark)
|
59
|
+
*
|
60
|
+
* The use of implicit sharing means that copying a string is cheap, the only
|
61
|
+
* \e cost comes into play when the copy is modified. Prior to that the string
|
62
|
+
* just has a pointer to the data of the \e parent String. This also makes
|
63
|
+
* this class suitable as a function return type.
|
64
|
+
*
|
65
|
+
* In addition to adding implicit sharing, this class keeps track of four
|
66
|
+
* possible encodings, which are the four supported by the ID3v2 standard.
|
67
|
+
*/
|
68
|
+
|
69
|
+
class TAGLIB_EXPORT String
|
70
|
+
{
|
71
|
+
public:
|
72
|
+
|
73
|
+
#ifndef DO_NOT_DOCUMENT
|
74
|
+
typedef std::basic_string<wchar>::iterator Iterator;
|
75
|
+
typedef std::basic_string<wchar>::const_iterator ConstIterator;
|
76
|
+
#endif
|
77
|
+
|
78
|
+
/**
|
79
|
+
* The four types of string encodings supported by the ID3v2 specification.
|
80
|
+
* ID3v1 is assumed to be Latin1 and Ogg Vorbis comments use UTF8.
|
81
|
+
*/
|
82
|
+
enum Type {
|
83
|
+
/*!
|
84
|
+
* IS08859-1, or <i>Latin1</i> encoding. 8 bit characters.
|
85
|
+
*/
|
86
|
+
Latin1 = 0,
|
87
|
+
/*!
|
88
|
+
* UTF16 with a <i>byte order mark</i>. 16 bit characters.
|
89
|
+
*/
|
90
|
+
UTF16 = 1,
|
91
|
+
/*!
|
92
|
+
* UTF16 <i>big endian</i>. 16 bit characters. This is the encoding used
|
93
|
+
* internally by TagLib.
|
94
|
+
*/
|
95
|
+
UTF16BE = 2,
|
96
|
+
/*!
|
97
|
+
* UTF8 encoding. Characters are usually 8 bits but can be up to 32.
|
98
|
+
*/
|
99
|
+
UTF8 = 3,
|
100
|
+
/*!
|
101
|
+
* UTF16 <i>little endian</i>. 16 bit characters.
|
102
|
+
*/
|
103
|
+
UTF16LE = 4
|
104
|
+
};
|
105
|
+
|
106
|
+
/*!
|
107
|
+
* Constructs an empty String.
|
108
|
+
*/
|
109
|
+
String();
|
110
|
+
|
111
|
+
/*!
|
112
|
+
* Make a shallow, implicitly shared, copy of \a s. Because this is
|
113
|
+
* implicitly shared, this method is lightweight and suitable for
|
114
|
+
* pass-by-value usage.
|
115
|
+
*/
|
116
|
+
String(const String &s);
|
117
|
+
|
118
|
+
/*!
|
119
|
+
* Makes a deep copy of the data in \a s.
|
120
|
+
*
|
121
|
+
* \note This should only be used with the 8-bit codecs Latin1 and UTF8, when
|
122
|
+
* used with other codecs it will simply print a warning and exit.
|
123
|
+
*/
|
124
|
+
String(const std::string &s, Type t = Latin1);
|
125
|
+
|
126
|
+
/*!
|
127
|
+
* Makes a deep copy of the data in \a s.
|
128
|
+
*/
|
129
|
+
String(const wstring &s, Type t = UTF16BE);
|
130
|
+
|
131
|
+
/*!
|
132
|
+
* Makes a deep copy of the data in \a s.
|
133
|
+
*/
|
134
|
+
String(const wchar_t *s, Type t = UTF16BE);
|
135
|
+
|
136
|
+
/*!
|
137
|
+
* Makes a deep copy of the data in \a c.
|
138
|
+
*
|
139
|
+
* \note This should only be used with the 8-bit codecs Latin1 and UTF8, when
|
140
|
+
* used with other codecs it will simply print a warning and exit.
|
141
|
+
*/
|
142
|
+
String(char c, Type t = Latin1);
|
143
|
+
|
144
|
+
/*!
|
145
|
+
* Makes a deep copy of the data in \a c.
|
146
|
+
*/
|
147
|
+
String(wchar_t c, Type t = Latin1);
|
148
|
+
|
149
|
+
|
150
|
+
/*!
|
151
|
+
* Makes a deep copy of the data in \a s.
|
152
|
+
*
|
153
|
+
* \note This should only be used with the 8-bit codecs Latin1 and UTF8, when
|
154
|
+
* used with other codecs it will simply print a warning and exit.
|
155
|
+
*/
|
156
|
+
String(const char *s, Type t = Latin1);
|
157
|
+
|
158
|
+
/*!
|
159
|
+
* Makes a deep copy of the data in \a s.
|
160
|
+
*
|
161
|
+
* \note This should only be used with the 8-bit codecs Latin1 and UTF8, when
|
162
|
+
* used with other codecs it will simply print a warning and exit.
|
163
|
+
*/
|
164
|
+
String(const ByteVector &v, Type t = Latin1);
|
165
|
+
|
166
|
+
/*!
|
167
|
+
* Destroys this String instance.
|
168
|
+
*/
|
169
|
+
virtual ~String();
|
170
|
+
|
171
|
+
/*!
|
172
|
+
* If \a unicode if false (the default) this will return a \e Latin1 encoded
|
173
|
+
* std::string. If it is true the returned std::wstring will be UTF-8
|
174
|
+
* encoded.
|
175
|
+
*/
|
176
|
+
std::string to8Bit(bool unicode = false) const;
|
177
|
+
|
178
|
+
/*!
|
179
|
+
* Returns a wstring version of the TagLib string as a wide string.
|
180
|
+
*/
|
181
|
+
wstring toWString() const;
|
182
|
+
|
183
|
+
/*!
|
184
|
+
* Creates and returns a C-String based on the data. This string is still
|
185
|
+
* owned by the String (class) and as such should not be deleted by the user.
|
186
|
+
*
|
187
|
+
* If \a unicode if false (the default) this string will be encoded in
|
188
|
+
* \e Latin1. If it is true the returned C-String will be UTF-8 encoded.
|
189
|
+
*
|
190
|
+
* This string remains valid until the String instance is destroyed or
|
191
|
+
* another export method is called.
|
192
|
+
*
|
193
|
+
* \warning This however has the side effect that this C-String will remain
|
194
|
+
* in memory <b>in addition to</b> other memory that is consumed by the
|
195
|
+
* String instance. So, this method should not be used on large strings or
|
196
|
+
* where memory is critical.
|
197
|
+
*/
|
198
|
+
const char *toCString(bool unicode = false) const;
|
199
|
+
|
200
|
+
/*!
|
201
|
+
* Returns an iterator pointing to the beginning of the string.
|
202
|
+
*/
|
203
|
+
Iterator begin();
|
204
|
+
|
205
|
+
/*!
|
206
|
+
* Returns a const iterator pointing to the beginning of the string.
|
207
|
+
*/
|
208
|
+
ConstIterator begin() const;
|
209
|
+
|
210
|
+
/*!
|
211
|
+
* Returns an iterator pointing to the end of the string (the position
|
212
|
+
* after the last character).
|
213
|
+
*/
|
214
|
+
Iterator end();
|
215
|
+
|
216
|
+
/*!
|
217
|
+
* Returns a const iterator pointing to the end of the string (the position
|
218
|
+
* after the last character).
|
219
|
+
*/
|
220
|
+
ConstIterator end() const;
|
221
|
+
|
222
|
+
/*!
|
223
|
+
* Finds the first occurrence of pattern \a s in this string starting from
|
224
|
+
* \a offset. If the pattern is not found, -1 is returned.
|
225
|
+
*/
|
226
|
+
int find(const String &s, int offset = 0) const;
|
227
|
+
|
228
|
+
/*!
|
229
|
+
* Returns true if the strings starts with the substring \a s.
|
230
|
+
*/
|
231
|
+
bool startsWith(const String &s) const;
|
232
|
+
|
233
|
+
/*!
|
234
|
+
* Extract a substring from this string starting at \a position and
|
235
|
+
* continuing for \a n characters.
|
236
|
+
*/
|
237
|
+
String substr(uint position, uint n = 0xffffffff) const;
|
238
|
+
|
239
|
+
/*!
|
240
|
+
* Append \a s to the current string and return a reference to the current
|
241
|
+
* string.
|
242
|
+
*/
|
243
|
+
String &append(const String &s);
|
244
|
+
|
245
|
+
/*!
|
246
|
+
* Returns an upper case version of the string.
|
247
|
+
*
|
248
|
+
* \warning This only works for the characters in US-ASCII, i.e. A-Z.
|
249
|
+
*/
|
250
|
+
String upper() const;
|
251
|
+
|
252
|
+
/*!
|
253
|
+
* Returns the size of the string.
|
254
|
+
*/
|
255
|
+
uint size() const;
|
256
|
+
|
257
|
+
/*!
|
258
|
+
* Returns the length of the string. Equivalent to size().
|
259
|
+
*/
|
260
|
+
uint length() const;
|
261
|
+
|
262
|
+
/*!
|
263
|
+
* Returns true if the string is empty.
|
264
|
+
*
|
265
|
+
* \see isNull()
|
266
|
+
*/
|
267
|
+
bool isEmpty() const;
|
268
|
+
|
269
|
+
/*!
|
270
|
+
* Returns true if this string is null -- i.e. it is a copy of the
|
271
|
+
* String::null string.
|
272
|
+
*
|
273
|
+
* \note A string can be empty and not null.
|
274
|
+
* \see isEmpty()
|
275
|
+
*/
|
276
|
+
bool isNull() const;
|
277
|
+
|
278
|
+
/*!
|
279
|
+
* Returns a ByteVector containing the string's data. If \a t is Latin1 or
|
280
|
+
* UTF8, this will return a vector of 8 bit characters, otherwise it will use
|
281
|
+
* 16 bit characters.
|
282
|
+
*/
|
283
|
+
ByteVector data(Type t) const;
|
284
|
+
|
285
|
+
/*!
|
286
|
+
* Convert the string to an integer.
|
287
|
+
*/
|
288
|
+
int toInt() const;
|
289
|
+
|
290
|
+
/*!
|
291
|
+
* Returns a string with the leading and trailing whitespace stripped.
|
292
|
+
*/
|
293
|
+
String stripWhiteSpace() const;
|
294
|
+
|
295
|
+
/*!
|
296
|
+
* Returns true if the file only uses characters required by Latin1.
|
297
|
+
*/
|
298
|
+
bool isLatin1() const;
|
299
|
+
|
300
|
+
/*!
|
301
|
+
* Returns true if the file only uses characters required by (7-bit) ASCII.
|
302
|
+
*/
|
303
|
+
bool isAscii() const;
|
304
|
+
|
305
|
+
/*!
|
306
|
+
* Converts the base-10 integer \a n to a string.
|
307
|
+
*/
|
308
|
+
static String number(int n);
|
309
|
+
|
310
|
+
/*!
|
311
|
+
* Returns a reference to the character at position \a i.
|
312
|
+
*/
|
313
|
+
wchar &operator[](int i);
|
314
|
+
|
315
|
+
/*!
|
316
|
+
* Returns a const reference to the character at position \a i.
|
317
|
+
*/
|
318
|
+
const wchar &operator[](int i) const;
|
319
|
+
|
320
|
+
/*!
|
321
|
+
* Compares each character of the String with each character of \a s and
|
322
|
+
* returns true if the strings match.
|
323
|
+
*/
|
324
|
+
bool operator==(const String &s) const;
|
325
|
+
|
326
|
+
/*!
|
327
|
+
* Appends \a s to the end of the String.
|
328
|
+
*/
|
329
|
+
String &operator+=(const String &s);
|
330
|
+
|
331
|
+
/*!
|
332
|
+
* Appends \a s to the end of the String.
|
333
|
+
*/
|
334
|
+
String &operator+=(const wchar_t* s);
|
335
|
+
|
336
|
+
/*!
|
337
|
+
* Appends \a s to the end of the String.
|
338
|
+
*/
|
339
|
+
String &operator+=(const char* s);
|
340
|
+
|
341
|
+
/*!
|
342
|
+
* Appends \a s to the end of the String.
|
343
|
+
*/
|
344
|
+
String &operator+=(wchar_t c);
|
345
|
+
|
346
|
+
/*!
|
347
|
+
* Appends \a c to the end of the String.
|
348
|
+
*/
|
349
|
+
String &operator+=(char c);
|
350
|
+
|
351
|
+
/*!
|
352
|
+
* Performs a shallow, implicitly shared, copy of \a s, overwriting the
|
353
|
+
* String's current data.
|
354
|
+
*/
|
355
|
+
String &operator=(const String &s);
|
356
|
+
|
357
|
+
/*!
|
358
|
+
* Performs a deep copy of the data in \a s.
|
359
|
+
*/
|
360
|
+
String &operator=(const std::string &s);
|
361
|
+
|
362
|
+
/*!
|
363
|
+
* Performs a deep copy of the data in \a s.
|
364
|
+
*/
|
365
|
+
String &operator=(const wstring &s);
|
366
|
+
|
367
|
+
/*!
|
368
|
+
* Performs a deep copy of the data in \a s.
|
369
|
+
*/
|
370
|
+
String &operator=(const wchar_t *s);
|
371
|
+
|
372
|
+
/*!
|
373
|
+
* Performs a deep copy of the data in \a s.
|
374
|
+
*/
|
375
|
+
String &operator=(char c);
|
376
|
+
|
377
|
+
/*!
|
378
|
+
* Performs a deep copy of the data in \a s.
|
379
|
+
*/
|
380
|
+
String &operator=(wchar_t c);
|
381
|
+
|
382
|
+
/*!
|
383
|
+
* Performs a deep copy of the data in \a s.
|
384
|
+
*/
|
385
|
+
String &operator=(const char *s);
|
386
|
+
|
387
|
+
/*!
|
388
|
+
* Performs a deep copy of the data in \a v.
|
389
|
+
*/
|
390
|
+
String &operator=(const ByteVector &v);
|
391
|
+
|
392
|
+
/*!
|
393
|
+
* To be able to use this class in a Map, this operator needed to be
|
394
|
+
* implemented. Returns true if \a s is less than this string in a bytewise
|
395
|
+
* comparison.
|
396
|
+
*/
|
397
|
+
bool operator<(const String &s) const;
|
398
|
+
|
399
|
+
/*!
|
400
|
+
* A null string provided for convenience.
|
401
|
+
*/
|
402
|
+
static String null;
|
403
|
+
|
404
|
+
protected:
|
405
|
+
/*!
|
406
|
+
* If this String is being shared via implicit sharing, do a deep copy of the
|
407
|
+
* data and separate from the shared members. This should be called by all
|
408
|
+
* non-const subclass members.
|
409
|
+
*/
|
410
|
+
void detach();
|
411
|
+
|
412
|
+
private:
|
413
|
+
/*!
|
414
|
+
* This checks to see if the string is in \e UTF-16 (with BOM) or \e UTF-8
|
415
|
+
* format and if so converts it to \e UTF-16BE for internal use. \e Latin1
|
416
|
+
* does not require conversion since it is a subset of \e UTF-16BE and
|
417
|
+
* \e UTF16-BE requires no conversion since it is used internally.
|
418
|
+
*/
|
419
|
+
void prepare(Type t);
|
420
|
+
|
421
|
+
class StringPrivate;
|
422
|
+
StringPrivate *d;
|
423
|
+
};
|
424
|
+
|
425
|
+
}
|
426
|
+
|
427
|
+
/*!
|
428
|
+
* \relates TagLib::String
|
429
|
+
*
|
430
|
+
* Concatenates \a s1 and \a s2 and returns the result as a string.
|
431
|
+
*/
|
432
|
+
TAGLIB_EXPORT const TagLib::String operator+(const TagLib::String &s1, const TagLib::String &s2);
|
433
|
+
|
434
|
+
/*!
|
435
|
+
* \relates TagLib::String
|
436
|
+
*
|
437
|
+
* Concatenates \a s1 and \a s2 and returns the result as a string.
|
438
|
+
*/
|
439
|
+
TAGLIB_EXPORT const TagLib::String operator+(const char *s1, const TagLib::String &s2);
|
440
|
+
|
441
|
+
/*!
|
442
|
+
* \relates TagLib::String
|
443
|
+
*
|
444
|
+
* Concatenates \a s1 and \a s2 and returns the result as a string.
|
445
|
+
*/
|
446
|
+
TAGLIB_EXPORT const TagLib::String operator+(const TagLib::String &s1, const char *s2);
|
447
|
+
|
448
|
+
|
449
|
+
/*!
|
450
|
+
* \relates TagLib::String
|
451
|
+
*
|
452
|
+
* Send the string to an output stream.
|
453
|
+
*/
|
454
|
+
TAGLIB_EXPORT std::ostream &operator<<(std::ostream &s, const TagLib::String &str);
|
455
|
+
|
456
|
+
#endif
|