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
This commit is contained in:
Scott Wheeler 2004-10-28 22:05:43 +00:00
parent a92f6b94dd
commit 790c1b16c6
2 changed files with 33 additions and 27 deletions

View File

@ -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));

View File

@ -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 Item&);
Item& operator=(const Item&);
Item(const String &key, const StringList &values);
/*!
* Returns the key
* 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.
*/
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;