From a2972c8ae0e1887fb57b34ddd61c1c9c0ce80e32 Mon Sep 17 00:00:00 2001 From: Scott Wheeler Date: Thu, 21 Jul 2005 17:27:37 +0000 Subject: [PATCH] Add accessors for the image description. BUG:94258 git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@437378 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- mpeg/id3v2/frames/attachedpictureframe.cpp | 14 ++++++++++++++ mpeg/id3v2/frames/attachedpictureframe.h | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/mpeg/id3v2/frames/attachedpictureframe.cpp b/mpeg/id3v2/frames/attachedpictureframe.cpp index 5700dfe6..945d7a61 100644 --- a/mpeg/id3v2/frames/attachedpictureframe.cpp +++ b/mpeg/id3v2/frames/attachedpictureframe.cpp @@ -95,6 +95,16 @@ void AttachedPictureFrame::setType(Type t) d->type = t; } +String AttachedPictureFrame::description() const +{ + return d->description; +} + +void AttachedPictureFrame::setDescription(const String &desc) +{ + d->description = desc; +} + ByteVector AttachedPictureFrame::picture() const { return d->data; @@ -122,8 +132,10 @@ void AttachedPictureFrame::parseFields(const ByteVector &data) pos += 1; int offset = data.find(textDelimiter(String::Latin1), pos); + if(offset < pos) return; + d->mimeType = String(data.mid(pos, offset - pos), String::Latin1); pos = offset + 1; @@ -131,8 +143,10 @@ void AttachedPictureFrame::parseFields(const ByteVector &data) pos += 1; offset = data.find(textDelimiter(d->textEncoding), pos); + if(offset < pos) return; + d->description = String(data.mid(pos, offset - pos), d->textEncoding); pos = offset + 1; diff --git a/mpeg/id3v2/frames/attachedpictureframe.h b/mpeg/id3v2/frames/attachedpictureframe.h index 896f0021..2cb2444f 100644 --- a/mpeg/id3v2/frames/attachedpictureframe.h +++ b/mpeg/id3v2/frames/attachedpictureframe.h @@ -156,6 +156,26 @@ namespace TagLib { */ void setType(Type t); + /*! + * Returns a text description of the image. + * + * \see setDescription() + * \see textEncoding() + * \see setTextEncoding() + */ + + String description() const; + + /*! + * Sets a textual description of the image to \a desc. + * + * \see description() + * \see textEncoding() + * \see setTextEncoding() + */ + + void setDescription(const String &desc); + /*! * Returns the image data as a ByteVector. * -- 2.40.0