Add M4A to files pattern
[someplayer] / src / taglib / asf / asfattribute.h
1 /**************************************************************************
2     copyright            : (C) 2005-2007 by Lukáš Lalinský
3     email                : lalinsky@gmail.com
4  **************************************************************************/
5
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.                     *
10  *                                                                         *
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.                       *
15  *                                                                         *
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  *
19  *   USA                                                                   *
20  *                                                                         *
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  ***************************************************************************/
25
26 #ifndef TAGLIB_ASFATTRIBUTE_H
27 #define TAGLIB_ASFATTRIBUTE_H
28
29 #include "tstring.h"
30 #include "tbytevector.h"
31 #include "taglib_export.h"
32
33 namespace TagLib
34 {
35
36   namespace ASF
37   {
38
39     class File;
40
41     class TAGLIB_EXPORT Attribute
42     {
43     public:
44
45       /*!
46        * Enum of types an Attribute can have.
47        */
48       enum AttributeTypes {
49         UnicodeType = 0,
50         BytesType   = 1,
51         BoolType    = 2,
52         DWordType   = 3,
53         QWordType   = 4,
54         WordType    = 5,
55         GuidType    = 6
56       };
57
58       /*!
59        * Constructs an empty attribute.
60        */
61       Attribute();
62
63       /*!
64        * Constructs an attribute with \a key and a UnicodeType \a value.
65        */
66       Attribute(const String &value);
67
68       /*!
69        * Constructs an attribute with \a key and a BytesType \a value.
70        */
71       Attribute(const ByteVector &value);
72
73       /*!
74        * Constructs an attribute with \a key and a DWordType \a value.
75        */
76       Attribute(unsigned int value);
77
78       /*!
79        * Constructs an attribute with \a key and a QWordType \a value.
80        */
81       Attribute(unsigned long long value);
82
83       /*!
84        * Constructs an attribute with \a key and a WordType \a value.
85        */
86       Attribute(unsigned short value);
87
88       /*!
89        * Constructs an attribute with \a key and a BoolType \a value.
90        */
91       Attribute(bool value);
92
93       /*!
94        * Construct an attribute as a copy of \a other.
95        */
96       Attribute(const Attribute &item);
97
98       /*!
99        * Copies the contents of \a other into this item.
100        */
101       ASF::Attribute &operator=(const Attribute &other);
102
103       /*!
104        * Destroys the attribute.
105        */
106       virtual ~Attribute();
107
108       /*!
109        * Returns type of the value.
110        */
111       AttributeTypes type() const;
112
113       /*!
114        * Returns the BoolType \a value.
115        */
116       unsigned short toBool() const;
117
118       /*!
119        * Returns the WordType \a value.
120        */
121       unsigned short toUShort() const;
122
123       /*!
124        * Returns the DWordType \a value.
125        */
126       unsigned int toUInt() const;
127
128       /*!
129        * Returns the QWordType \a value.
130        */
131       unsigned long long toULongLong() const;
132
133       /*!
134        * Returns the UnicodeType \a value.
135        */
136       String toString() const;
137
138       /*!
139        * Returns the BytesType \a value.
140        */
141       ByteVector toByteVector() const;
142
143       /*!
144        * Returns the language number, or 0 is no stream number was set.
145        */
146       int language() const;
147
148       /*!
149        * Sets the language number.
150        */
151       void setLanguage(int value);
152
153       /*!
154        * Returns the stream number, or 0 is no stream number was set.
155        */
156       int stream() const;
157
158       /*!
159        * Sets the stream number.
160        */
161       void setStream(int value);
162
163 #ifndef DO_NOT_DOCUMENT
164       /* THIS IS PRIVATE, DON'T TOUCH IT! */
165       String parse(ASF::File &file, int kind = 0);
166 #endif
167
168       //! Returns the size of the stored data
169       int dataSize() const;
170
171     private:
172       friend class File;
173
174       ByteVector render(const String &name, int kind = 0) const;
175
176       class AttributePrivate;
177       AttributePrivate *d;
178     };
179
180   }
181
182 }
183
184 #endif