id3lib
3.8.3
Main Page
Namespaces
Classes
Files
File List
File Members
src
frame.cpp
Go to the documentation of this file.
1
// $Id: frame.cpp,v 1.35 2002/08/10 10:42:42 t1mpy Exp $
2
3
// id3lib: a C++ library for creating and manipulating id3v1/v2 tags
4
// Copyright 1999, 2000 Scott Thomas Haug
5
// Copyright 2002 Thijmen Klok (thijmen@id3lib.org)
6
7
// This library is free software; you can redistribute it and/or modify it
8
// under the terms of the GNU Library General Public License as published by
9
// the Free Software Foundation; either version 2 of the License, or (at your
10
// option) any later version.
11
//
12
// This library is distributed in the hope that it will be useful, but WITHOUT
13
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15
// License for more details.
16
//
17
// You should have received a copy of the GNU Library General Public License
18
// along with this library; if not, write to the Free Software Foundation,
19
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21
// The id3lib authors encourage improvements and optimisations to be sent to
22
// the id3lib coordinator. Please see the README file for details on where to
23
// send such submissions. See the AUTHORS file for a list of people who have
24
// contributed to id3lib. See the ChangeLog file for a list of changes to
25
// id3lib. These files are distributed with id3lib at
26
// http://download.sourceforge.net/id3lib/
27
28
#if defined HAVE_CONFIG_H
29
#include <config.h>
30
#endif
31
32
//#include "frame.h"
33
#include "
readers.h
"
34
#include "
frame_impl.h
"
35
62
ID3_Frame::ID3_Frame
(
ID3_FrameID
id
)
63
: _impl(new
ID3_FrameImpl
(id))
64
{
65
}
66
67
ID3_Frame::ID3_Frame
(
const
ID3_Frame
& frame)
68
: _impl(new
ID3_FrameImpl
(frame))
69
{
70
}
71
72
ID3_Frame::~ID3_Frame
()
73
{
74
delete
_impl;
75
}
76
82
void
ID3_Frame::Clear
()
83
{
84
_impl->
Clear
();
85
}
86
94
ID3_FrameID
ID3_Frame::GetID
()
const
95
{
96
return
_impl->
GetID
();
97
}
98
116
bool
ID3_Frame::SetID
(
ID3_FrameID
id
)
117
{
118
return
_impl->
SetID
(
id
);
119
}
120
121
bool
ID3_Frame::SetSpec
(
ID3_V2Spec
spec)
122
{
123
return
_impl->
SetSpec
(spec);
124
}
125
126
ID3_V2Spec
ID3_Frame::GetSpec
()
const
127
{
128
return
_impl->
GetSpec
();
129
}
130
142
ID3_Field
&
ID3_Frame::Field
(
ID3_FieldID
fieldName)
const
143
{
144
return
*this->
GetField
(fieldName);
145
}
146
147
ID3_Field
*
ID3_Frame::GetField
(
ID3_FieldID
fieldName)
const
148
{
149
return
_impl->
GetField
(fieldName);
150
}
151
152
size_t
ID3_Frame::NumFields
()
const
153
{
154
return
_impl->
NumFields
();
155
}
156
157
/*
158
ID3_Field* ID3_Frame::GetFieldNum(size_t index) const
159
{
160
return _impl->GetFieldNum(index);
161
}
162
*/
163
164
size_t
ID3_Frame::Size
()
165
{
166
return
_impl->
Size
();
167
}
168
169
170
bool
ID3_Frame::HasChanged
()
const
171
{
172
return
_impl->
HasChanged
();
173
}
174
175
ID3_Frame
&
ID3_Frame::operator=
(
const
ID3_Frame
&rFrame )
176
{
177
if
(
this
!= &rFrame)
178
{
179
*_impl = rFrame;
180
}
181
return
*
this
;
182
}
183
184
const
char
*
ID3_Frame::GetDescription
(
ID3_FrameID
id
)
185
{
186
return
ID3_FrameImpl::GetDescription
(
id
);
187
}
188
189
const
char
*
ID3_Frame::GetDescription
()
const
190
{
191
return
_impl->
GetDescription
();
192
}
193
194
const
char
*
ID3_Frame::GetTextID
()
const
195
{
196
return
_impl->
GetTextID
();
197
}
198
199
bool
ID3_Frame::Parse
(
ID3_Reader
& reader)
200
{
201
return
_impl->
Parse
(reader);
202
}
203
204
void
ID3_Frame::Render
(
ID3_Writer
& writer)
const
205
{
206
_impl->
Render
(writer);
207
}
208
209
bool
ID3_Frame::Contains
(
ID3_FieldID
id
)
const
210
{
211
return
_impl->
Contains
(
id
);
212
}
213
219
bool
ID3_Frame::SetCompression
(
bool
b)
220
{
221
return
_impl->
SetCompression
(b);
222
}
223
232
bool
ID3_Frame::GetCompression
()
const
233
{
234
return
_impl->
GetCompression
();
235
}
236
237
size_t
ID3_Frame::GetDataSize
()
const
238
{
239
return
_impl->
GetDataSize
();
240
}
241
242
bool
ID3_Frame::SetEncryptionID
(
uchar
id
)
243
{
244
return
_impl->
SetEncryptionID
(
id
);
245
}
246
247
uchar
ID3_Frame::GetEncryptionID
()
const
248
{
249
return
_impl->
GetEncryptionID
();
250
}
251
252
bool
ID3_Frame::SetGroupingID
(
uchar
id
)
253
{
254
return
_impl->
SetGroupingID
(
id
);
255
}
256
257
uchar
ID3_Frame::GetGroupingID
()
const
258
{
259
return
_impl->
GetGroupingID
();
260
}
261
262
namespace
263
{
264
class
IteratorImpl :
public
ID3_Frame::Iterator
265
{
266
ID3_FrameImpl::iterator
_cur;
267
ID3_FrameImpl::iterator
_end;
268
public
:
269
IteratorImpl(
ID3_FrameImpl
& frame)
270
: _cur(frame.begin()), _end(frame.end())
271
{
272
}
273
274
ID3_Field
*
GetNext
()
275
{
276
ID3_Field
* next =
NULL
;
277
while
(next ==
NULL
&& _cur != _end)
278
{
279
next = *_cur;
280
++_cur;
281
}
282
return
next;
283
}
284
};
285
286
287
class
ConstIteratorImpl :
public
ID3_Frame::ConstIterator
288
{
289
ID3_FrameImpl::const_iterator
_cur;
290
ID3_FrameImpl::const_iterator
_end;
291
public
:
292
ConstIteratorImpl(
ID3_FrameImpl
& frame)
293
: _cur(frame.begin()), _end(frame.end())
294
{
295
}
296
const
ID3_Field
*
GetNext
()
297
{
298
ID3_Field
* next =
NULL
;
299
while
(next ==
NULL
&& _cur != _end)
300
{
301
next = *_cur;
302
++_cur;
303
}
304
return
next;
305
}
306
};
307
}
308
309
ID3_Frame::Iterator
*
310
ID3_Frame::CreateIterator
()
311
{
312
return
new
IteratorImpl(*_impl);
313
}
314
315
ID3_Frame::ConstIterator
*
316
ID3_Frame::CreateIterator
()
const
317
{
318
return
new
ConstIteratorImpl(*_impl);
319
}
320
Generated for id3lib by
1.8.3.1