00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #if defined HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031
00032
00033 #include "readers.h"
00034 #include "frame_impl.h"
00035
00062 ID3_Frame::ID3_Frame(ID3_FrameID id)
00063 : _impl(new ID3_FrameImpl(id))
00064 {
00065 }
00066
00067 ID3_Frame::ID3_Frame(const ID3_Frame& frame)
00068 : _impl(new ID3_FrameImpl(frame))
00069 {
00070 }
00071
00072 ID3_Frame::~ID3_Frame()
00073 {
00074 delete _impl;
00075 }
00076
00082 void ID3_Frame::Clear()
00083 {
00084 _impl->Clear();
00085 }
00086
00094 ID3_FrameID ID3_Frame::GetID() const
00095 {
00096 return _impl->GetID();
00097 }
00098
00116 bool ID3_Frame::SetID(ID3_FrameID id)
00117 {
00118 return _impl->SetID(id);
00119 }
00120
00121 bool ID3_Frame::SetSpec(ID3_V2Spec spec)
00122 {
00123 return _impl->SetSpec(spec);
00124 }
00125
00126 ID3_V2Spec ID3_Frame::GetSpec() const
00127 {
00128 return _impl->GetSpec();
00129 }
00130
00142 ID3_Field& ID3_Frame::Field(ID3_FieldID fieldName) const
00143 {
00144 return *this->GetField(fieldName);
00145 }
00146
00147 ID3_Field* ID3_Frame::GetField(ID3_FieldID fieldName) const
00148 {
00149 return _impl->GetField(fieldName);
00150 }
00151
00152 size_t ID3_Frame::NumFields() const
00153 {
00154 return _impl->NumFields();
00155 }
00156
00157
00158
00159
00160
00161
00162
00163
00164 size_t ID3_Frame::Size()
00165 {
00166 return _impl->Size();
00167 }
00168
00169
00170 bool ID3_Frame::HasChanged() const
00171 {
00172 return _impl->HasChanged();
00173 }
00174
00175 ID3_Frame& ID3_Frame::operator=( const ID3_Frame &rFrame )
00176 {
00177 if (this != &rFrame)
00178 {
00179 *_impl = rFrame;
00180 }
00181 return *this;
00182 }
00183
00184 const char* ID3_Frame::GetDescription(ID3_FrameID id)
00185 {
00186 return ID3_FrameImpl::GetDescription(id);
00187 }
00188
00189 const char* ID3_Frame::GetDescription() const
00190 {
00191 return _impl->GetDescription();
00192 }
00193
00194 const char* ID3_Frame::GetTextID() const
00195 {
00196 return _impl->GetTextID();
00197 }
00198
00199 bool ID3_Frame::Parse(ID3_Reader& reader)
00200 {
00201 return _impl->Parse(reader);
00202 }
00203
00204 void ID3_Frame::Render(ID3_Writer& writer) const
00205 {
00206 _impl->Render(writer);
00207 }
00208
00209 bool ID3_Frame::Contains(ID3_FieldID id) const
00210 {
00211 return _impl->Contains(id);
00212 }
00213
00219 bool ID3_Frame::SetCompression(bool b)
00220 {
00221 return _impl->SetCompression(b);
00222 }
00223
00232 bool ID3_Frame::GetCompression() const
00233 {
00234 return _impl->GetCompression();
00235 }
00236
00237 size_t ID3_Frame::GetDataSize() const
00238 {
00239 return _impl->GetDataSize();
00240 }
00241
00242 bool ID3_Frame::SetEncryptionID(uchar id)
00243 {
00244 return _impl->SetEncryptionID(id);
00245 }
00246
00247 uchar ID3_Frame::GetEncryptionID() const
00248 {
00249 return _impl->GetEncryptionID();
00250 }
00251
00252 bool ID3_Frame::SetGroupingID(uchar id)
00253 {
00254 return _impl->SetGroupingID(id);
00255 }
00256
00257 uchar ID3_Frame::GetGroupingID() const
00258 {
00259 return _impl->GetGroupingID();
00260 }
00261
00262 namespace
00263 {
00264 class IteratorImpl : public ID3_Frame::Iterator
00265 {
00266 ID3_FrameImpl::iterator _cur;
00267 ID3_FrameImpl::iterator _end;
00268 public:
00269 IteratorImpl(ID3_FrameImpl& frame)
00270 : _cur(frame.begin()), _end(frame.end())
00271 {
00272 }
00273
00274 ID3_Field* GetNext()
00275 {
00276 ID3_Field* next = NULL;
00277 while (next == NULL && _cur != _end)
00278 {
00279 next = *_cur;
00280 ++_cur;
00281 }
00282 return next;
00283 }
00284 };
00285
00286
00287 class ConstIteratorImpl : public ID3_Frame::ConstIterator
00288 {
00289 ID3_FrameImpl::const_iterator _cur;
00290 ID3_FrameImpl::const_iterator _end;
00291 public:
00292 ConstIteratorImpl(ID3_FrameImpl& frame)
00293 : _cur(frame.begin()), _end(frame.end())
00294 {
00295 }
00296 const ID3_Field* GetNext()
00297 {
00298 ID3_Field* next = NULL;
00299 while (next == NULL && _cur != _end)
00300 {
00301 next = *_cur;
00302 ++_cur;
00303 }
00304 return next;
00305 }
00306 };
00307 }
00308
00309 ID3_Frame::Iterator*
00310 ID3_Frame::CreateIterator()
00311 {
00312 return new IteratorImpl(*_impl);
00313 }
00314
00315 ID3_Frame::ConstIterator*
00316 ID3_Frame::CreateIterator() const
00317 {
00318 return new ConstIteratorImpl(*_impl);
00319 }
00320