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.
Files changed (104) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +84 -9
  3. data/README.txt +0 -0
  4. data/Rakefile +30 -27
  5. data/{test/data → data}/440Hz-5sec.flac +0 -0
  6. data/{test/data → data}/440Hz-5sec.mp3 +0 -0
  7. data/{test/data → data}/440Hz-5sec.mpc +0 -0
  8. data/{test/data → data}/440Hz-5sec.ogg +0 -0
  9. data/{test/data → data}/440Hz-5sec.wv +0 -0
  10. data/data/test_jason.mp3 +0 -0
  11. data/data/test_jason.ogg +0 -0
  12. data/ext/Rakefile +10 -0
  13. data/ext/tagfile/Rakefile.rb +42 -0
  14. data/ext/tagfile/rake_ext_conf.rb +29 -0
  15. data/ext/tagfile/tagfile.c +11 -7
  16. data/ext/taglib/Rakefile.rb +48 -0
  17. data/ext/taglib/rake_ext_conf.rb +33 -0
  18. data/ext/taglib/taglib-mswin32/bin/tag.dll +0 -0
  19. data/ext/taglib/taglib-mswin32/bin/tag_c.dll +0 -0
  20. data/ext/taglib/taglib-mswin32/bin/tag_cd.dll +0 -0
  21. data/ext/taglib/taglib-mswin32/bin/tagd.dll +0 -0
  22. data/ext/taglib/taglib-mswin32/bin/taglib-config +55 -0
  23. data/ext/taglib/taglib-mswin32/include/taglib/apefooter.h +173 -0
  24. data/ext/taglib/taglib-mswin32/include/taglib/apeitem.h +204 -0
  25. data/ext/taglib/taglib-mswin32/include/taglib/apetag.h +162 -0
  26. data/ext/taglib/taglib-mswin32/include/taglib/attachedpictureframe.h +220 -0
  27. data/ext/taglib/taglib-mswin32/include/taglib/audioproperties.h +110 -0
  28. data/ext/taglib/taglib-mswin32/include/taglib/commentsframe.h +168 -0
  29. data/ext/taglib/taglib-mswin32/include/taglib/fileref.h +262 -0
  30. data/ext/taglib/taglib-mswin32/include/taglib/flacfile.h +201 -0
  31. data/ext/taglib/taglib-mswin32/include/taglib/flacproperties.h +92 -0
  32. data/ext/taglib/taglib-mswin32/include/taglib/generalencapsulatedobjectframe.h +174 -0
  33. data/ext/taglib/taglib-mswin32/include/taglib/id3v1genres.h +66 -0
  34. data/ext/taglib/taglib-mswin32/include/taglib/id3v1tag.h +180 -0
  35. data/ext/taglib/taglib-mswin32/include/taglib/id3v2extendedheader.h +93 -0
  36. data/ext/taglib/taglib-mswin32/include/taglib/id3v2footer.h +82 -0
  37. data/ext/taglib/taglib-mswin32/include/taglib/id3v2frame.h +414 -0
  38. data/ext/taglib/taglib-mswin32/include/taglib/id3v2framefactory.h +167 -0
  39. data/ext/taglib/taglib-mswin32/include/taglib/id3v2header.h +175 -0
  40. data/ext/taglib/taglib-mswin32/include/taglib/id3v2synchdata.h +70 -0
  41. data/ext/taglib/taglib-mswin32/include/taglib/id3v2tag.h +300 -0
  42. data/ext/taglib/taglib-mswin32/include/taglib/mpcfile.h +175 -0
  43. data/ext/taglib/taglib-mswin32/include/taglib/mpcproperties.h +85 -0
  44. data/ext/taglib/taglib-mswin32/include/taglib/mpegfile.h +277 -0
  45. data/ext/taglib/taglib-mswin32/include/taglib/mpegheader.h +166 -0
  46. data/ext/taglib/taglib-mswin32/include/taglib/mpegproperties.h +118 -0
  47. data/ext/taglib/taglib-mswin32/include/taglib/oggfile.h +112 -0
  48. data/ext/taglib/taglib-mswin32/include/taglib/oggflacfile.h +118 -0
  49. data/ext/taglib/taglib-mswin32/include/taglib/oggpage.h +203 -0
  50. data/ext/taglib/taglib-mswin32/include/taglib/oggpageheader.h +232 -0
  51. data/ext/taglib/taglib-mswin32/include/taglib/relativevolumeframe.h +274 -0
  52. data/ext/taglib/taglib-mswin32/include/taglib/speexfile.h +99 -0
  53. data/ext/taglib/taglib-mswin32/include/taglib/speexproperties.h +89 -0
  54. data/ext/taglib/taglib-mswin32/include/taglib/tag.h +173 -0
  55. data/ext/taglib/taglib-mswin32/include/taglib/tag_c.h +288 -0
  56. data/ext/taglib/taglib-mswin32/include/taglib/taglib.h +177 -0
  57. data/ext/taglib/taglib-mswin32/include/taglib/taglib_export.h +39 -0
  58. data/ext/taglib/taglib-mswin32/include/taglib/tbytevector.h +409 -0
  59. data/ext/taglib/taglib-mswin32/include/taglib/tbytevectorlist.h +91 -0
  60. data/ext/taglib/taglib-mswin32/include/taglib/textidentificationframe.h +258 -0
  61. data/ext/taglib/taglib-mswin32/include/taglib/tfile.h +271 -0
  62. data/ext/taglib/taglib-mswin32/include/taglib/tlist.h +252 -0
  63. data/ext/taglib/taglib-mswin32/include/taglib/tlist.tcc +316 -0
  64. data/ext/taglib/taglib-mswin32/include/taglib/tmap.h +200 -0
  65. data/ext/taglib/taglib-mswin32/include/taglib/tmap.tcc +196 -0
  66. data/ext/taglib/taglib-mswin32/include/taglib/trueaudiofile.h +180 -0
  67. data/ext/taglib/taglib-mswin32/include/taglib/trueaudioproperties.h +93 -0
  68. data/ext/taglib/taglib-mswin32/include/taglib/tstring.h +456 -0
  69. data/ext/taglib/taglib-mswin32/include/taglib/tstringlist.h +115 -0
  70. data/ext/taglib/taglib-mswin32/include/taglib/uniquefileidentifierframe.h +113 -0
  71. data/ext/taglib/taglib-mswin32/include/taglib/unknownframe.h +79 -0
  72. data/ext/taglib/taglib-mswin32/include/taglib/unsynchronizedlyricsframe.h +157 -0
  73. data/ext/taglib/taglib-mswin32/include/taglib/urllinkframe.h +172 -0
  74. data/ext/taglib/taglib-mswin32/include/taglib/vorbisfile.h +118 -0
  75. data/ext/taglib/taglib-mswin32/include/taglib/vorbisproperties.h +125 -0
  76. data/ext/taglib/taglib-mswin32/include/taglib/wavpackfile.h +164 -0
  77. data/ext/taglib/taglib-mswin32/include/taglib/wavpackproperties.h +94 -0
  78. data/ext/taglib/taglib-mswin32/include/taglib/xingheader.h +100 -0
  79. data/ext/taglib/taglib-mswin32/include/taglib/xiphcomment.h +202 -0
  80. data/ext/taglib/taglib-mswin32/lib/pkgconfig/taglib_c.pc +12 -0
  81. data/ext/taglib/taglib-mswin32/lib/tag.lib +0 -0
  82. data/ext/taglib/taglib-mswin32/lib/tag_c.lib +0 -0
  83. data/ext/taglib/taglib_i386-mingw32.source +22645 -0
  84. data/ext/taglib/taglib_i386-mswin32.source +22645 -0
  85. data/ext/taglib/{taglib.cxx → taglib_x86_64-linux.source} +508 -75
  86. data/lib/TagLib.rb +3 -2
  87. data/lib/TagLib_doc.rb +1532 -1526
  88. data/lib/rtaglib_mswin32.rb +4 -0
  89. data/lib/tagfile.rb +6 -0
  90. data/swig/Doxyfile +0 -0
  91. data/swig/Rakefile +44 -19
  92. data/swig/TagLib_doc.rb +2755 -0
  93. data/swig/make_doc.rb +5 -4
  94. data/swig/process_cxx.rb +2 -2
  95. data/swig/rake_ext_conf.rb +33 -0
  96. data/swig/taglib.i +8 -5
  97. data/swig/test.rb +47 -39
  98. data/test/test_read.rb +4 -3
  99. data/test/test_taglib.rb +47 -39
  100. data/test/test_write.rb +4 -3
  101. metadata +96 -20
  102. data/ext/tagfile/extconf.rb +0 -14
  103. data/ext/taglib/extconf.rb +0 -22
  104. data/swig/extconf.rb +0 -22
@@ -0,0 +1,177 @@
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_H
27
+ #define TAGLIB_H
28
+
29
+ #define TAGLIB_MAJOR_VERSION 1
30
+ #define TAGLIB_MINOR_VERSION 5
31
+ #define TAGLIB_PATCH_VERSION 0
32
+
33
+ #include <string>
34
+
35
+ //! A namespace for all TagLib related classes and functions
36
+
37
+ /*!
38
+ * This namespace contains everything in TagLib. For projects working with
39
+ * TagLib extensively it may be conveniten to add a
40
+ * \code
41
+ * using namespace TagLib;
42
+ * \endcode
43
+ */
44
+
45
+ namespace TagLib {
46
+
47
+ class String;
48
+
49
+ typedef wchar_t wchar;
50
+ typedef unsigned char uchar;
51
+ typedef unsigned int uint;
52
+ typedef unsigned long ulong;
53
+
54
+ /*!
55
+ * Unfortunately std::wstring isn't defined on some systems, (i.e. GCC < 3)
56
+ * so I'm providing something here that should be constant.
57
+ */
58
+ typedef std::basic_string<wchar> wstring;
59
+
60
+ #ifndef DO_NOT_DOCUMENT // Tell Doxygen to skip this class.
61
+ /*!
62
+ * \internal
63
+ * This is just used as a base class for shared classes in TagLib.
64
+ *
65
+ * \warning This <b>is not</b> part of the TagLib public API!
66
+ */
67
+
68
+ class RefCounter
69
+ {
70
+ public:
71
+ RefCounter() : refCount(1) {}
72
+ void ref() { refCount++; }
73
+ bool deref() { return ! --refCount ; }
74
+ int count() { return refCount; }
75
+ private:
76
+ uint refCount;
77
+ };
78
+
79
+ #endif // DO_NOT_DOCUMENT
80
+
81
+ }
82
+
83
+ /*!
84
+ * \mainpage TagLib
85
+ *
86
+ * \section intro Introduction
87
+ *
88
+ * TagLib is a library for reading and editing audio meta data, commonly know as \e tags.
89
+ *
90
+ * Features:
91
+ * - A clean, high level, C++ API to handling audio meta data.
92
+ * - Format specific APIs for advanced API users.
93
+ * - ID3v1, ID3v2, APE, FLAC and Xiph tag formats.
94
+ * - MP3, MPC, FLAC, Ogg FLAC, Ogg Vorbis and Speex file formats.
95
+ * - Basic audio file properties such as length, sample rate, etc.
96
+ * - Long term binary and source compatibility.
97
+ * - Extensible design, notably the ability to add other formats or extend current formats as a library user.
98
+ * - Full support for unicode and internationalized tags.
99
+ * - Dual <a href="http://www.mozilla.org/MPL/MPL-1.1.html">MPL</a> and
100
+ * <a href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html">LGPL</a> licenses.
101
+ * - No external toolkit dependancies.
102
+ *
103
+ * \section why Why TagLib?
104
+ *
105
+ * TagLib originally was written to provide an updated and improved ID3v2 implementation in C++ for use
106
+ * in a variety of Open Source projects. Since development began in 2002 and the 1.0 release in 2004
107
+ * it has expanded to cover a wide variety of tag and file formats and is used in a wide variety of
108
+ * Open Source and proprietary applications. It now supports a variety of UNIXes, including Apple's OS
109
+ * X, as well as Microsoft Windows.
110
+ *
111
+ * \section commercial Usage in Commercial Applications
112
+ *
113
+ * TagLib's licenses \e do allow usage within propriety (\e closed) applications, however TagLib is \e not
114
+ * public domain. Please note the requirements of the LGPL or MPL, and adhere to at least one of them.
115
+ * In simple terms, you must at a minimum note your usage of TagLib, note the licensing terms of TagLib and
116
+ * if you make changes to TagLib publish them. Please review the licenses above before using TagLib in your
117
+ * software. Note that you may choose either the MPL or the LGPL, you do not have to fulfill the
118
+ * requirements of both.
119
+ *
120
+ * \section installing Installing TagLib
121
+ *
122
+ * Please see the <a href="http://developer.kde.org/~wheeler/taglib.html">TagLib website</a> for the latest
123
+ * downloads.
124
+ *
125
+ * Instructions for installing TagLib vary per platform, but generally speaking on UNIX standard configure and
126
+ * make commands are provided. TagLib installs a taglib-config and package-config file to make it easier to
127
+ * integrate into various build systems. Note that TagLib's include install directory \e must be included in
128
+ * the header include path. Simply adding <taglib/tag.h> will \e not work.
129
+ *
130
+ * On Windows, TagLib can be built using the CMake build systems.
131
+ *
132
+ * \section start Getting Started
133
+ *
134
+ * TagLib provides both simple, abstract APIs which make it possible to ignore the differences between tagging
135
+ * formats and format specific APIs which allow programmers to work with the features of specific tagging
136
+ * schemes. There is a similar abstraction mechanism for AudioProperties.
137
+ *
138
+ * The best place to start is with the <b>Class Hierarchy</b> linked at the top of the page. The File and
139
+ * AudioProperties classes and their subclasses are the core of TagLib. The FileRef class is also a convenient
140
+ * way for using a value-based handle.
141
+ *
142
+ * \note When working with FileRef please consider that it has only the most basic (extension-based) file
143
+ * type resolution. Please see its documentation on how to plug in more advanced file type resolution. (Such
144
+ * resolution may be part of later TagLib releases by default.)
145
+ *
146
+ * Here's a very simple example with TagLib:
147
+ *
148
+ * \code
149
+ *
150
+ * TagLib::FileRef f("Latex Solar Beef.mp3");
151
+ * TagLib::String artist = f.tag()->artist(); // artist == "Frank Zappa"
152
+ *
153
+ * f.tag()->setAlbum("Fillmore East");
154
+ * f.save();
155
+ *
156
+ * TagLib::FileRef g("Free City Rhymes.ogg");
157
+ * TagLib::String album = g.tag()->album(); // album == "NYC Ghosts & Flowers"
158
+ *
159
+ * g.tag()->setTrack(1);
160
+ * g.save();
161
+ *
162
+ * \endcode
163
+ *
164
+ * More examples can be found in the \e examples directory of the source distribution.
165
+ *
166
+ * \section Contact
167
+ *
168
+ * Questions about TagLib should be directed to the TagLib mailing list, not directly to the author.
169
+ *
170
+ * - <a href="http://developer.kde.org/~wheeler/taglib/">TagLib Homepage</a>
171
+ * - <a href="https://mail.kde.org/mailman/listinfo/taglib-devel">TagLib Mailing List (taglib-devel@kde.org)</a>
172
+ *
173
+ * \author Scott Wheeler <wheeler@kde.org> et al.
174
+ *
175
+ */
176
+
177
+ #endif
@@ -0,0 +1,39 @@
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_EXPORT_H
27
+ #define TAGLIB_EXPORT_H
28
+
29
+ #if defined(_WIN32) || defined(_WIN64)
30
+ #ifdef MAKE_TAGLIB_LIB
31
+ #define TAGLIB_EXPORT __declspec(dllexport)
32
+ #else
33
+ #define TAGLIB_EXPORT __declspec(dllimport)
34
+ #endif
35
+ #else
36
+ #define TAGLIB_EXPORT
37
+ #endif
38
+
39
+ #endif
@@ -0,0 +1,409 @@
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_BYTEVECTOR_H
27
+ #define TAGLIB_BYTEVECTOR_H
28
+
29
+ #include "taglib.h"
30
+ #include "taglib_export.h"
31
+
32
+ #include <vector>
33
+ #include <ostream>
34
+
35
+ namespace TagLib {
36
+
37
+ //! A byte vector
38
+
39
+ /*!
40
+ * This class provides a byte vector with some methods that are useful for
41
+ * tagging purposes. Many of the search functions are tailored to what is
42
+ * useful for finding tag related paterns in a data array.
43
+ */
44
+
45
+ class TAGLIB_EXPORT ByteVector
46
+ {
47
+ public:
48
+ #ifndef DO_NOT_DOCUMENT
49
+ typedef std::vector<char>::iterator Iterator;
50
+ typedef std::vector<char>::const_iterator ConstIterator;
51
+ #endif
52
+
53
+ /*!
54
+ * Constructs an empty byte vector.
55
+ */
56
+ ByteVector();
57
+
58
+ /*!
59
+ * Construct a vector of size \a size with all values set to \a value by
60
+ * default.
61
+ */
62
+ ByteVector(uint size, char value = 0);
63
+
64
+ /*!
65
+ * Contructs a byte vector that is a copy of \a v.
66
+ */
67
+ ByteVector(const ByteVector &v);
68
+
69
+ /*!
70
+ * Contructs a byte vector that contains \a c.
71
+ */
72
+ ByteVector(char c);
73
+
74
+ /*!
75
+ * Constructs a byte vector that copies \a data for up to \a length bytes.
76
+ */
77
+ ByteVector(const char *data, uint length);
78
+
79
+ /*!
80
+ * Constructs a byte vector that copies \a data up to the first null
81
+ * byte. The behavior is undefined if \a data is not null terminated.
82
+ * This is particularly useful for constructing byte arrays from string
83
+ * constants.
84
+ */
85
+ ByteVector(const char *data);
86
+
87
+ /*!
88
+ * Destroys this ByteVector instance.
89
+ */
90
+ virtual ~ByteVector();
91
+
92
+ /*!
93
+ * Sets the data for the byte array using the first \a length bytes of \a data
94
+ */
95
+ ByteVector &setData(const char *data, uint length);
96
+
97
+ /*!
98
+ * Sets the data for the byte array copies \a data up to the first null
99
+ * byte. The behavior is undefined if \a data is not null terminated.
100
+ */
101
+ ByteVector &setData(const char *data);
102
+
103
+ /*!
104
+ * Returns a pointer to the internal data structure.
105
+ *
106
+ * \warning Care should be taken when modifying this data structure as it is
107
+ * easy to corrupt the ByteVector when doing so. Specifically, while the
108
+ * data may be changed, its length may not be.
109
+ */
110
+ char *data();
111
+
112
+ /*!
113
+ * Returns a pointer to the internal data structure which may not be modified.
114
+ */
115
+ const char *data() const;
116
+
117
+ /*!
118
+ * Returns a byte vector made up of the bytes starting at \a index and
119
+ * for \a length bytes. If \a length is not specified it will return the bytes
120
+ * from \a index to the end of the vector.
121
+ */
122
+ ByteVector mid(uint index, uint length = 0xffffffff) const;
123
+
124
+ /*!
125
+ * This essentially performs the same as operator[](), but instead of causing
126
+ * a runtime error if the index is out of bounds, it will return a null byte.
127
+ */
128
+ char at(uint index) const;
129
+
130
+ /*!
131
+ * Searches the ByteVector for \a pattern starting at \a offset and returns
132
+ * the offset. Returns -1 if the pattern was not found. If \a byteAlign is
133
+ * specified the pattern will only be matched if it starts on a byte divisible
134
+ * by \a byteAlign (starting from \a offset).
135
+ */
136
+ int find(const ByteVector &pattern, uint offset = 0, int byteAlign = 1) const;
137
+
138
+ /*!
139
+ * Searches the ByteVector for \a pattern starting from either the end of the
140
+ * vector or \a offset and returns the offset. Returns -1 if the pattern was
141
+ * not found. If \a byteAlign is specified the pattern will only be matched
142
+ * if it starts on a byte divisible by \a byteAlign (starting from \a offset).
143
+ */
144
+ int rfind(const ByteVector &pattern, uint offset = 0, int byteAlign = 1) const;
145
+
146
+ /*!
147
+ * Checks to see if the vector contains the \a pattern starting at position
148
+ * \a offset. Optionally, if you only want to search for part of the pattern
149
+ * you can specify an offset within the pattern to start from. Also, you can
150
+ * specify to only check for the first \a patternLength bytes of \a pattern with
151
+ * the \a patternLength argument.
152
+ */
153
+ bool containsAt(const ByteVector &pattern, uint offset, uint patternOffset = 0, uint patternLength = 0xffffffff) const;
154
+
155
+ /*!
156
+ * Returns true if the vector starts with \a pattern.
157
+ */
158
+ bool startsWith(const ByteVector &pattern) const;
159
+
160
+ /*!
161
+ * Returns true if the vector ends with \a pattern.
162
+ */
163
+ bool endsWith(const ByteVector &pattern) const;
164
+
165
+ /*!
166
+ * Replaces \a pattern with \a with and returns a reference to the ByteVector
167
+ * after the operation. This \e does modify the vector.
168
+ */
169
+ ByteVector &replace(const ByteVector &pattern, const ByteVector &with);
170
+
171
+ /*!
172
+ * Checks for a partial match of \a pattern at the end of the vector. It
173
+ * returns the offset of the partial match within the vector, or -1 if the
174
+ * pattern is not found. This method is particularly useful when searching for
175
+ * patterns that start in one vector and end in another. When combined with
176
+ * startsWith() it can be used to find a pattern that overlaps two buffers.
177
+ *
178
+ * \note This will not match the complete pattern at the end of the string; use
179
+ * endsWith() for that.
180
+ */
181
+ int endsWithPartialMatch(const ByteVector &pattern) const;
182
+
183
+ /*!
184
+ * Appends \a v to the end of the ByteVector.
185
+ */
186
+ ByteVector &append(const ByteVector &v);
187
+
188
+ /*!
189
+ * Clears the data.
190
+ */
191
+ ByteVector &clear();
192
+
193
+ /*!
194
+ * Returns the size of the array.
195
+ */
196
+ uint size() const;
197
+
198
+ /*!
199
+ * Resize the vector to \a size. If the vector is currently less than
200
+ * \a size, pad the remaining spaces with \a padding. Returns a reference
201
+ * to the resized vector.
202
+ */
203
+ ByteVector &resize(uint size, char padding = 0);
204
+
205
+ /*!
206
+ * Returns an Iterator that points to the front of the vector.
207
+ */
208
+ Iterator begin();
209
+
210
+ /*!
211
+ * Returns a ConstIterator that points to the front of the vector.
212
+ */
213
+ ConstIterator begin() const;
214
+
215
+ /*!
216
+ * Returns an Iterator that points to the back of the vector.
217
+ */
218
+ Iterator end();
219
+
220
+ /*!
221
+ * Returns a ConstIterator that points to the back of the vector.
222
+ */
223
+ ConstIterator end() const;
224
+
225
+ /*!
226
+ * Returns true if the vector is null.
227
+ *
228
+ * \note A vector may be empty without being null.
229
+ * \see isEmpty()
230
+ */
231
+ bool isNull() const;
232
+
233
+ /*!
234
+ * Returns true if the ByteVector is empty.
235
+ *
236
+ * \see size()
237
+ * \see isNull()
238
+ */
239
+ bool isEmpty() const;
240
+
241
+ /*!
242
+ * Returns a CRC checksum of the byte vector's data.
243
+ */
244
+ uint checksum() const;
245
+
246
+ /*!
247
+ * Converts the first 4 bytes of the vector to an unsigned integer.
248
+ *
249
+ * If \a mostSignificantByteFirst is true this will operate left to right
250
+ * evaluating the integer. For example if \a mostSignificantByteFirst is
251
+ * true then $00 $00 $00 $01 == 0x00000001 == 1, if false, $01 00 00 00 ==
252
+ * 0x01000000 == 1.
253
+ *
254
+ * \see fromUInt()
255
+ */
256
+ uint toUInt(bool mostSignificantByteFirst = true) const;
257
+
258
+ /*!
259
+ * Converts the first 2 bytes of the vector to a short.
260
+ *
261
+ * If \a mostSignificantByteFirst is true this will operate left to right
262
+ * evaluating the integer. For example if \a mostSignificantByteFirst is
263
+ * true then $00 $01 == 0x0001 == 1, if false, $01 00 == 0x01000000 == 1.
264
+ *
265
+ * \see fromShort()
266
+ */
267
+ short toShort(bool mostSignificantByteFirst = true) const;
268
+
269
+ /*!
270
+ * Converts the first 8 bytes of the vector to a (signed) long long.
271
+ *
272
+ * If \a mostSignificantByteFirst is true this will operate left to right
273
+ * evaluating the integer. For example if \a mostSignificantByteFirst is
274
+ * true then $00 00 00 00 00 00 00 01 == 0x0000000000000001 == 1,
275
+ * if false, $01 00 00 00 00 00 00 00 == 0x0100000000000000 == 1.
276
+ *
277
+ * \see fromUInt()
278
+ */
279
+ long long toLongLong(bool mostSignificantByteFirst = true) const;
280
+
281
+ /*!
282
+ * Creates a 4 byte ByteVector based on \a value. If
283
+ * \a mostSignificantByteFirst is true, then this will operate left to right
284
+ * in building the ByteVector. For example if \a mostSignificantByteFirst is
285
+ * true then $00 00 00 01 == 0x00000001 == 1, if false, $01 00 00 00 ==
286
+ * 0x01000000 == 1.
287
+ *
288
+ * \see toUInt()
289
+ */
290
+ static ByteVector fromUInt(uint value, bool mostSignificantByteFirst = true);
291
+
292
+ /*!
293
+ * Creates a 2 byte ByteVector based on \a value. If
294
+ * \a mostSignificantByteFirst is true, then this will operate left to right
295
+ * in building the ByteVector. For example if \a mostSignificantByteFirst is
296
+ * true then $00 01 == 0x0001 == 1, if false, $01 00 == 0x0100 == 1.
297
+ *
298
+ * \see toShort()
299
+ */
300
+ static ByteVector fromShort(short value, bool mostSignificantByteFirst = true);
301
+
302
+ /*!
303
+ * Creates a 8 byte ByteVector based on \a value. If
304
+ * \a mostSignificantByteFirst is true, then this will operate left to right
305
+ * in building the ByteVector. For example if \a mostSignificantByteFirst is
306
+ * true then $00 00 00 01 == 0x0000000000000001 == 1, if false,
307
+ * $01 00 00 00 00 00 00 00 == 0x0100000000000000 == 1.
308
+ *
309
+ * \see toLongLong()
310
+ */
311
+ static ByteVector fromLongLong(long long value, bool mostSignificantByteFirst = true);
312
+
313
+ /*!
314
+ * Returns a ByteVector based on the CString \a s.
315
+ */
316
+ static ByteVector fromCString(const char *s, uint length = 0xffffffff);
317
+
318
+ /*!
319
+ * Returns a const refernence to the byte at \a index.
320
+ */
321
+ const char &operator[](int index) const;
322
+
323
+ /*!
324
+ * Returns a reference to the byte at \a index.
325
+ */
326
+ char &operator[](int index);
327
+
328
+ /*!
329
+ * Returns true if this ByteVector and \a v are equal.
330
+ */
331
+ bool operator==(const ByteVector &v) const;
332
+
333
+ /*!
334
+ * Returns true if this ByteVector and \a v are not equal.
335
+ */
336
+ bool operator!=(const ByteVector &v) const;
337
+
338
+ /*!
339
+ * Returns true if this ByteVector and the null terminated C string \a s
340
+ * contain the same data.
341
+ */
342
+ bool operator==(const char *s) const;
343
+
344
+ /*!
345
+ * Returns true if this ByteVector and the null terminated C string \a s
346
+ * do not contain the same data.
347
+ */
348
+ bool operator!=(const char *s) const;
349
+
350
+ /*!
351
+ * Returns true if this ByteVector is less than \a v. The value of the
352
+ * vectors is determined by evaluating the character from left to right, and
353
+ * in the event one vector is a superset of the other, the size is used.
354
+ */
355
+ bool operator<(const ByteVector &v) const;
356
+
357
+ /*!
358
+ * Returns true if this ByteVector is greater than \a v.
359
+ */
360
+ bool operator>(const ByteVector &v) const;
361
+
362
+ /*!
363
+ * Returns a vector that is \a v appended to this vector.
364
+ */
365
+ ByteVector operator+(const ByteVector &v) const;
366
+
367
+ /*!
368
+ * Copies ByteVector \a v.
369
+ */
370
+ ByteVector &operator=(const ByteVector &v);
371
+
372
+ /*!
373
+ * Copies ByteVector \a v.
374
+ */
375
+ ByteVector &operator=(char c);
376
+
377
+ /*!
378
+ * Copies ByteVector \a v.
379
+ */
380
+ ByteVector &operator=(const char *data);
381
+
382
+ /*!
383
+ * A static, empty ByteVector which is convenient and fast (since returning
384
+ * an empty or "null" value does not require instantiating a new ByteVector).
385
+ */
386
+ static ByteVector null;
387
+
388
+ protected:
389
+ /*
390
+ * If this ByteVector is being shared via implicit sharing, do a deep copy
391
+ * of the data and separate from the shared members. This should be called
392
+ * by all non-const subclass members.
393
+ */
394
+ void detach();
395
+
396
+ private:
397
+ class ByteVectorPrivate;
398
+ ByteVectorPrivate *d;
399
+ };
400
+
401
+ }
402
+
403
+ /*!
404
+ * \relates TagLib::ByteVector
405
+ * Streams the ByteVector \a v to the output stream \a s.
406
+ */
407
+ TAGLIB_EXPORT std::ostream &operator<<(std::ostream &s, const TagLib::ByteVector &v);
408
+
409
+ #endif