From 790c1b16c6c43a659ad01135198c0f384615516d Mon Sep 17 00:00:00 2001 From: Scott Wheeler Date: Thu, 28 Oct 2004 22:05:43 +0000 Subject: [PATCH] More cleanups and some API docs additions. git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@358636 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- ape/apeitem.cpp | 21 ++++++++++----------- ape/apeitem.h | 37 ++++++++++++++++++++++--------------- 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/ape/apeitem.cpp b/ape/apeitem.cpp index 90643ba5..d4cca52d 100644 --- a/ape/apeitem.cpp +++ b/ape/apeitem.cpp @@ -44,28 +44,28 @@ APE::Item::Item() d = new ItemPrivate; } -APE::Item::Item(const String& key, const String& str) +APE::Item::Item(const String &key, const String &s) { d = new ItemPrivate; d->key = key; - d->text.append(str); + d->text.append(s); } -APE::Item::Item(const Item& item) +APE::Item::Item(const Item &item) { d = new ItemPrivate(*item.d); } -Item &APE::Item::operator=(const Item& item) +Item &APE::Item::operator=(const Item &item) { delete d; d = new ItemPrivate(*item.d); return *this; } -void APE::Item::setReadOnly(bool val) +void APE::Item::setReadOnly(bool readOnly) { - d->readOnly = val; + d->readOnly = readOnly; } bool APE::Item::isReadOnly() const @@ -135,10 +135,8 @@ void APE::Item::parse(const ByteVector& data) setReadOnly(flags & 1); setType(ItemTypes((flags >> 1) & 3)); - if(int(d->type) < 2) { - ByteVectorList bl = ByteVectorList::split(d->value, '\0'); - d->text = StringList(bl, String::UTF8); - } + if(int(d->type) < 2) + d->text = StringList(ByteVectorList::split(d->value, '\0'), String::UTF8); } ByteVector APE::Item::render() @@ -164,7 +162,8 @@ ByteVector APE::Item::render() const value.append(it->data(String::UTF8)); } d->value = value; - } else + } + else value.append(d->value); data.append(ByteVector::fromUInt(value.size(), false)); diff --git a/ape/apeitem.h b/ape/apeitem.h index 5953d8b5..72226a97 100644 --- a/ape/apeitem.h +++ b/ape/apeitem.h @@ -42,11 +42,11 @@ namespace TagLib { * Enum of types an Item can have. The value of 3 is reserved. */ enum ItemTypes { - //! item contains text information coded in UTF-8 + //! Item contains text information coded in UTF-8 Text = 0, - //! item contains binary information + //! Item contains binary information Binary = 1, - //! item is a locator of external stored information + //! Item is a locator of external stored information Locator = 2 }; /*! @@ -57,28 +57,35 @@ namespace TagLib { /*! * Constructs an item with \a key and \a value. */ - Item(const String& key, const String& value); + Item(const String &key, const String &value); /*! * Constructs an item with \a key and \a values. */ - Item(const String& key, const StringList& values); + Item(const String &key, const StringList &values); - Item(const Item&); - Item& operator=(const Item&); + /*! + * Construct an item as a copy of \a item. + */ + Item(const Item &item); + + /*! + * Copies the contents of \a item into this item. + */ + Item &operator=(const Item &item); /*! - * Returns the key + * Returns the key. */ String key() const; /*! - * Returns the binary value + * Returns the binary value. */ ByteVector value() const; /*! - * Returns the size of the full item + * Returns the size of the full item. */ int size() const; @@ -99,22 +106,22 @@ namespace TagLib { ByteVector render(); /*! - * Render the item to a ByteVector + * Render the item to a ByteVector. */ ByteVector render() const; /*! - * Parse the item from the ByteVector \a data + * Parse the item from the ByteVector \a data. */ void parse(const ByteVector& data); /*! - * Set the item to read-only + * Set the item to read-only. */ - void setReadOnly(bool); + void setReadOnly(bool readOnly); /*! - * Returns if the item is read-only + * Return true if the item is read-only. */ bool isReadOnly() const; -- 2.40.0