id3lib-ruby 0.1.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/CHANGES ADDED
@@ -0,0 +1,14 @@
1
+ = id3lib-ruby Changes
2
+
3
+ === Before release
4
+
5
+ * New: Everything.
6
+ * Get rid of ID3::Frame and use normal Hash instead.
7
+ * Clean up ID3::Frames and Fields -> replace them with an ID3::Info module.
8
+ * How to set ID3 genre?
9
+ * Replace Accessors.add with normal function definitions
10
+ * Document library with RDOC.
11
+ * Add more frame accessor methods (maybe there are now too much?).
12
+ * Added reading and writing of UTF-16 frames. Works only with ID3v2.
13
+ * Renamed extension ID3Lib to ID3Lib::API and module ID3 to ID3Lib.
14
+ * Finish and test gem specification.
data/README ADDED
@@ -0,0 +1,91 @@
1
+
2
+ = id3lib-ruby
3
+
4
+ id3lib-ruby provides a Ruby interface to the id3lib C++ library for easily
5
+ editing ID3 tags (v1 and v2) like with pyid3lib.
6
+
7
+ The class documentation starts at ID3Lib::Tag.
8
+
9
+
10
+ == Features
11
+
12
+ * Read and write ID3v1 or ID3v2 tags
13
+ * Simple interface for adding, changing and removing frames
14
+ * Quick access to common text frames like title and performer
15
+ * Custom data frames like attached picture (APIC)
16
+ * Pretty complete coverage of id3lib's features
17
+ * UTF-16 support
18
+
19
+ See TODO for planned features.
20
+
21
+ The CHANGES file contains a list of changes between versions.
22
+
23
+
24
+ == Online Information
25
+
26
+ The home of id3lib-ruby is http://id3lib-ruby.rubyforge.org
27
+
28
+
29
+ == Installation
30
+
31
+ Installation through Rubygems:
32
+
33
+ gem install id3lib-ruby
34
+
35
+ Manual installation:
36
+
37
+ ruby setup.rb
38
+
39
+ == Usage
40
+
41
+ require 'rubygems'
42
+ require 'id3lib'
43
+
44
+ # Load a tag from a file
45
+ tag = ID3Lib::Tag.new('talk.mp3')
46
+
47
+ # Get and set text frames with convenience methods
48
+ tag.title #=> "Talk"
49
+ tag.album = 'X&Y'
50
+ tag.track = '5/13'
51
+
52
+ # Tag is a subclass of Array and each frame is a Hash
53
+ tag[0]
54
+ #=> { :id => :TPE1, :textenc => 0, :text => "Coldplay" }
55
+
56
+ # Get the number of frames
57
+ tag.length #=> 7
58
+
59
+ # Remove all comment frames
60
+ tag.delete_if{ |frame| frame[:id] == :COMM }
61
+
62
+ # Get info about APIC frame to see which fields are allowed
63
+ ID3Lib::Info.frame(:APIC)
64
+ #=> [ 2, :APIC, "Attached picture",
65
+ #=> [:textenc, :mimetype, :picturetype, :description, :data] ]
66
+
67
+ # Add an attached picture frame
68
+ cover = {
69
+ :id => :APIC,
70
+ :mimetype => 'image/jpeg',
71
+ :picturetype => 3,
72
+ :description => 'A pretty picture',
73
+ :textenc => 0,
74
+ :data => File.read('cover.jpg')
75
+ }
76
+ tag << cover
77
+
78
+ # Last but not least, apply changes
79
+ tag.update!
80
+
81
+
82
+ == Licence
83
+
84
+ This library has Ruby's licence:
85
+
86
+ http://www.ruby-lang.org/en/LICENSE.txt
87
+
88
+
89
+ == Author
90
+
91
+ Robin Stocker <robinstocker at rubyforge.org>
data/Rakefile ADDED
@@ -0,0 +1,108 @@
1
+
2
+ begin
3
+ require 'rubygems'
4
+ require 'rake/gempackagetask'
5
+ rescue Exception
6
+ nil
7
+ end
8
+
9
+ require 'rake/testtask'
10
+ require 'rake/rdoctask'
11
+
12
+
13
+ PKG_VERSION = '0.1.0'
14
+
15
+ PKG_FILES = FileList[
16
+ 'lib/**/*.rb',
17
+ 'ext/extconf.rb',
18
+ 'ext/*.cxx',
19
+ 'test/test_*.rb',
20
+ 'test/data/*.mp3',
21
+ 'test/data/cover.jpg',
22
+ 'Rakefile',
23
+ 'setup.rb'
24
+ ]
25
+
26
+
27
+ desc 'Default task is to build extension.'
28
+ task :default => [:ext]
29
+
30
+
31
+ desc "Build extension."
32
+ task :ext do
33
+ sh "cd ext && rake"
34
+ puts "(end)"
35
+ end
36
+
37
+
38
+ Rake::TestTask.new do |t|
39
+ t.libs = ['lib', 'ext']
40
+ t.test_files = FileList['test/test_*.rb']
41
+ t.verbose = true
42
+ end
43
+
44
+
45
+ RDOC_OPTS = ['--line-numbers', '--main', 'README']
46
+
47
+ desc "Generate RDOC documentation."
48
+ Rake::RDocTask.new :rdoc do |rdoc|
49
+ rdoc.rdoc_dir = 'doc'
50
+ rdoc.title = 'id3lib-ruby'
51
+ rdoc.options = RDOC_OPTS
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ rdoc.rdoc_files.include('README', 'TODO', 'CHANGES')
54
+ end
55
+ task :doc => [:rdoc]
56
+
57
+
58
+ if defined? Gem
59
+ spec = Gem::Specification.new do |s|
60
+ s.name = 'id3lib-ruby'
61
+ s.version = PKG_VERSION
62
+ s.summary =
63
+ 'id3lib-ruby provides a Ruby interface to the id3lib C++ library for ' +
64
+ 'easily editing ID3 tags (v1 and v2) like with pyid3lib.'
65
+ s.requirements << 'id3lib C++ library'
66
+ s.files = PKG_FILES
67
+ s.extensions = ['ext/extconf.rb']
68
+ s.test_files = FileList['test/test_*.rb']
69
+ s.has_rdoc = true
70
+ s.extra_rdoc_files = FileList['README', 'CHANGES', 'TODO']
71
+ s.rdoc_options = RDOC_OPTS
72
+ s.author = 'Robin Stocker'
73
+ s.email = 'robinstocker@rubyforge.org'
74
+ s.homepage = 'http://id3lib-ruby.rubyforge.org'
75
+ s.rubyforge_project = "id3lib-ruby"
76
+ end
77
+
78
+ Rake::GemPackageTask.new(spec) do |pkg|
79
+ pkg.need_tar_gz = true
80
+ pkg.need_zip = true
81
+ end
82
+ end
83
+
84
+
85
+ task :web => [:web_doc] do
86
+ puts "# Now execute the following:"
87
+ puts "scp web/* robinstocker@rubyforge.org:/var/www/gforge-projects/id3lib-ruby/"
88
+ puts "scp -r web/doc robinstocker@rubyforge.org:/var/www/gforge-projects/id3lib-ruby/doc"
89
+ end
90
+
91
+ desc "Generate RDOC documentation on web."
92
+ Rake::RDocTask.new :web_doc do |rdoc|
93
+ rdoc.rdoc_dir = 'web/doc'
94
+ rdoc.title = 'id3lib-ruby'
95
+ rdoc.options << '--line-numbers' << '--main' << 'ID3Lib::Tag'
96
+ rdoc.rdoc_files.include('README', 'TODO', 'CHANGES')
97
+ rdoc.rdoc_files.include('lib/**/*.rb')
98
+ end
99
+
100
+
101
+ task :usage_html do
102
+ require 'syntax/convertors/html'
103
+
104
+ convertor = Syntax::Convertors::HTML.for_syntax('ruby')
105
+ html = convertor.convert(File.read('usage.rb'))
106
+
107
+ puts html
108
+ end
data/TODO ADDED
@@ -0,0 +1,9 @@
1
+ = id3lib-ruby To Do List
2
+
3
+ * Overhaul direct access methods
4
+ * Implement removing frames. tag.title = nil ?
5
+ * Remove methods for rarely used frames.
6
+ * Use strings in all methods - get rid of exceptions.
7
+ * Add method to check if frames and fields are valid.
8
+ * Create Windows binary gem (id3lib.dll included).
9
+ * Add UTF-8 support if id3lib can handle it.
data/ext/extconf.rb ADDED
@@ -0,0 +1,6 @@
1
+
2
+ require 'mkmf'
3
+
4
+ have_header('id3.h')
5
+ have_library('id3', 'ID3Tag_New')
6
+ create_makefile('id3lib_api')
@@ -0,0 +1,1950 @@
1
+ /* ----------------------------------------------------------------------------
2
+ * This file was automatically generated by SWIG (http://www.swig.org).
3
+ * Version 1.3.25
4
+ *
5
+ * This file is not intended to be easily readable and contains a number of
6
+ * coding conventions designed to improve portability and efficiency. Do not make
7
+ * changes to this file unless you know what you are doing--modify the SWIG
8
+ * interface file instead.
9
+ * ----------------------------------------------------------------------------- */
10
+
11
+
12
+ #ifdef __cplusplus
13
+ template<class T> class SwigValueWrapper {
14
+ T *tt;
15
+ public:
16
+ SwigValueWrapper() : tt(0) { }
17
+ SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
18
+ SwigValueWrapper(const T& t) : tt(new T(t)) { }
19
+ ~SwigValueWrapper() { delete tt; }
20
+ SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
21
+ operator T&() const { return *tt; }
22
+ T *operator&() { return tt; }
23
+ private:
24
+ SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
25
+ };
26
+ #endif
27
+
28
+ /***********************************************************************
29
+ *
30
+ * This section contains generic SWIG labels for method/variable
31
+ * declarations/attributes, and other compiler dependent labels.
32
+ *
33
+ ************************************************************************/
34
+
35
+ /* template workaround for compilers that cannot correctly implement the C++ standard */
36
+ #ifndef SWIGTEMPLATEDISAMBIGUATOR
37
+ # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
38
+ # define SWIGTEMPLATEDISAMBIGUATOR template
39
+ # else
40
+ # define SWIGTEMPLATEDISAMBIGUATOR
41
+ # endif
42
+ #endif
43
+
44
+ /* inline attribute */
45
+ #ifndef SWIGINLINE
46
+ # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
47
+ # define SWIGINLINE inline
48
+ # else
49
+ # define SWIGINLINE
50
+ # endif
51
+ #endif
52
+
53
+ /* attribute recognised by some compilers to avoid 'unused' warnings */
54
+ #ifndef SWIGUNUSED
55
+ # if defined(__GNUC__) || defined(__ICC)
56
+ # define SWIGUNUSED __attribute__ ((unused))
57
+ # else
58
+ # define SWIGUNUSED
59
+ # endif
60
+ #endif
61
+
62
+ /* internal SWIG method */
63
+ #ifndef SWIGINTERN
64
+ # define SWIGINTERN static SWIGUNUSED
65
+ #endif
66
+
67
+ /* internal inline SWIG method */
68
+ #ifndef SWIGINTERNINLINE
69
+ # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
70
+ #endif
71
+
72
+ /* exporting methods for Windows DLLs */
73
+ #ifndef SWIGEXPORT
74
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
75
+ # if defined(STATIC_LINKED)
76
+ # define SWIGEXPORT
77
+ # else
78
+ # define SWIGEXPORT __declspec(dllexport)
79
+ # endif
80
+ # else
81
+ # define SWIGEXPORT
82
+ # endif
83
+ #endif
84
+
85
+ /* calling conventions for Windows */
86
+ #ifndef SWIGSTDCALL
87
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
88
+ # define SWIGSTDCALL __stdcall
89
+ # else
90
+ # define SWIGSTDCALL
91
+ # endif
92
+ #endif
93
+
94
+
95
+ /* ruby.swg */
96
+ /* Implementation : RUBY */
97
+ #define SWIGRUBY 1
98
+
99
+ #include "ruby.h"
100
+
101
+ /* Flags for pointer conversion */
102
+ #define SWIG_POINTER_EXCEPTION 0x1
103
+ #define SWIG_POINTER_DISOWN 0x2
104
+
105
+ #define NUM2USHRT(n) (\
106
+ (0 <= NUM2UINT(n) && NUM2UINT(n) <= USHRT_MAX)\
107
+ ? (unsigned short) NUM2UINT(n) \
108
+ : (rb_raise(rb_eArgError, "integer %d out of range of `unsigned short'",\
109
+ NUM2UINT(n)), (short)0)\
110
+ )
111
+
112
+ #define NUM2SHRT(n) (\
113
+ (SHRT_MIN <= NUM2INT(n) && NUM2INT(n) <= SHRT_MAX)\
114
+ ? (short)NUM2INT(n)\
115
+ : (rb_raise(rb_eArgError, "integer %d out of range of `short'",\
116
+ NUM2INT(n)), (short)0)\
117
+ )
118
+
119
+ /* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
120
+ #ifndef NUM2LL
121
+ #define NUM2LL(x) NUM2LONG((x))
122
+ #endif
123
+ #ifndef LL2NUM
124
+ #define LL2NUM(x) INT2NUM((long) (x))
125
+ #endif
126
+ #ifndef ULL2NUM
127
+ #define ULL2NUM(x) UINT2NUM((unsigned long) (x))
128
+ #endif
129
+
130
+ /* Ruby 1.7 doesn't (yet) define NUM2ULL() */
131
+ #ifndef NUM2ULL
132
+ #ifdef HAVE_LONG_LONG
133
+ #define NUM2ULL(x) rb_num2ull((x))
134
+ #else
135
+ #define NUM2ULL(x) NUM2ULONG(x)
136
+ #endif
137
+ #endif
138
+
139
+ /*
140
+ * Need to be very careful about how these macros are defined, especially
141
+ * when compiling C++ code or C code with an ANSI C compiler.
142
+ *
143
+ * VALUEFUNC(f) is a macro used to typecast a C function that implements
144
+ * a Ruby method so that it can be passed as an argument to API functions
145
+ * like rb_define_method() and rb_define_singleton_method().
146
+ *
147
+ * VOIDFUNC(f) is a macro used to typecast a C function that implements
148
+ * either the "mark" or "free" stuff for a Ruby Data object, so that it
149
+ * can be passed as an argument to API functions like Data_Wrap_Struct()
150
+ * and Data_Make_Struct().
151
+ */
152
+
153
+ #ifdef __cplusplus
154
+ # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
155
+ # define PROTECTFUNC(f) ((VALUE (*)()) f)
156
+ # define VALUEFUNC(f) ((VALUE (*)()) f)
157
+ # define VOIDFUNC(f) ((void (*)()) f)
158
+ # else
159
+ # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
160
+ # define PROTECTFUNC(f) ((VALUE (*)()) f)
161
+ # define VALUEFUNC(f) ((VALUE (*)()) f)
162
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
163
+ # else /* These definitions should work for Ruby 1.7+ */
164
+ # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
165
+ # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
166
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
167
+ # endif
168
+ # endif
169
+ #else
170
+ # define VALUEFUNC(f) (f)
171
+ # define VOIDFUNC(f) (f)
172
+ #endif
173
+
174
+ typedef struct {
175
+ VALUE klass;
176
+ VALUE mImpl;
177
+ void (*mark)(void *);
178
+ void (*destroy)(void *);
179
+ } swig_class;
180
+
181
+ /* Don't use for expressions have side effect */
182
+ #ifndef RB_STRING_VALUE
183
+ #define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
184
+ #endif
185
+ #ifndef StringValue
186
+ #define StringValue(s) RB_STRING_VALUE(s)
187
+ #endif
188
+ #ifndef StringValuePtr
189
+ #define StringValuePtr(s) RSTRING(RB_STRING_VALUE(s))->ptr
190
+ #endif
191
+ #ifndef StringValueLen
192
+ #define StringValueLen(s) RSTRING(RB_STRING_VALUE(s))->len
193
+ #endif
194
+ #ifndef SafeStringValue
195
+ #define SafeStringValue(v) do {\
196
+ StringValue(v);\
197
+ rb_check_safe_str(v);\
198
+ } while (0)
199
+ #endif
200
+
201
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
202
+ #define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
203
+ #define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
204
+ #endif
205
+
206
+ /* Contract support */
207
+
208
+ #define SWIG_contract_assert(expr, msg) if (!(expr)) { rb_raise(rb_eRuntimeError, (char *) msg ); } else
209
+
210
+
211
+ /***********************************************************************
212
+ * swigrun.swg
213
+ *
214
+ * This file contains generic CAPI SWIG runtime support for pointer
215
+ * type checking.
216
+ *
217
+ ************************************************************************/
218
+
219
+ /* This should only be incremented when either the layout of swig_type_info changes,
220
+ or for whatever reason, the runtime changes incompatibly */
221
+ #define SWIG_RUNTIME_VERSION "2"
222
+
223
+ /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
224
+ #ifdef SWIG_TYPE_TABLE
225
+ # define SWIG_QUOTE_STRING(x) #x
226
+ # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
227
+ # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
228
+ #else
229
+ # define SWIG_TYPE_TABLE_NAME
230
+ #endif
231
+
232
+ /*
233
+ You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
234
+ creating a static or dynamic library from the swig runtime code.
235
+ In 99.9% of the cases, swig just needs to declare them as 'static'.
236
+
237
+ But only do this if is strictly necessary, ie, if you have problems
238
+ with your compiler or so.
239
+ */
240
+
241
+ #ifndef SWIGRUNTIME
242
+ # define SWIGRUNTIME SWIGINTERN
243
+ #endif
244
+
245
+ #ifndef SWIGRUNTIMEINLINE
246
+ # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
247
+ #endif
248
+
249
+ #include <string.h>
250
+
251
+ #ifdef __cplusplus
252
+ extern "C" {
253
+ #endif
254
+
255
+ typedef void *(*swig_converter_func)(void *);
256
+ typedef struct swig_type_info *(*swig_dycast_func)(void **);
257
+
258
+ /* Structure to store inforomation on one type */
259
+ typedef struct swig_type_info {
260
+ const char *name; /* mangled name of this type */
261
+ const char *str; /* human readable name of this type */
262
+ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
263
+ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
264
+ void *clientdata; /* language specific type data */
265
+ } swig_type_info;
266
+
267
+ /* Structure to store a type and conversion function used for casting */
268
+ typedef struct swig_cast_info {
269
+ swig_type_info *type; /* pointer to type that is equivalent to this type */
270
+ swig_converter_func converter; /* function to cast the void pointers */
271
+ struct swig_cast_info *next; /* pointer to next cast in linked list */
272
+ struct swig_cast_info *prev; /* pointer to the previous cast */
273
+ } swig_cast_info;
274
+
275
+ /* Structure used to store module information
276
+ * Each module generates one structure like this, and the runtime collects
277
+ * all of these structures and stores them in a circularly linked list.*/
278
+ typedef struct swig_module_info {
279
+ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
280
+ size_t size; /* Number of types in this module */
281
+ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
282
+ swig_type_info **type_initial; /* Array of initially generated type structures */
283
+ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
284
+ void *clientdata; /* Language specific module data */
285
+ } swig_module_info;
286
+
287
+
288
+ /*
289
+ Compare two type names skipping the space characters, therefore
290
+ "char*" == "char *" and "Class<int>" == "Class<int >", etc.
291
+
292
+ Return 0 when the two name types are equivalent, as in
293
+ strncmp, but skipping ' '.
294
+ */
295
+ SWIGRUNTIME int
296
+ SWIG_TypeNameComp(const char *f1, const char *l1,
297
+ const char *f2, const char *l2) {
298
+ for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
299
+ while ((*f1 == ' ') && (f1 != l1)) ++f1;
300
+ while ((*f2 == ' ') && (f2 != l2)) ++f2;
301
+ if (*f1 != *f2) return (int)(*f1 - *f2);
302
+ }
303
+ return (l1 - f1) - (l2 - f2);
304
+ }
305
+
306
+ /*
307
+ Check type equivalence in a name list like <name1>|<name2>|...
308
+ Return 0 if not equal, 1 if equal
309
+ */
310
+ SWIGRUNTIME int
311
+ SWIG_TypeEquiv(const char *nb, const char *tb) {
312
+ int equiv = 0;
313
+ const char* te = tb + strlen(tb);
314
+ const char* ne = nb;
315
+ while (!equiv && *ne) {
316
+ for (nb = ne; *ne; ++ne) {
317
+ if (*ne == '|') break;
318
+ }
319
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
320
+ if (*ne) ++ne;
321
+ }
322
+ return equiv;
323
+ }
324
+
325
+ /*
326
+ Check type equivalence in a name list like <name1>|<name2>|...
327
+ Return 0 if equal, -1 if nb < tb, 1 if nb > tb
328
+ */
329
+ SWIGRUNTIME int
330
+ SWIG_TypeCompare(const char *nb, const char *tb) {
331
+ int equiv = 0;
332
+ const char* te = tb + strlen(tb);
333
+ const char* ne = nb;
334
+ while (!equiv && *ne) {
335
+ for (nb = ne; *ne; ++ne) {
336
+ if (*ne == '|') break;
337
+ }
338
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
339
+ if (*ne) ++ne;
340
+ }
341
+ return equiv;
342
+ }
343
+
344
+
345
+ /* think of this as a c++ template<> or a scheme macro */
346
+ #define SWIG_TypeCheck_Template(comparison, ty) \
347
+ if (ty) { \
348
+ swig_cast_info *iter = ty->cast; \
349
+ while (iter) { \
350
+ if (comparison) { \
351
+ if (iter == ty->cast) return iter; \
352
+ /* Move iter to the top of the linked list */ \
353
+ iter->prev->next = iter->next; \
354
+ if (iter->next) \
355
+ iter->next->prev = iter->prev; \
356
+ iter->next = ty->cast; \
357
+ iter->prev = 0; \
358
+ if (ty->cast) ty->cast->prev = iter; \
359
+ ty->cast = iter; \
360
+ return iter; \
361
+ } \
362
+ iter = iter->next; \
363
+ } \
364
+ } \
365
+ return 0
366
+
367
+ /*
368
+ Check the typename
369
+ */
370
+ SWIGRUNTIME swig_cast_info *
371
+ SWIG_TypeCheck(const char *c, swig_type_info *ty) {
372
+ SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
373
+ }
374
+
375
+ /* Same as previous function, except strcmp is replaced with a pointer comparison */
376
+ SWIGRUNTIME swig_cast_info *
377
+ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
378
+ SWIG_TypeCheck_Template(iter->type == from, into);
379
+ }
380
+
381
+ /*
382
+ Cast a pointer up an inheritance hierarchy
383
+ */
384
+ SWIGRUNTIMEINLINE void *
385
+ SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
386
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
387
+ }
388
+
389
+ /*
390
+ Dynamic pointer casting. Down an inheritance hierarchy
391
+ */
392
+ SWIGRUNTIME swig_type_info *
393
+ SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
394
+ swig_type_info *lastty = ty;
395
+ if (!ty || !ty->dcast) return ty;
396
+ while (ty && (ty->dcast)) {
397
+ ty = (*ty->dcast)(ptr);
398
+ if (ty) lastty = ty;
399
+ }
400
+ return lastty;
401
+ }
402
+
403
+ /*
404
+ Return the name associated with this type
405
+ */
406
+ SWIGRUNTIMEINLINE const char *
407
+ SWIG_TypeName(const swig_type_info *ty) {
408
+ return ty->name;
409
+ }
410
+
411
+ /*
412
+ Return the pretty name associated with this type,
413
+ that is an unmangled type name in a form presentable to the user.
414
+ */
415
+ SWIGRUNTIME const char *
416
+ SWIG_TypePrettyName(const swig_type_info *type) {
417
+ /* The "str" field contains the equivalent pretty names of the
418
+ type, separated by vertical-bar characters. We choose
419
+ to print the last name, as it is often (?) the most
420
+ specific. */
421
+ if (type->str != NULL) {
422
+ const char *last_name = type->str;
423
+ const char *s;
424
+ for (s = type->str; *s; s++)
425
+ if (*s == '|') last_name = s+1;
426
+ return last_name;
427
+ }
428
+ else
429
+ return type->name;
430
+ }
431
+
432
+ /*
433
+ Set the clientdata field for a type
434
+ */
435
+ SWIGRUNTIME void
436
+ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
437
+ if (!ti->clientdata) {
438
+ swig_cast_info *cast = ti->cast;
439
+ /* if (ti->clientdata == clientdata) return; */
440
+ ti->clientdata = clientdata;
441
+
442
+ while (cast) {
443
+ if (!cast->converter)
444
+ SWIG_TypeClientData(cast->type, clientdata);
445
+ cast = cast->next;
446
+ }
447
+ }
448
+ }
449
+
450
+ /*
451
+ Search for a swig_type_info structure only by mangled name
452
+ Search is a O(log #types)
453
+
454
+ We start searching at module start, and finish searching when start == end.
455
+ Note: if start == end at the beginning of the function, we go all the way around
456
+ the circular list.
457
+ */
458
+ SWIGRUNTIME swig_type_info *
459
+ SWIG_MangledTypeQueryModule(swig_module_info *start,
460
+ swig_module_info *end,
461
+ const char *name) {
462
+ swig_module_info *iter = start;
463
+ do {
464
+ if (iter->size) {
465
+ register size_t l = 0;
466
+ register size_t r = iter->size - 1;
467
+ do {
468
+ /* since l+r >= 0, we can (>> 1) instead (/ 2) */
469
+ register size_t i = (l + r) >> 1;
470
+ const char *iname = iter->types[i]->name;
471
+ if (iname) {
472
+ register int compare = strcmp(name, iname);
473
+ if (compare == 0) {
474
+ return iter->types[i];
475
+ } else if (compare < 0) {
476
+ if (i) {
477
+ r = i - 1;
478
+ } else {
479
+ break;
480
+ }
481
+ } else if (compare > 0) {
482
+ l = i + 1;
483
+ }
484
+ } else {
485
+ break; /* should never happen */
486
+ }
487
+ } while (l <= r);
488
+ }
489
+ iter = iter->next;
490
+ } while (iter != end);
491
+ return 0;
492
+ }
493
+
494
+ /*
495
+ Search for a swig_type_info structure for either a mangled name or a human readable name.
496
+ It first searches the mangled names of the types, which is a O(log #types)
497
+ If a type is not found it then searches the human readable names, which is O(#types).
498
+
499
+ We start searching at module start, and finish searching when start == end.
500
+ Note: if start == end at the beginning of the function, we go all the way around
501
+ the circular list.
502
+ */
503
+ SWIGRUNTIME swig_type_info *
504
+ SWIG_TypeQueryModule(swig_module_info *start,
505
+ swig_module_info *end,
506
+ const char *name) {
507
+ /* STEP 1: Search the name field using binary search */
508
+ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
509
+ if (ret) {
510
+ return ret;
511
+ } else {
512
+ /* STEP 2: If the type hasn't been found, do a complete search
513
+ of the str field (the human readable name) */
514
+ swig_module_info *iter = start;
515
+ do {
516
+ register size_t i = 0;
517
+ for (; i < iter->size; ++i) {
518
+ if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
519
+ return iter->types[i];
520
+ }
521
+ iter = iter->next;
522
+ } while (iter != end);
523
+ }
524
+
525
+ /* neither found a match */
526
+ return 0;
527
+ }
528
+
529
+
530
+ /*
531
+ Pack binary data into a string
532
+ */
533
+ SWIGRUNTIME char *
534
+ SWIG_PackData(char *c, void *ptr, size_t sz) {
535
+ static const char hex[17] = "0123456789abcdef";
536
+ register const unsigned char *u = (unsigned char *) ptr;
537
+ register const unsigned char *eu = u + sz;
538
+ for (; u != eu; ++u) {
539
+ register unsigned char uu = *u;
540
+ *(c++) = hex[(uu & 0xf0) >> 4];
541
+ *(c++) = hex[uu & 0xf];
542
+ }
543
+ return c;
544
+ }
545
+
546
+ /*
547
+ Unpack binary data from a string
548
+ */
549
+ SWIGRUNTIME const char *
550
+ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
551
+ register unsigned char *u = (unsigned char *) ptr;
552
+ register const unsigned char *eu = u + sz;
553
+ for (; u != eu; ++u) {
554
+ register char d = *(c++);
555
+ register unsigned char uu = 0;
556
+ if ((d >= '0') && (d <= '9'))
557
+ uu = ((d - '0') << 4);
558
+ else if ((d >= 'a') && (d <= 'f'))
559
+ uu = ((d - ('a'-10)) << 4);
560
+ else
561
+ return (char *) 0;
562
+ d = *(c++);
563
+ if ((d >= '0') && (d <= '9'))
564
+ uu |= (d - '0');
565
+ else if ((d >= 'a') && (d <= 'f'))
566
+ uu |= (d - ('a'-10));
567
+ else
568
+ return (char *) 0;
569
+ *u = uu;
570
+ }
571
+ return c;
572
+ }
573
+
574
+ /*
575
+ Pack 'void *' into a string buffer.
576
+ */
577
+ SWIGRUNTIME char *
578
+ SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
579
+ char *r = buff;
580
+ if ((2*sizeof(void *) + 2) > bsz) return 0;
581
+ *(r++) = '_';
582
+ r = SWIG_PackData(r,&ptr,sizeof(void *));
583
+ if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
584
+ strcpy(r,name);
585
+ return buff;
586
+ }
587
+
588
+ SWIGRUNTIME const char *
589
+ SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
590
+ if (*c != '_') {
591
+ if (strcmp(c,"NULL") == 0) {
592
+ *ptr = (void *) 0;
593
+ return name;
594
+ } else {
595
+ return 0;
596
+ }
597
+ }
598
+ return SWIG_UnpackData(++c,ptr,sizeof(void *));
599
+ }
600
+
601
+ SWIGRUNTIME char *
602
+ SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
603
+ char *r = buff;
604
+ size_t lname = (name ? strlen(name) : 0);
605
+ if ((2*sz + 2 + lname) > bsz) return 0;
606
+ *(r++) = '_';
607
+ r = SWIG_PackData(r,ptr,sz);
608
+ if (lname) {
609
+ strncpy(r,name,lname+1);
610
+ } else {
611
+ *r = 0;
612
+ }
613
+ return buff;
614
+ }
615
+
616
+ SWIGRUNTIME const char *
617
+ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
618
+ if (*c != '_') {
619
+ if (strcmp(c,"NULL") == 0) {
620
+ memset(ptr,0,sz);
621
+ return name;
622
+ } else {
623
+ return 0;
624
+ }
625
+ }
626
+ return SWIG_UnpackData(++c,ptr,sz);
627
+ }
628
+
629
+ #ifdef __cplusplus
630
+ }
631
+ #endif
632
+
633
+ /* Common SWIG API */
634
+ #define SWIG_ConvertPtr(obj, pp, type, flags) \
635
+ SWIG_Ruby_ConvertPtr(obj, pp, type, flags)
636
+ #define SWIG_NewPointerObj(p, type, flags) \
637
+ SWIG_Ruby_NewPointerObj(p, type, flags)
638
+ #define SWIG_MustGetPtr(p, type, argnum, flags) \
639
+ SWIG_Ruby_MustGetPtr(p, type, argnum, flags)
640
+ #define SWIG_GetModule(clientdata) \
641
+ SWIG_Ruby_GetModule()
642
+ #define SWIG_SetModule(clientdata, pointer) \
643
+ SWIG_Ruby_SetModule(pointer)
644
+
645
+ /* Ruby-specific SWIG API */
646
+
647
+ #define SWIG_InitRuntime() \
648
+ SWIG_Ruby_InitRuntime()
649
+ #define SWIG_define_class(ty) \
650
+ SWIG_Ruby_define_class(ty)
651
+ #define SWIG_NewClassInstance(value, ty) \
652
+ SWIG_Ruby_NewClassInstance(value, ty)
653
+ #define SWIG_MangleStr(value) \
654
+ SWIG_Ruby_MangleStr(value)
655
+ #define SWIG_CheckConvert(value, ty) \
656
+ SWIG_Ruby_CheckConvert(value, ty)
657
+ #define SWIG_NewPackedObj(ptr, sz, ty) \
658
+ SWIG_Ruby_NewPackedObj(ptr, sz, ty)
659
+ #define SWIG_ConvertPacked(obj, ptr, sz, ty, flags) \
660
+ SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
661
+
662
+ /* rubydef.swg */
663
+ #ifdef __cplusplus
664
+ extern "C" {
665
+ #endif
666
+
667
+ static VALUE _mSWIG = Qnil;
668
+ static VALUE _cSWIG_Pointer = Qnil;
669
+ static VALUE swig_runtime_data_type_pointer = Qnil;
670
+
671
+ /* Initialize Ruby runtime support */
672
+ static void
673
+ SWIG_Ruby_InitRuntime(void)
674
+ {
675
+ if (_mSWIG == Qnil) {
676
+ _mSWIG = rb_define_module("SWIG");
677
+ }
678
+ }
679
+
680
+ /* Define Ruby class for C type */
681
+ static void
682
+ SWIG_Ruby_define_class(swig_type_info *type)
683
+ {
684
+ VALUE klass;
685
+ char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
686
+ sprintf(klass_name, "TYPE%s", type->name);
687
+ if (NIL_P(_cSWIG_Pointer)) {
688
+ _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
689
+ rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
690
+ }
691
+ klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
692
+ free((void *) klass_name);
693
+ }
694
+
695
+ /* Create a new pointer object */
696
+ static VALUE
697
+ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int own)
698
+ {
699
+ char *klass_name;
700
+ swig_class *sklass;
701
+ VALUE klass;
702
+ VALUE obj;
703
+
704
+ if (!ptr)
705
+ return Qnil;
706
+
707
+ if (type->clientdata) {
708
+ sklass = (swig_class *) type->clientdata;
709
+ obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark), (own ? VOIDFUNC(sklass->destroy) : 0), ptr);
710
+ } else {
711
+ klass_name = (char *) malloc(4 + strlen(type->name) + 1);
712
+ sprintf(klass_name, "TYPE%s", type->name);
713
+ klass = rb_const_get(_mSWIG, rb_intern(klass_name));
714
+ free((void *) klass_name);
715
+ obj = Data_Wrap_Struct(klass, 0, 0, ptr);
716
+ }
717
+ rb_iv_set(obj, "__swigtype__", rb_str_new2(type->name));
718
+ return obj;
719
+ }
720
+
721
+ /* Create a new class instance (always owned) */
722
+ static VALUE
723
+ SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
724
+ {
725
+ VALUE obj;
726
+ swig_class *sklass = (swig_class *) type->clientdata;
727
+ obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
728
+ rb_iv_set(obj, "__swigtype__", rb_str_new2(type->name));
729
+ return obj;
730
+ }
731
+
732
+ /* Get type mangle from class name */
733
+ static SWIGINLINE char *
734
+ SWIG_Ruby_MangleStr(VALUE obj)
735
+ {
736
+ VALUE stype = rb_iv_get(obj, "__swigtype__");
737
+ return StringValuePtr(stype);
738
+ }
739
+
740
+ /* Convert a pointer value */
741
+ static int
742
+ SWIG_Ruby_ConvertPtr(VALUE obj, void **ptr, swig_type_info *ty, int flags)
743
+ {
744
+ char *c;
745
+ swig_cast_info *tc;
746
+
747
+ /* Grab the pointer */
748
+ if (NIL_P(obj)) {
749
+ *ptr = 0;
750
+ return 0;
751
+ } else {
752
+ Data_Get_Struct(obj, void, *ptr);
753
+ }
754
+
755
+ /* Do type-checking if type info was provided */
756
+ if (ty) {
757
+ if (ty->clientdata) {
758
+ if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
759
+ if (*ptr == 0)
760
+ rb_raise(rb_eRuntimeError, "This %s already released", ty->str);
761
+ return 0;
762
+ }
763
+ }
764
+ if ((c = SWIG_MangleStr(obj)) == NULL) {
765
+ if (flags & SWIG_POINTER_EXCEPTION)
766
+ rb_raise(rb_eTypeError, "Expected %s", ty->str);
767
+ else
768
+ return -1;
769
+ }
770
+ tc = SWIG_TypeCheck(c, ty);
771
+ if (!tc) {
772
+ if (flags & SWIG_POINTER_EXCEPTION)
773
+ rb_raise(rb_eTypeError, "Expected %s", ty->str);
774
+ else
775
+ return -1;
776
+ }
777
+ *ptr = SWIG_TypeCast(tc, *ptr);
778
+ }
779
+ return 0;
780
+ }
781
+
782
+ /* Convert a pointer value, signal an exception on a type mismatch */
783
+ static SWIGINLINE void *
784
+ SWIG_Ruby_MustGetPtr(VALUE obj, swig_type_info *ty, int argnum, int flags)
785
+ {
786
+ void *result;
787
+ SWIG_ConvertPtr(obj, &result, ty, flags | SWIG_POINTER_EXCEPTION);
788
+ return result;
789
+ }
790
+
791
+ /* Check convert */
792
+ static SWIGINLINE int
793
+ SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
794
+ {
795
+ char *c = SWIG_MangleStr(obj);
796
+ if (!c)
797
+ return 0;
798
+ return SWIG_TypeCheck(c,ty) != 0;
799
+ }
800
+
801
+ static VALUE
802
+ SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
803
+ char result[1024];
804
+ char *r = result;
805
+ if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
806
+ *(r++) = '_';
807
+ r = SWIG_PackData(r, ptr, sz);
808
+ strcpy(r, type->name);
809
+ return rb_str_new2(result);
810
+ }
811
+
812
+ /* Convert a packed value value */
813
+ static void
814
+ SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty, int flags) {
815
+ swig_cast_info *tc;
816
+ const char *c;
817
+
818
+ if (TYPE(obj) != T_STRING) goto type_error;
819
+ c = StringValuePtr(obj);
820
+ /* Pointer values must start with leading underscore */
821
+ if (*c != '_') goto type_error;
822
+ c++;
823
+ c = SWIG_UnpackData(c, ptr, sz);
824
+ if (ty) {
825
+ tc = SWIG_TypeCheck(c, ty);
826
+ if (!tc) goto type_error;
827
+ }
828
+ return;
829
+
830
+ type_error:
831
+
832
+ if (flags) {
833
+ if (ty) {
834
+ rb_raise(rb_eTypeError, "Type error. Expected %s", ty->name);
835
+ } else {
836
+ rb_raise(rb_eTypeError, "Expected a pointer");
837
+ }
838
+ }
839
+ }
840
+
841
+ static swig_module_info *SWIG_Ruby_GetModule() {
842
+ VALUE pointer;
843
+ swig_module_info *ret = 0;
844
+
845
+ /* first check if pointer already created */
846
+ pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
847
+ if (pointer != Qnil) {
848
+ Data_Get_Struct(pointer, swig_module_info, ret);
849
+ }
850
+ return ret;
851
+ }
852
+
853
+ static void SWIG_Ruby_SetModule(swig_module_info *pointer) {
854
+ /* register a new class */
855
+ VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
856
+ /* create and store the structure pointer to a global variable */
857
+ swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
858
+ rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
859
+ }
860
+
861
+ #ifdef __cplusplus
862
+ }
863
+ #endif
864
+
865
+
866
+
867
+ /* -------- TYPES TABLE (BEGIN) -------- */
868
+
869
+ #define SWIGTYPE_p_ID3_Field swig_types[0]
870
+ #define SWIGTYPE_p_ID3_Frame swig_types[1]
871
+ #define SWIGTYPE_p_ID3_Tag swig_types[2]
872
+ #define SWIGTYPE_p_ID3_Tag__Iterator swig_types[3]
873
+ #define SWIGTYPE_p_unsigned_int swig_types[4]
874
+ #define SWIGTYPE_p_unsigned_long swig_types[5]
875
+ static swig_type_info *swig_types[6];
876
+ static swig_module_info swig_module = {swig_types, 6, 0, 0, 0, 0};
877
+ #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
878
+ #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
879
+
880
+ /* -------- TYPES TABLE (END) -------- */
881
+
882
+ #define SWIG_init Init_id3lib_api
883
+ #define SWIG_name "ID3Lib::API"
884
+
885
+ static VALUE mAPI;
886
+
887
+ static void SWIG_AsVal(VALUE obj, int *val)
888
+ {
889
+ *val = (int) NUM2INT(obj);
890
+ }
891
+
892
+
893
+ #include <id3/tag.h>
894
+
895
+ static ID3_Frame *ID3_Tag_iterator_next_frame(ID3_Tag *self,ID3_Tag::Iterator *iterator){
896
+ return iterator->GetNext();
897
+ }
898
+ static VALUE ID3_Field_binary(ID3_Field *self){
899
+ return rb_str_new((const char *)self->GetRawBinary(), self->Size());
900
+ }
901
+ static VALUE ID3_Field_unicode(ID3_Field *self){
902
+ const char *string = (const char *)self->GetRawUnicodeText();
903
+ long size = self->Size();
904
+ if (size < 2) {
905
+ size = 0;
906
+ } else if (string[size-2] == '\0' && string[size-1] == '\0') {
907
+ // id3lib seems to be inconsistent: the unicode strings
908
+ // don't always end in 0x0000. If they do, we don't want these
909
+ // trailing bytes.
910
+ size -= 2;
911
+ }
912
+ return rb_str_new(string, size);
913
+ }
914
+ static size_t ID3_Field_set_binary(ID3_Field *self,VALUE data){
915
+ StringValue(data);
916
+ return self->Set( (const unsigned char *)RSTRING(data)->ptr,
917
+ RSTRING(data)->len );
918
+ }
919
+ static size_t ID3_Field_set_unicode(ID3_Field *self,VALUE data){
920
+ StringValue(data);
921
+
922
+ long len;
923
+ unicode_t *unicode;
924
+
925
+ len = RSTRING(data)->len / sizeof(unicode_t);
926
+ unicode = (unicode_t *)malloc(sizeof(unicode_t) * (len+1));
927
+
928
+ if (unicode == NULL) {
929
+ rb_raise(rb_eNoMemError, "Couldn't allocate memory for unicode data.");
930
+ }
931
+
932
+ memcpy(unicode, RSTRING(data)->ptr, sizeof(unicode_t) * len);
933
+ // Unicode strings need 0x0000 at the end.
934
+ unicode[len] = 0;
935
+ size_t retval = self->Set(unicode);
936
+
937
+ // Free Unicode! ;)
938
+ free(unicode);
939
+ return retval;
940
+ }
941
+ swig_class cTag;
942
+
943
+ static VALUE
944
+ _wrap_new_Tag__SWIG_0(int argc, VALUE *argv, VALUE self) {
945
+ char *arg1 = (char *) 0 ;
946
+ ID3_Tag *result;
947
+
948
+ if ((argc < 1) || (argc > 1))
949
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
950
+ arg1 = StringValuePtr(argv[0]);
951
+ result = (ID3_Tag *)new ID3_Tag((char const *)arg1);
952
+ DATA_PTR(self) = result;
953
+ return self;
954
+ }
955
+
956
+
957
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
958
+ static VALUE
959
+ _wrap_Tag_allocate(VALUE self) {
960
+ #else
961
+ static VALUE
962
+ _wrap_Tag_allocate(int argc, VALUE *argv, VALUE self) {
963
+ #endif
964
+
965
+
966
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_ID3_Tag);
967
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
968
+ rb_obj_call_init(vresult, argc, argv);
969
+ #endif
970
+ return vresult;
971
+ }
972
+
973
+
974
+ static VALUE
975
+ _wrap_new_Tag__SWIG_1(int argc, VALUE *argv, VALUE self) {
976
+ ID3_Tag *result;
977
+
978
+ if ((argc < 0) || (argc > 0))
979
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc);
980
+ result = (ID3_Tag *)new ID3_Tag();
981
+ DATA_PTR(self) = result;
982
+ return self;
983
+ }
984
+
985
+
986
+ static VALUE _wrap_new_Tag(int nargs, VALUE *args, VALUE self) {
987
+ int argc;
988
+ VALUE argv[1];
989
+ int ii;
990
+
991
+ argc = nargs;
992
+ for (ii = 0; (ii < argc) && (ii < 1); ii++) {
993
+ argv[ii] = args[ii];
994
+ }
995
+ if (argc == 0) {
996
+ return _wrap_new_Tag__SWIG_1(nargs, args, self);
997
+ }
998
+ if (argc == 1) {
999
+ int _v;
1000
+ {
1001
+ _v = (TYPE(argv[0]) == T_STRING) ? 1 : 0;
1002
+ }
1003
+ if (_v) {
1004
+ return _wrap_new_Tag__SWIG_0(nargs, args, self);
1005
+ }
1006
+ }
1007
+
1008
+ rb_raise(rb_eArgError, "No matching function for overloaded 'new_Tag'");
1009
+ return Qnil;
1010
+ }
1011
+
1012
+
1013
+ static void
1014
+ free_ID3_Tag(ID3_Tag *arg1) {
1015
+ delete arg1;
1016
+ }
1017
+ static VALUE
1018
+ _wrap_Tag_has_tag_type(int argc, VALUE *argv, VALUE self) {
1019
+ ID3_Tag *arg1 = (ID3_Tag *) 0 ;
1020
+ ID3_TagType arg2 ;
1021
+ bool result;
1022
+ VALUE vresult = Qnil;
1023
+
1024
+ if ((argc < 1) || (argc > 1))
1025
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1026
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Tag, 1);
1027
+ arg2 = (ID3_TagType) NUM2INT(argv[0]);
1028
+ result = (bool)((ID3_Tag const *)arg1)->HasTagType(arg2);
1029
+
1030
+ vresult = result ? Qtrue : Qfalse;
1031
+ return vresult;
1032
+ }
1033
+
1034
+
1035
+ static VALUE
1036
+ _wrap_Tag_link__SWIG_0(int argc, VALUE *argv, VALUE self) {
1037
+ ID3_Tag *arg1 = (ID3_Tag *) 0 ;
1038
+ char *arg2 = (char *) 0 ;
1039
+ flags_t arg3 ;
1040
+ size_t result;
1041
+ VALUE vresult = Qnil;
1042
+
1043
+ if ((argc < 2) || (argc > 2))
1044
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc);
1045
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Tag, 1);
1046
+ arg2 = StringValuePtr(argv[0]);
1047
+ arg3 = NUM2UINT(argv[1]);
1048
+ result = (arg1)->Link((char const *)arg2,arg3);
1049
+
1050
+ vresult = UINT2NUM(result);
1051
+ return vresult;
1052
+ }
1053
+
1054
+
1055
+ static VALUE
1056
+ _wrap_Tag_link__SWIG_1(int argc, VALUE *argv, VALUE self) {
1057
+ ID3_Tag *arg1 = (ID3_Tag *) 0 ;
1058
+ char *arg2 = (char *) 0 ;
1059
+ size_t result;
1060
+ VALUE vresult = Qnil;
1061
+
1062
+ if ((argc < 1) || (argc > 1))
1063
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1064
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Tag, 1);
1065
+ arg2 = StringValuePtr(argv[0]);
1066
+ result = (arg1)->Link((char const *)arg2);
1067
+
1068
+ vresult = UINT2NUM(result);
1069
+ return vresult;
1070
+ }
1071
+
1072
+
1073
+ static VALUE _wrap_Tag_link(int nargs, VALUE *args, VALUE self) {
1074
+ int argc;
1075
+ VALUE argv[4];
1076
+ int ii;
1077
+
1078
+ argc = nargs + 1;
1079
+ argv[0] = self;
1080
+ for (ii = 1; (ii < argc) && (ii < 3); ii++) {
1081
+ argv[ii] = args[ii-1];
1082
+ }
1083
+ if (argc == 2) {
1084
+ int _v;
1085
+ {
1086
+ void *ptr;
1087
+ _v = (NIL_P(argv[0]) || (TYPE(argv[0]) == T_DATA && SWIG_ConvertPtr(argv[0], &ptr, SWIGTYPE_p_ID3_Tag, 0) != -1)) ? 1 : 0;
1088
+ }
1089
+ if (_v) {
1090
+ {
1091
+ _v = (TYPE(argv[1]) == T_STRING) ? 1 : 0;
1092
+ }
1093
+ if (_v) {
1094
+ return _wrap_Tag_link__SWIG_1(nargs, args, self);
1095
+ }
1096
+ }
1097
+ }
1098
+ if (argc == 3) {
1099
+ int _v;
1100
+ {
1101
+ void *ptr;
1102
+ _v = (NIL_P(argv[0]) || (TYPE(argv[0]) == T_DATA && SWIG_ConvertPtr(argv[0], &ptr, SWIGTYPE_p_ID3_Tag, 0) != -1)) ? 1 : 0;
1103
+ }
1104
+ if (_v) {
1105
+ {
1106
+ _v = (TYPE(argv[1]) == T_STRING) ? 1 : 0;
1107
+ }
1108
+ if (_v) {
1109
+ {
1110
+ _v = ((TYPE(argv[2]) == T_FIXNUM) || (TYPE(argv[2]) == T_BIGNUM)) ? 1 : 0;
1111
+ }
1112
+ if (_v) {
1113
+ return _wrap_Tag_link__SWIG_0(nargs, args, self);
1114
+ }
1115
+ }
1116
+ }
1117
+ }
1118
+
1119
+ rb_raise(rb_eArgError, "No matching function for overloaded 'Tag_link'");
1120
+ return Qnil;
1121
+ }
1122
+
1123
+
1124
+ static VALUE
1125
+ _wrap_Tag_update__SWIG_0(int argc, VALUE *argv, VALUE self) {
1126
+ ID3_Tag *arg1 = (ID3_Tag *) 0 ;
1127
+ flags_t arg2 ;
1128
+ flags_t result;
1129
+ VALUE vresult = Qnil;
1130
+
1131
+ if ((argc < 1) || (argc > 1))
1132
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1133
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Tag, 1);
1134
+ arg2 = NUM2UINT(argv[0]);
1135
+ result = (flags_t)(arg1)->Update(arg2);
1136
+
1137
+ vresult = UINT2NUM(result);
1138
+ return vresult;
1139
+ }
1140
+
1141
+
1142
+ static VALUE
1143
+ _wrap_Tag_update__SWIG_1(int argc, VALUE *argv, VALUE self) {
1144
+ ID3_Tag *arg1 = (ID3_Tag *) 0 ;
1145
+ flags_t result;
1146
+ VALUE vresult = Qnil;
1147
+
1148
+ if ((argc < 0) || (argc > 0))
1149
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc);
1150
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Tag, 1);
1151
+ result = (flags_t)(arg1)->Update();
1152
+
1153
+ vresult = UINT2NUM(result);
1154
+ return vresult;
1155
+ }
1156
+
1157
+
1158
+ static VALUE _wrap_Tag_update(int nargs, VALUE *args, VALUE self) {
1159
+ int argc;
1160
+ VALUE argv[3];
1161
+ int ii;
1162
+
1163
+ argc = nargs + 1;
1164
+ argv[0] = self;
1165
+ for (ii = 1; (ii < argc) && (ii < 2); ii++) {
1166
+ argv[ii] = args[ii-1];
1167
+ }
1168
+ if (argc == 1) {
1169
+ int _v;
1170
+ {
1171
+ void *ptr;
1172
+ _v = (NIL_P(argv[0]) || (TYPE(argv[0]) == T_DATA && SWIG_ConvertPtr(argv[0], &ptr, SWIGTYPE_p_ID3_Tag, 0) != -1)) ? 1 : 0;
1173
+ }
1174
+ if (_v) {
1175
+ return _wrap_Tag_update__SWIG_1(nargs, args, self);
1176
+ }
1177
+ }
1178
+ if (argc == 2) {
1179
+ int _v;
1180
+ {
1181
+ void *ptr;
1182
+ _v = (NIL_P(argv[0]) || (TYPE(argv[0]) == T_DATA && SWIG_ConvertPtr(argv[0], &ptr, SWIGTYPE_p_ID3_Tag, 0) != -1)) ? 1 : 0;
1183
+ }
1184
+ if (_v) {
1185
+ {
1186
+ _v = ((TYPE(argv[1]) == T_FIXNUM) || (TYPE(argv[1]) == T_BIGNUM)) ? 1 : 0;
1187
+ }
1188
+ if (_v) {
1189
+ return _wrap_Tag_update__SWIG_0(nargs, args, self);
1190
+ }
1191
+ }
1192
+ }
1193
+
1194
+ rb_raise(rb_eArgError, "No matching function for overloaded 'Tag_update'");
1195
+ return Qnil;
1196
+ }
1197
+
1198
+
1199
+ static VALUE
1200
+ _wrap_Tag_strip__SWIG_0(int argc, VALUE *argv, VALUE self) {
1201
+ ID3_Tag *arg1 = (ID3_Tag *) 0 ;
1202
+ flags_t arg2 ;
1203
+ flags_t result;
1204
+ VALUE vresult = Qnil;
1205
+
1206
+ if ((argc < 1) || (argc > 1))
1207
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1208
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Tag, 1);
1209
+ arg2 = NUM2UINT(argv[0]);
1210
+ result = (flags_t)(arg1)->Strip(arg2);
1211
+
1212
+ vresult = UINT2NUM(result);
1213
+ return vresult;
1214
+ }
1215
+
1216
+
1217
+ static VALUE
1218
+ _wrap_Tag_strip__SWIG_1(int argc, VALUE *argv, VALUE self) {
1219
+ ID3_Tag *arg1 = (ID3_Tag *) 0 ;
1220
+ flags_t result;
1221
+ VALUE vresult = Qnil;
1222
+
1223
+ if ((argc < 0) || (argc > 0))
1224
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc);
1225
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Tag, 1);
1226
+ result = (flags_t)(arg1)->Strip();
1227
+
1228
+ vresult = UINT2NUM(result);
1229
+ return vresult;
1230
+ }
1231
+
1232
+
1233
+ static VALUE _wrap_Tag_strip(int nargs, VALUE *args, VALUE self) {
1234
+ int argc;
1235
+ VALUE argv[3];
1236
+ int ii;
1237
+
1238
+ argc = nargs + 1;
1239
+ argv[0] = self;
1240
+ for (ii = 1; (ii < argc) && (ii < 2); ii++) {
1241
+ argv[ii] = args[ii-1];
1242
+ }
1243
+ if (argc == 1) {
1244
+ int _v;
1245
+ {
1246
+ void *ptr;
1247
+ _v = (NIL_P(argv[0]) || (TYPE(argv[0]) == T_DATA && SWIG_ConvertPtr(argv[0], &ptr, SWIGTYPE_p_ID3_Tag, 0) != -1)) ? 1 : 0;
1248
+ }
1249
+ if (_v) {
1250
+ return _wrap_Tag_strip__SWIG_1(nargs, args, self);
1251
+ }
1252
+ }
1253
+ if (argc == 2) {
1254
+ int _v;
1255
+ {
1256
+ void *ptr;
1257
+ _v = (NIL_P(argv[0]) || (TYPE(argv[0]) == T_DATA && SWIG_ConvertPtr(argv[0], &ptr, SWIGTYPE_p_ID3_Tag, 0) != -1)) ? 1 : 0;
1258
+ }
1259
+ if (_v) {
1260
+ {
1261
+ _v = ((TYPE(argv[1]) == T_FIXNUM) || (TYPE(argv[1]) == T_BIGNUM)) ? 1 : 0;
1262
+ }
1263
+ if (_v) {
1264
+ return _wrap_Tag_strip__SWIG_0(nargs, args, self);
1265
+ }
1266
+ }
1267
+ }
1268
+
1269
+ rb_raise(rb_eArgError, "No matching function for overloaded 'Tag_strip'");
1270
+ return Qnil;
1271
+ }
1272
+
1273
+
1274
+ static VALUE
1275
+ _wrap_Tag_clear(int argc, VALUE *argv, VALUE self) {
1276
+ ID3_Tag *arg1 = (ID3_Tag *) 0 ;
1277
+
1278
+ if ((argc < 0) || (argc > 0))
1279
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc);
1280
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Tag, 1);
1281
+ (arg1)->Clear();
1282
+
1283
+ return Qnil;
1284
+ }
1285
+
1286
+
1287
+ static VALUE
1288
+ _wrap_Tag_remove_frame(int argc, VALUE *argv, VALUE self) {
1289
+ ID3_Tag *arg1 = (ID3_Tag *) 0 ;
1290
+ ID3_Frame *arg2 = (ID3_Frame *) 0 ;
1291
+ ID3_Frame *result;
1292
+ VALUE vresult = Qnil;
1293
+
1294
+ if ((argc < 1) || (argc > 1))
1295
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1296
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Tag, 1);
1297
+ SWIG_ConvertPtr(argv[0], (void **) &arg2, SWIGTYPE_p_ID3_Frame, 1);
1298
+ result = (ID3_Frame *)(arg1)->RemoveFrame((ID3_Frame const *)arg2);
1299
+
1300
+ vresult = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_ID3_Frame,0);
1301
+ return vresult;
1302
+ }
1303
+
1304
+
1305
+ static VALUE
1306
+ _wrap_Tag_add_frame(int argc, VALUE *argv, VALUE self) {
1307
+ ID3_Tag *arg1 = (ID3_Tag *) 0 ;
1308
+ ID3_Frame *arg2 = (ID3_Frame *) 0 ;
1309
+
1310
+ if ((argc < 1) || (argc > 1))
1311
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1312
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Tag, 1);
1313
+ SWIG_ConvertPtr(argv[0], (void **) &arg2, SWIGTYPE_p_ID3_Frame, 1);
1314
+ (arg1)->AddFrame((ID3_Frame const *)arg2);
1315
+
1316
+ return Qnil;
1317
+ }
1318
+
1319
+
1320
+ static VALUE
1321
+ _wrap_Tag_filename(int argc, VALUE *argv, VALUE self) {
1322
+ ID3_Tag *arg1 = (ID3_Tag *) 0 ;
1323
+ char *result;
1324
+ VALUE vresult = Qnil;
1325
+
1326
+ if ((argc < 0) || (argc > 0))
1327
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc);
1328
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Tag, 1);
1329
+ result = (char *)((ID3_Tag const *)arg1)->GetFileName();
1330
+
1331
+ vresult = rb_str_new2(result);
1332
+ return vresult;
1333
+ }
1334
+
1335
+
1336
+ static VALUE
1337
+ _wrap_Tag_set_padding(int argc, VALUE *argv, VALUE self) {
1338
+ ID3_Tag *arg1 = (ID3_Tag *) 0 ;
1339
+ bool arg2 ;
1340
+ bool result;
1341
+ VALUE vresult = Qnil;
1342
+
1343
+ if ((argc < 1) || (argc > 1))
1344
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1345
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Tag, 1);
1346
+ arg2 = RTEST(argv[0]);
1347
+ result = (bool)(arg1)->SetPadding(arg2);
1348
+
1349
+ vresult = result ? Qtrue : Qfalse;
1350
+ return vresult;
1351
+ }
1352
+
1353
+
1354
+ static VALUE
1355
+ _wrap_Tag_size(int argc, VALUE *argv, VALUE self) {
1356
+ ID3_Tag *arg1 = (ID3_Tag *) 0 ;
1357
+ size_t result;
1358
+ VALUE vresult = Qnil;
1359
+
1360
+ if ((argc < 0) || (argc > 0))
1361
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc);
1362
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Tag, 1);
1363
+ result = ((ID3_Tag const *)arg1)->Size();
1364
+
1365
+ vresult = UINT2NUM(result);
1366
+ return vresult;
1367
+ }
1368
+
1369
+
1370
+ static VALUE
1371
+ _wrap_Tag_find(int argc, VALUE *argv, VALUE self) {
1372
+ ID3_Tag *arg1 = (ID3_Tag *) 0 ;
1373
+ ID3_FrameID arg2 ;
1374
+ ID3_Frame *result;
1375
+ VALUE vresult = Qnil;
1376
+
1377
+ if ((argc < 1) || (argc > 1))
1378
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1379
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Tag, 1);
1380
+ arg2 = (ID3_FrameID) NUM2INT(argv[0]);
1381
+ result = (ID3_Frame *)((ID3_Tag const *)arg1)->Find(arg2);
1382
+
1383
+ vresult = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_ID3_Frame,0);
1384
+ return vresult;
1385
+ }
1386
+
1387
+
1388
+ static VALUE
1389
+ _wrap_Tag_iterator_new(int argc, VALUE *argv, VALUE self) {
1390
+ ID3_Tag *arg1 = (ID3_Tag *) 0 ;
1391
+ ID3_Tag::Iterator *result;
1392
+ VALUE vresult = Qnil;
1393
+
1394
+ if ((argc < 0) || (argc > 0))
1395
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc);
1396
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Tag, 1);
1397
+ result = (ID3_Tag::Iterator *)(arg1)->CreateIterator();
1398
+
1399
+ vresult = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_ID3_Tag__Iterator,0);
1400
+ return vresult;
1401
+ }
1402
+
1403
+
1404
+ static VALUE
1405
+ _wrap_Tag_iterator_next_frame(int argc, VALUE *argv, VALUE self) {
1406
+ ID3_Tag *arg1 = (ID3_Tag *) 0 ;
1407
+ ID3_Tag::Iterator *arg2 = (ID3_Tag::Iterator *) 0 ;
1408
+ ID3_Frame *result;
1409
+ VALUE vresult = Qnil;
1410
+
1411
+ if ((argc < 1) || (argc > 1))
1412
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1413
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Tag, 1);
1414
+ SWIG_ConvertPtr(argv[0], (void **) &arg2, SWIGTYPE_p_ID3_Tag__Iterator, 1);
1415
+ result = (ID3_Frame *)ID3_Tag_iterator_next_frame(arg1,arg2);
1416
+
1417
+ vresult = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_ID3_Frame,0);
1418
+ return vresult;
1419
+ }
1420
+
1421
+
1422
+ swig_class cFrame;
1423
+
1424
+ static VALUE
1425
+ _wrap_new_Frame__SWIG_0(int argc, VALUE *argv, VALUE self) {
1426
+ ID3_FrameID arg1 ;
1427
+ ID3_Frame *result;
1428
+
1429
+ if ((argc < 1) || (argc > 1))
1430
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1431
+ arg1 = (ID3_FrameID) NUM2INT(argv[0]);
1432
+ result = (ID3_Frame *)new ID3_Frame(arg1);
1433
+ DATA_PTR(self) = result;
1434
+ return self;
1435
+ }
1436
+
1437
+
1438
+ #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
1439
+ static VALUE
1440
+ _wrap_Frame_allocate(VALUE self) {
1441
+ #else
1442
+ static VALUE
1443
+ _wrap_Frame_allocate(int argc, VALUE *argv, VALUE self) {
1444
+ #endif
1445
+
1446
+
1447
+ VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_ID3_Frame);
1448
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
1449
+ rb_obj_call_init(vresult, argc, argv);
1450
+ #endif
1451
+ return vresult;
1452
+ }
1453
+
1454
+
1455
+ static VALUE
1456
+ _wrap_new_Frame__SWIG_1(int argc, VALUE *argv, VALUE self) {
1457
+ ID3_Frame *result;
1458
+
1459
+ if ((argc < 0) || (argc > 0))
1460
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc);
1461
+ result = (ID3_Frame *)new ID3_Frame();
1462
+ DATA_PTR(self) = result;
1463
+ return self;
1464
+ }
1465
+
1466
+
1467
+ static VALUE _wrap_new_Frame(int nargs, VALUE *args, VALUE self) {
1468
+ int argc;
1469
+ VALUE argv[1];
1470
+ int ii;
1471
+
1472
+ argc = nargs;
1473
+ for (ii = 0; (ii < argc) && (ii < 1); ii++) {
1474
+ argv[ii] = args[ii];
1475
+ }
1476
+ if (argc == 0) {
1477
+ return _wrap_new_Frame__SWIG_1(nargs, args, self);
1478
+ }
1479
+ if (argc == 1) {
1480
+ int _v;
1481
+ {
1482
+ _v = ((TYPE(argv[0]) == T_FIXNUM) || (TYPE(argv[0]) == T_BIGNUM)) ? 1 : 0;
1483
+ }
1484
+ if (_v) {
1485
+ return _wrap_new_Frame__SWIG_0(nargs, args, self);
1486
+ }
1487
+ }
1488
+
1489
+ rb_raise(rb_eArgError, "No matching function for overloaded 'new_Frame'");
1490
+ return Qnil;
1491
+ }
1492
+
1493
+
1494
+ static void
1495
+ free_ID3_Frame(ID3_Frame *arg1) {
1496
+ delete arg1;
1497
+ }
1498
+ static VALUE
1499
+ _wrap_Frame_field(int argc, VALUE *argv, VALUE self) {
1500
+ ID3_Frame *arg1 = (ID3_Frame *) 0 ;
1501
+ ID3_FieldID arg2 ;
1502
+ ID3_Field *result;
1503
+ VALUE vresult = Qnil;
1504
+
1505
+ if ((argc < 1) || (argc > 1))
1506
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1507
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Frame, 1);
1508
+ arg2 = (ID3_FieldID) NUM2INT(argv[0]);
1509
+ result = (ID3_Field *)((ID3_Frame const *)arg1)->GetField(arg2);
1510
+
1511
+ vresult = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_ID3_Field,0);
1512
+ return vresult;
1513
+ }
1514
+
1515
+
1516
+ static VALUE
1517
+ _wrap_Frame_num(int argc, VALUE *argv, VALUE self) {
1518
+ ID3_Frame *arg1 = (ID3_Frame *) 0 ;
1519
+ ID3_FrameID result;
1520
+ VALUE vresult = Qnil;
1521
+
1522
+ if ((argc < 0) || (argc > 0))
1523
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc);
1524
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Frame, 1);
1525
+ result = (ID3_FrameID)((ID3_Frame const *)arg1)->GetID();
1526
+
1527
+ vresult = INT2NUM(result);
1528
+ return vresult;
1529
+ }
1530
+
1531
+
1532
+ swig_class cField;
1533
+
1534
+ static VALUE
1535
+ _wrap_Field_type(int argc, VALUE *argv, VALUE self) {
1536
+ ID3_Field *arg1 = (ID3_Field *) 0 ;
1537
+ ID3_FieldType result;
1538
+ VALUE vresult = Qnil;
1539
+
1540
+ if ((argc < 0) || (argc > 0))
1541
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc);
1542
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Field, 1);
1543
+ result = (ID3_FieldType)((ID3_Field const *)arg1)->GetType();
1544
+
1545
+ vresult = INT2NUM(result);
1546
+ return vresult;
1547
+ }
1548
+
1549
+
1550
+ static VALUE
1551
+ _wrap_Field_integer(int argc, VALUE *argv, VALUE self) {
1552
+ ID3_Field *arg1 = (ID3_Field *) 0 ;
1553
+ unsigned long result;
1554
+ VALUE vresult = Qnil;
1555
+
1556
+ if ((argc < 0) || (argc > 0))
1557
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc);
1558
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Field, 1);
1559
+ result = (unsigned long)((ID3_Field const *)arg1)->Get();
1560
+
1561
+ vresult = UINT2NUM(result);
1562
+ return vresult;
1563
+ }
1564
+
1565
+
1566
+ static VALUE
1567
+ _wrap_Field_binary(int argc, VALUE *argv, VALUE self) {
1568
+ ID3_Field *arg1 = (ID3_Field *) 0 ;
1569
+ VALUE result;
1570
+ VALUE vresult = Qnil;
1571
+
1572
+ if ((argc < 0) || (argc > 0))
1573
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc);
1574
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Field, 1);
1575
+ result = (VALUE)ID3_Field_binary(arg1);
1576
+
1577
+ vresult = result;
1578
+ return vresult;
1579
+ }
1580
+
1581
+
1582
+ static VALUE
1583
+ _wrap_Field_ascii(int argc, VALUE *argv, VALUE self) {
1584
+ ID3_Field *arg1 = (ID3_Field *) 0 ;
1585
+ char *result;
1586
+ VALUE vresult = Qnil;
1587
+
1588
+ if ((argc < 0) || (argc > 0))
1589
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc);
1590
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Field, 1);
1591
+ result = (char *)((ID3_Field const *)arg1)->GetRawText();
1592
+
1593
+ vresult = rb_str_new2(result);
1594
+ return vresult;
1595
+ }
1596
+
1597
+
1598
+ static VALUE
1599
+ _wrap_Field_unicode(int argc, VALUE *argv, VALUE self) {
1600
+ ID3_Field *arg1 = (ID3_Field *) 0 ;
1601
+ VALUE result;
1602
+ VALUE vresult = Qnil;
1603
+
1604
+ if ((argc < 0) || (argc > 0))
1605
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc);
1606
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Field, 1);
1607
+ result = (VALUE)ID3_Field_unicode(arg1);
1608
+
1609
+ vresult = result;
1610
+ return vresult;
1611
+ }
1612
+
1613
+
1614
+ static VALUE
1615
+ _wrap_Field_set_integer(int argc, VALUE *argv, VALUE self) {
1616
+ ID3_Field *arg1 = (ID3_Field *) 0 ;
1617
+ unsigned long arg2 ;
1618
+
1619
+ if ((argc < 1) || (argc > 1))
1620
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1621
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Field, 1);
1622
+ arg2 = NUM2ULONG(argv[0]);
1623
+ (arg1)->Set(arg2);
1624
+
1625
+ return Qnil;
1626
+ }
1627
+
1628
+
1629
+ static VALUE
1630
+ _wrap_Field_set_binary(int argc, VALUE *argv, VALUE self) {
1631
+ ID3_Field *arg1 = (ID3_Field *) 0 ;
1632
+ VALUE arg2 ;
1633
+ size_t result;
1634
+ VALUE vresult = Qnil;
1635
+
1636
+ if ((argc < 1) || (argc > 1))
1637
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1638
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Field, 1);
1639
+ arg2 = argv[0];
1640
+ result = ID3_Field_set_binary(arg1,arg2);
1641
+
1642
+ vresult = UINT2NUM(result);
1643
+ return vresult;
1644
+ }
1645
+
1646
+
1647
+ static VALUE
1648
+ _wrap_Field_set_ascii(int argc, VALUE *argv, VALUE self) {
1649
+ ID3_Field *arg1 = (ID3_Field *) 0 ;
1650
+ char *arg2 = (char *) 0 ;
1651
+ size_t result;
1652
+ VALUE vresult = Qnil;
1653
+
1654
+ if ((argc < 1) || (argc > 1))
1655
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1656
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Field, 1);
1657
+ arg2 = StringValuePtr(argv[0]);
1658
+ result = (arg1)->Set((char const *)arg2);
1659
+
1660
+ vresult = UINT2NUM(result);
1661
+ return vresult;
1662
+ }
1663
+
1664
+
1665
+ static VALUE
1666
+ _wrap_Field_set_encoding(int argc, VALUE *argv, VALUE self) {
1667
+ ID3_Field *arg1 = (ID3_Field *) 0 ;
1668
+ ID3_TextEnc arg2 ;
1669
+ bool result;
1670
+ VALUE vresult = Qnil;
1671
+
1672
+ if ((argc < 1) || (argc > 1))
1673
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1674
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Field, 1);
1675
+ arg2 = (ID3_TextEnc) NUM2INT(argv[0]);
1676
+ result = (bool)(arg1)->SetEncoding(arg2);
1677
+
1678
+ vresult = result ? Qtrue : Qfalse;
1679
+ return vresult;
1680
+ }
1681
+
1682
+
1683
+ static VALUE
1684
+ _wrap_Field_set_unicode(int argc, VALUE *argv, VALUE self) {
1685
+ ID3_Field *arg1 = (ID3_Field *) 0 ;
1686
+ VALUE arg2 ;
1687
+ size_t result;
1688
+ VALUE vresult = Qnil;
1689
+
1690
+ if ((argc < 1) || (argc > 1))
1691
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc);
1692
+ SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_ID3_Field, 1);
1693
+ arg2 = argv[0];
1694
+ result = ID3_Field_set_unicode(arg1,arg2);
1695
+
1696
+ vresult = UINT2NUM(result);
1697
+ return vresult;
1698
+ }
1699
+
1700
+
1701
+
1702
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
1703
+
1704
+ static swig_type_info _swigt__p_ID3_Field = {"_p_ID3_Field", "ID3_Field *", 0, 0, 0};
1705
+ static swig_type_info _swigt__p_ID3_Frame = {"_p_ID3_Frame", "ID3_Frame *", 0, 0, 0};
1706
+ static swig_type_info _swigt__p_ID3_Tag = {"_p_ID3_Tag", "ID3_Tag *", 0, 0, 0};
1707
+ static swig_type_info _swigt__p_ID3_Tag__Iterator = {"_p_ID3_Tag__Iterator", "ID3_Tag::Iterator *", 0, 0, 0};
1708
+ static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "unsigned int *|flags_t *", 0, 0, 0};
1709
+ static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "unsigned long *|VALUE *", 0, 0, 0};
1710
+
1711
+ static swig_type_info *swig_type_initial[] = {
1712
+ &_swigt__p_ID3_Field,
1713
+ &_swigt__p_ID3_Frame,
1714
+ &_swigt__p_ID3_Tag,
1715
+ &_swigt__p_ID3_Tag__Iterator,
1716
+ &_swigt__p_unsigned_int,
1717
+ &_swigt__p_unsigned_long,
1718
+ };
1719
+
1720
+ static swig_cast_info _swigc__p_ID3_Field[] = { {&_swigt__p_ID3_Field, 0, 0, 0},{0, 0, 0, 0}};
1721
+ static swig_cast_info _swigc__p_ID3_Frame[] = { {&_swigt__p_ID3_Frame, 0, 0, 0},{0, 0, 0, 0}};
1722
+ static swig_cast_info _swigc__p_ID3_Tag[] = { {&_swigt__p_ID3_Tag, 0, 0, 0},{0, 0, 0, 0}};
1723
+ static swig_cast_info _swigc__p_ID3_Tag__Iterator[] = { {&_swigt__p_ID3_Tag__Iterator, 0, 0, 0},{0, 0, 0, 0}};
1724
+ static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
1725
+ static swig_cast_info _swigc__p_unsigned_long[] = { {&_swigt__p_unsigned_long, 0, 0, 0},{0, 0, 0, 0}};
1726
+
1727
+ static swig_cast_info *swig_cast_initial[] = {
1728
+ _swigc__p_ID3_Field,
1729
+ _swigc__p_ID3_Frame,
1730
+ _swigc__p_ID3_Tag,
1731
+ _swigc__p_ID3_Tag__Iterator,
1732
+ _swigc__p_unsigned_int,
1733
+ _swigc__p_unsigned_long,
1734
+ };
1735
+
1736
+
1737
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
1738
+
1739
+ /*************************************************************************
1740
+ * Type initialization:
1741
+ * This problem is tough by the requirement that no dynamic
1742
+ * memory is used. Also, since swig_type_info structures store pointers to
1743
+ * swig_cast_info structures and swig_cast_info structures store pointers back
1744
+ * to swig_type_info structures, we need some lookup code at initialization.
1745
+ * The idea is that swig generates all the structures that are needed.
1746
+ * The runtime then collects these partially filled structures.
1747
+ * The SWIG_InitializeModule function takes these initial arrays out of
1748
+ * swig_module, and does all the lookup, filling in the swig_module.types
1749
+ * array with the correct data and linking the correct swig_cast_info
1750
+ * structures together.
1751
+
1752
+ * The generated swig_type_info structures are assigned staticly to an initial
1753
+ * array. We just loop though that array, and handle each type individually.
1754
+ * First we lookup if this type has been already loaded, and if so, use the
1755
+ * loaded structure instead of the generated one. Then we have to fill in the
1756
+ * cast linked list. The cast data is initially stored in something like a
1757
+ * two-dimensional array. Each row corresponds to a type (there are the same
1758
+ * number of rows as there are in the swig_type_initial array). Each entry in
1759
+ * a column is one of the swig_cast_info structures for that type.
1760
+ * The cast_initial array is actually an array of arrays, because each row has
1761
+ * a variable number of columns. So to actually build the cast linked list,
1762
+ * we find the array of casts associated with the type, and loop through it
1763
+ * adding the casts to the list. The one last trick we need to do is making
1764
+ * sure the type pointer in the swig_cast_info struct is correct.
1765
+
1766
+ * First off, we lookup the cast->type name to see if it is already loaded.
1767
+ * There are three cases to handle:
1768
+ * 1) If the cast->type has already been loaded AND the type we are adding
1769
+ * casting info to has not been loaded (it is in this module), THEN we
1770
+ * replace the cast->type pointer with the type pointer that has already
1771
+ * been loaded.
1772
+ * 2) If BOTH types (the one we are adding casting info to, and the
1773
+ * cast->type) are loaded, THEN the cast info has already been loaded by
1774
+ * the previous module so we just ignore it.
1775
+ * 3) Finally, if cast->type has not already been loaded, then we add that
1776
+ * swig_cast_info to the linked list (because the cast->type) pointer will
1777
+ * be correct.
1778
+ **/
1779
+
1780
+ #ifdef __cplusplus
1781
+ extern "C" {
1782
+ #endif
1783
+
1784
+ SWIGRUNTIME void
1785
+ SWIG_InitializeModule(void *clientdata) {
1786
+ swig_type_info *type, *ret;
1787
+ swig_cast_info *cast;
1788
+ size_t i;
1789
+ swig_module_info *module_head;
1790
+ static int init_run = 0;
1791
+
1792
+ clientdata = clientdata;
1793
+
1794
+ if (init_run) return;
1795
+ init_run = 1;
1796
+
1797
+ /* Initialize the swig_module */
1798
+ swig_module.type_initial = swig_type_initial;
1799
+ swig_module.cast_initial = swig_cast_initial;
1800
+
1801
+ /* Try and load any already created modules */
1802
+ module_head = SWIG_GetModule(clientdata);
1803
+ if (module_head) {
1804
+ swig_module.next = module_head->next;
1805
+ module_head->next = &swig_module;
1806
+ } else {
1807
+ /* This is the first module loaded */
1808
+ swig_module.next = &swig_module;
1809
+ SWIG_SetModule(clientdata, &swig_module);
1810
+ }
1811
+
1812
+ /* Now work on filling in swig_module.types */
1813
+ for (i = 0; i < swig_module.size; ++i) {
1814
+ type = 0;
1815
+
1816
+ /* if there is another module already loaded */
1817
+ if (swig_module.next != &swig_module) {
1818
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
1819
+ }
1820
+ if (type) {
1821
+ /* Overwrite clientdata field */
1822
+ if (swig_module.type_initial[i]->clientdata) type->clientdata = swig_module.type_initial[i]->clientdata;
1823
+ } else {
1824
+ type = swig_module.type_initial[i];
1825
+ }
1826
+
1827
+ /* Insert casting types */
1828
+ cast = swig_module.cast_initial[i];
1829
+ while (cast->type) {
1830
+
1831
+ /* Don't need to add information already in the list */
1832
+ ret = 0;
1833
+ if (swig_module.next != &swig_module) {
1834
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
1835
+ }
1836
+ if (ret && type == swig_module.type_initial[i]) {
1837
+ cast->type = ret;
1838
+ ret = 0;
1839
+ }
1840
+
1841
+ if (!ret) {
1842
+ if (type->cast) {
1843
+ type->cast->prev = cast;
1844
+ cast->next = type->cast;
1845
+ }
1846
+ type->cast = cast;
1847
+ }
1848
+
1849
+ cast++;
1850
+ }
1851
+
1852
+ /* Set entry in modules->types array equal to the type */
1853
+ swig_module.types[i] = type;
1854
+ }
1855
+ }
1856
+
1857
+ /* This function will propagate the clientdata field of type to
1858
+ * any new swig_type_info structures that have been added into the list
1859
+ * of equivalent types. It is like calling
1860
+ * SWIG_TypeClientData(type, clientdata) a second time.
1861
+ */
1862
+ SWIGRUNTIME void
1863
+ SWIG_PropagateClientData(void) {
1864
+ size_t i;
1865
+ swig_cast_info *equiv;
1866
+ static int init_run = 0;
1867
+
1868
+ if (init_run) return;
1869
+ init_run = 1;
1870
+
1871
+ for (i = 0; i < swig_module.size; i++) {
1872
+ if (swig_module.types[i]->clientdata) {
1873
+ equiv = swig_module.types[i]->cast;
1874
+ while (equiv) {
1875
+ if (!equiv->converter) {
1876
+ if (equiv->type && !equiv->type->clientdata)
1877
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
1878
+ }
1879
+ equiv = equiv->next;
1880
+ }
1881
+ }
1882
+ }
1883
+ }
1884
+
1885
+ #ifdef __cplusplus
1886
+ }
1887
+ #endif
1888
+
1889
+
1890
+ #ifdef __cplusplus
1891
+ extern "C"
1892
+ #endif
1893
+ SWIGEXPORT void Init_id3lib_api(void) {
1894
+ int i;
1895
+
1896
+ SWIG_InitRuntime();
1897
+ mAPI = rb_define_module("ID3Lib");
1898
+ mAPI = rb_define_module_under(mAPI, "API");
1899
+
1900
+ SWIG_InitializeModule(0);
1901
+ for (i = 0; i < swig_module.size; i++) {
1902
+ SWIG_define_class(swig_module.types[i]);
1903
+ }
1904
+
1905
+
1906
+ cTag.klass = rb_define_class_under(mAPI, "Tag", rb_cObject);
1907
+ SWIG_TypeClientData(SWIGTYPE_p_ID3_Tag, (void *) &cTag);
1908
+ rb_define_alloc_func(cTag.klass, _wrap_Tag_allocate);
1909
+ rb_define_method(cTag.klass, "initialize", VALUEFUNC(_wrap_new_Tag), -1);
1910
+ rb_define_method(cTag.klass, "has_tag_type", VALUEFUNC(_wrap_Tag_has_tag_type), -1);
1911
+ rb_define_method(cTag.klass, "link", VALUEFUNC(_wrap_Tag_link), -1);
1912
+ rb_define_method(cTag.klass, "update", VALUEFUNC(_wrap_Tag_update), -1);
1913
+ rb_define_method(cTag.klass, "strip", VALUEFUNC(_wrap_Tag_strip), -1);
1914
+ rb_define_method(cTag.klass, "clear", VALUEFUNC(_wrap_Tag_clear), -1);
1915
+ rb_define_method(cTag.klass, "remove_frame", VALUEFUNC(_wrap_Tag_remove_frame), -1);
1916
+ rb_define_method(cTag.klass, "add_frame", VALUEFUNC(_wrap_Tag_add_frame), -1);
1917
+ rb_define_method(cTag.klass, "filename", VALUEFUNC(_wrap_Tag_filename), -1);
1918
+ rb_define_method(cTag.klass, "set_padding", VALUEFUNC(_wrap_Tag_set_padding), -1);
1919
+ rb_define_method(cTag.klass, "size", VALUEFUNC(_wrap_Tag_size), -1);
1920
+ rb_define_method(cTag.klass, "find", VALUEFUNC(_wrap_Tag_find), -1);
1921
+ rb_define_method(cTag.klass, "iterator_new", VALUEFUNC(_wrap_Tag_iterator_new), -1);
1922
+ rb_define_method(cTag.klass, "iterator_next_frame", VALUEFUNC(_wrap_Tag_iterator_next_frame), -1);
1923
+ cTag.mark = 0;
1924
+ cTag.destroy = (void (*)(void *)) free_ID3_Tag;
1925
+
1926
+ cFrame.klass = rb_define_class_under(mAPI, "Frame", rb_cObject);
1927
+ SWIG_TypeClientData(SWIGTYPE_p_ID3_Frame, (void *) &cFrame);
1928
+ rb_define_alloc_func(cFrame.klass, _wrap_Frame_allocate);
1929
+ rb_define_method(cFrame.klass, "initialize", VALUEFUNC(_wrap_new_Frame), -1);
1930
+ rb_define_method(cFrame.klass, "field", VALUEFUNC(_wrap_Frame_field), -1);
1931
+ rb_define_method(cFrame.klass, "num", VALUEFUNC(_wrap_Frame_num), -1);
1932
+ cFrame.mark = 0;
1933
+ cFrame.destroy = (void (*)(void *)) free_ID3_Frame;
1934
+
1935
+ cField.klass = rb_define_class_under(mAPI, "Field", rb_cObject);
1936
+ SWIG_TypeClientData(SWIGTYPE_p_ID3_Field, (void *) &cField);
1937
+ rb_undef_alloc_func(cField.klass);
1938
+ rb_define_method(cField.klass, "type", VALUEFUNC(_wrap_Field_type), -1);
1939
+ rb_define_method(cField.klass, "integer", VALUEFUNC(_wrap_Field_integer), -1);
1940
+ rb_define_method(cField.klass, "binary", VALUEFUNC(_wrap_Field_binary), -1);
1941
+ rb_define_method(cField.klass, "ascii", VALUEFUNC(_wrap_Field_ascii), -1);
1942
+ rb_define_method(cField.klass, "unicode", VALUEFUNC(_wrap_Field_unicode), -1);
1943
+ rb_define_method(cField.klass, "set_integer", VALUEFUNC(_wrap_Field_set_integer), -1);
1944
+ rb_define_method(cField.klass, "set_binary", VALUEFUNC(_wrap_Field_set_binary), -1);
1945
+ rb_define_method(cField.klass, "set_ascii", VALUEFUNC(_wrap_Field_set_ascii), -1);
1946
+ rb_define_method(cField.klass, "set_encoding", VALUEFUNC(_wrap_Field_set_encoding), -1);
1947
+ rb_define_method(cField.klass, "set_unicode", VALUEFUNC(_wrap_Field_set_unicode), -1);
1948
+ cField.mark = 0;
1949
+ }
1950
+