Added TagLib (with AUTORS and COPYING files)
[someplayer] / src / taglib / mpeg / id3v2 / frames / urllinkframe.h
1 /***************************************************************************
2     copyright            : (C) 2002 - 2008 by Scott Wheeler
3     email                : wheeler@kde.org
4     copyright            : (C) 2006 by Urs Fleisch
5     email                : ufleisch@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_URLLINKFRAME_H
29 #define TAGLIB_URLLINKFRAME_H
30
31 #include "id3v2frame.h"
32
33 namespace TagLib {
34
35   namespace ID3v2 {
36
37     //! ID3v2 URL frame
38     /*!
39      * An implementation of ID3v2 URL link frames.
40      */
41     class TAGLIB_EXPORT UrlLinkFrame : public Frame
42     {
43       friend class FrameFactory;
44
45     public:
46       /*!
47        * This is a dual purpose constructor.  \a data can either be binary data
48        * that should be parsed or (at a minimum) the frame ID.
49        */
50       explicit UrlLinkFrame(const ByteVector &data);
51
52       /*!
53        * Destroys this UrlLinkFrame instance.
54        */
55       virtual ~UrlLinkFrame();
56
57       /*!
58        * Returns the URL.
59        */
60       virtual String url() const;
61
62       /*!
63        * Sets the URL to \a s.
64        */
65       virtual void setUrl(const String &s);
66
67       // Reimplementations.
68
69       virtual void setText(const String &s);
70       virtual String toString() const;
71
72     protected:
73       virtual void parseFields(const ByteVector &data);
74       virtual ByteVector renderFields() const;
75
76       /*!
77        * The constructor used by the FrameFactory.
78        */
79       UrlLinkFrame(const ByteVector &data, Header *h);
80
81     private:
82       UrlLinkFrame(const UrlLinkFrame &);
83       UrlLinkFrame &operator=(const UrlLinkFrame &);
84
85       class UrlLinkFramePrivate;
86       UrlLinkFramePrivate *d;
87     };
88
89     //! ID3v2 User defined URL frame
90
91     /*!
92      * This is a specialization of URL link frames that allows for
93      * user defined entries.  Each entry has a description in addition to the
94      * normal list of fields that a URL link frame has.
95      *
96      * This description identifies the frame and must be unique.
97      */
98     class TAGLIB_EXPORT UserUrlLinkFrame : public UrlLinkFrame
99     {
100       friend class FrameFactory;
101
102     public:
103       /*!
104        * Constructs an empty user defined URL link frame.  For this to be
105        * a useful frame both a description and text must be set.
106        */
107       explicit UserUrlLinkFrame(String::Type encoding = String::Latin1);
108
109       /*!
110        * This is a dual purpose constructor.  \a data can either be binary data
111        * that should be parsed or (at a minimum) the frame ID.
112        */
113       explicit UserUrlLinkFrame(const ByteVector &data);
114
115       /*!
116        * Destroys this UserUrlLinkFrame instance.
117        */
118       virtual ~UserUrlLinkFrame();
119
120       // Reimplementations.
121
122       virtual String toString() const;
123
124       /*!
125        * Returns the text encoding that will be used in rendering this frame.
126        * This defaults to the type that was either specified in the constructor
127        * or read from the frame when parsed.
128        *
129        * \see setTextEncoding()
130        * \see render()
131        */
132       String::Type textEncoding() const;
133
134       /*!
135        * Sets the text encoding to be used when rendering this frame to
136        * \a encoding.
137        *
138        * \see textEncoding()
139        * \see render()
140        */
141       void setTextEncoding(String::Type encoding);
142
143       /*!
144        * Returns the description for this frame.
145        */
146       String description() const;
147
148       /*!
149        * Sets the description of the frame to \a s.  \a s must be unique.
150        */
151       void setDescription(const String &s);
152
153     protected:
154       virtual void parseFields(const ByteVector &data);
155       virtual ByteVector renderFields() const;
156
157       /*!
158        * The constructor used by the FrameFactory.
159        */
160       UserUrlLinkFrame(const ByteVector &data, Header *h);
161
162     private:
163       UserUrlLinkFrame(const UserUrlLinkFrame &);
164       UserUrlLinkFrame &operator=(const UserUrlLinkFrame &);
165
166       class UserUrlLinkFramePrivate;
167       UserUrlLinkFramePrivate *d;
168     };
169
170   }
171 }
172 #endif