Added TagLib (with AUTORS and COPYING files)
[someplayer] / src / taglib / mpeg / id3v2 / frames / generalencapsulatedobjectframe.h
1 /***************************************************************************
2     copyright            : (C) 2002 - 2008 by Scott Wheeler
3     email                : wheeler@kde.org
4     copyright            : (C) 2006 by Aaron VonderHaar
5     email                : avh4@users.sourceforge.net
6  ***************************************************************************/
7
8 /***************************************************************************
9  *   This library is free software; you can redistribute it and/or modify  *
10  *   it under the terms of the GNU Lesser General Public License version   *
11  *   2.1 as published by the Free Software Foundation.                     *
12  *                                                                         *
13  *   This library is distributed in the hope that it will be useful, but   *
14  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
16  *   Lesser General Public License for more details.                       *
17  *                                                                         *
18  *   You should have received a copy of the GNU Lesser General Public      *
19  *   License along with this library; if not, write to the Free Software   *
20  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
21  *   USA                                                                   *
22  *                                                                         *
23  *   Alternatively, this file is available under the Mozilla Public        *
24  *   License Version 1.1.  You may obtain a copy of the License at         *
25  *   http://www.mozilla.org/MPL/                                           *
26  ***************************************************************************/
27
28 #ifndef TAGLIB_GENERALENCAPSULATEDOBJECT_H
29 #define TAGLIB_GENERALENCAPSULATEDOBJECT_H
30
31 #include "id3v2frame.h"
32 #include "id3v2header.h"
33 #include "taglib_export.h"
34
35 namespace TagLib {
36
37   namespace ID3v2 {
38
39     //! An ID3v2 general encapsulated object frame implementation
40
41     /*!
42      * This is an implementation of ID3v2 general encapsulated objects.
43      * Arbitrary binary data may be included in tags, stored in GEOB frames.
44      * There may be multiple GEOB frames in a single tag.  Each GEOB it
45      * labelled with a content description (which may be blank), a required
46      * mime-type, and a file name (may be blank).  The content description
47      * uniquely identifies the GEOB frame in the tag.
48      */
49
50     class TAGLIB_EXPORT GeneralEncapsulatedObjectFrame : public Frame
51     {
52       friend class FrameFactory;
53
54     public:
55
56       /*!
57        * Constructs an empty object frame.  The description, file name and text
58        * encoding should be set manually.
59        */
60       GeneralEncapsulatedObjectFrame();
61
62       /*!
63        * Constructs a GeneralEncapsulatedObjectFrame frame based on \a data.
64        *
65        * \warning This is \em not data for the encapsulated object, for that use
66        * setObject().  This constructor is used when reading the frame from the
67        * disk.
68        */
69       explicit GeneralEncapsulatedObjectFrame(const ByteVector &data);
70
71       /*!
72        * Destroys the GeneralEncapsulatedObjectFrame instance.
73        */
74       virtual ~GeneralEncapsulatedObjectFrame();
75
76       /*!
77        * Returns a string containing the description, file name and mime-type
78        */
79       virtual String toString() const;
80
81       /*!
82        * Returns the text encoding used for the description and file name.
83        *
84        * \see setTextEncoding()
85        * \see description()
86        * \see fileName()
87        */
88       String::Type textEncoding() const;
89
90       /*!
91        * Set the text encoding used for the description and file name.
92        *
93        * \see description()
94        * \see fileName()
95        */
96       void setTextEncoding(String::Type encoding);
97
98       /*!
99        * Returns the mime type of the object.
100        */
101       String mimeType() const;
102
103       /*!
104        * Sets the mime type of the object.
105        */
106       void setMimeType(const String &type);
107
108       /*!
109        * Returns the file name of the object.
110        *
111        * \see setFileName()
112        */
113       String fileName() const;
114
115       /*!
116        * Sets the file name for the object.
117        *
118        * \see fileName()
119        */
120       void setFileName(const String &name);
121
122       /*!
123        * Returns the content description of the object.
124        *
125        * \see setDescription()
126        * \see textEncoding()
127        * \see setTextEncoding()
128        */
129
130       String description() const;
131
132       /*!
133        * Sets the content description of the object to \a desc.
134        *
135        * \see description()
136        * \see textEncoding()
137        * \see setTextEncoding()
138        */
139
140       void setDescription(const String &desc);
141
142       /*!
143        * Returns the object data as a ByteVector.
144        *
145        * \note ByteVector has a data() method that returns a const char * which
146        * should make it easy to export this data to external programs.
147        *
148        * \see setObject()
149        * \see mimeType()
150        */
151       ByteVector object() const;
152
153       /*!
154        * Sets the object data to \a data.  \a data should be of the type specified in
155        * this frame's mime-type specification.
156        *
157        * \see object()
158        * \see mimeType()
159        * \see setMimeType()
160        */
161       void setObject(const ByteVector &object);
162
163     protected:
164       virtual void parseFields(const ByteVector &data);
165       virtual ByteVector renderFields() const;
166
167     private:
168       GeneralEncapsulatedObjectFrame(const ByteVector &data, Header *h);
169       GeneralEncapsulatedObjectFrame(const GeneralEncapsulatedObjectFrame &);
170       GeneralEncapsulatedObjectFrame &operator=(const GeneralEncapsulatedObjectFrame &);
171
172       class GeneralEncapsulatedObjectFramePrivate;
173       GeneralEncapsulatedObjectFramePrivate *d;
174     };
175   }
176 }
177
178 #endif