1 /**************************************************************************
2 copyright : (C) 2005-2007 by Lukáš Lalinský
3 email : lalinsky@gmail.com
4 **************************************************************************/
6 /***************************************************************************
7 * This library is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU Lesser General Public License version *
9 * 2.1 as published by the Free Software Foundation. *
11 * This library is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * Lesser General Public License for more details. *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with this library; if not, write to the Free Software *
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
21 * Alternatively, this file is available under the Mozilla Public *
22 * License Version 1.1. You may obtain a copy of the License at *
23 * http://www.mozilla.org/MPL/ *
24 ***************************************************************************/
26 #ifndef TAGLIB_ASFATTRIBUTE_H
27 #define TAGLIB_ASFATTRIBUTE_H
30 #include "tbytevector.h"
31 #include "taglib_export.h"
41 class TAGLIB_EXPORT Attribute
46 * Enum of types an Attribute can have.
59 * Constructs an empty attribute.
64 * Constructs an attribute with \a key and a UnicodeType \a value.
66 Attribute(const String &value);
69 * Constructs an attribute with \a key and a BytesType \a value.
71 Attribute(const ByteVector &value);
74 * Constructs an attribute with \a key and a DWordType \a value.
76 Attribute(unsigned int value);
79 * Constructs an attribute with \a key and a QWordType \a value.
81 Attribute(unsigned long long value);
84 * Constructs an attribute with \a key and a WordType \a value.
86 Attribute(unsigned short value);
89 * Constructs an attribute with \a key and a BoolType \a value.
91 Attribute(bool value);
94 * Construct an attribute as a copy of \a other.
96 Attribute(const Attribute &item);
99 * Copies the contents of \a other into this item.
101 ASF::Attribute &operator=(const Attribute &other);
104 * Destroys the attribute.
106 virtual ~Attribute();
109 * Returns type of the value.
111 AttributeTypes type() const;
114 * Returns the BoolType \a value.
116 unsigned short toBool() const;
119 * Returns the WordType \a value.
121 unsigned short toUShort() const;
124 * Returns the DWordType \a value.
126 unsigned int toUInt() const;
129 * Returns the QWordType \a value.
131 unsigned long long toULongLong() const;
134 * Returns the UnicodeType \a value.
136 String toString() const;
139 * Returns the BytesType \a value.
141 ByteVector toByteVector() const;
144 * Returns the language number, or 0 is no stream number was set.
146 int language() const;
149 * Sets the language number.
151 void setLanguage(int value);
154 * Returns the stream number, or 0 is no stream number was set.
159 * Sets the stream number.
161 void setStream(int value);
163 #ifndef DO_NOT_DOCUMENT
164 /* THIS IS PRIVATE, DON'T TOUCH IT! */
165 String parse(ASF::File &file, int kind = 0);
168 //! Returns the size of the stored data
169 int dataSize() const;
174 ByteVector render(const String &name, int kind = 0) const;
176 class AttributePrivate;