class APE::Tag::TagPrivate
{
public:
+ TagPrivate() : file(0), footerLocation(-1), tagLength(0) {}
+
+ TagLib::File *file;
+ long footerLocation;
+ long tagLength;
+
Footer footer;
+
ItemListMap itemListMap;
};
// public methods
////////////////////////////////////////////////////////////////////////////////
-APE::Tag::Tag() :
- TagLib::Tag(),
- d(new TagPrivate())
+APE::Tag::Tag() : TagLib::Tag()
{
+ d = new TagPrivate;
}
-APE::Tag::Tag(TagLib::File *file, long footerLocation) :
- TagLib::Tag(),
- d(new TagPrivate())
+APE::Tag::Tag(TagLib::File *file, long footerLocation) : TagLib::Tag()
{
- read(file, footerLocation);
+ d = new TagPrivate;
+ d->file = file;
+ d->footerLocation = footerLocation;
+
+ read();
}
APE::Tag::~Tag()
// protected methods
////////////////////////////////////////////////////////////////////////////////
-void APE::Tag::read(TagLib::File *file, long footerLocation)
+void APE::Tag::read()
{
- if(file && file->isValid()) {
+ if(d->file && d->file->isValid()) {
- file->seek(footerLocation);
- d->footer.setData(file->readBlock(Footer::size()));
+ d->file->seek(d->footerLocation);
+ d->footer.setData(d->file->readBlock(Footer::size()));
if(d->footer.tagSize() <= Footer::size() ||
- d->footer.tagSize() > uint(file->length()))
+ d->footer.tagSize() > uint(d->file->length()))
return;
- file->seek(footerLocation + Footer::size() - d->footer.tagSize());
- parse(file->readBlock(d->footer.tagSize() - Footer::size()));
+ d->file->seek(d->footerLocation + Footer::size() - d->footer.tagSize());
+ parse(d->file->readBlock(d->footer.tagSize() - Footer::size()));
}
}