![]() |
|
00001 /*************************************************************************** 00002 copyright : (C) 2002 - 2008 by Scott Wheeler 00003 email : wheeler@kde.org 00004 ***************************************************************************/ 00005 00006 /*************************************************************************** 00007 * This library is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU Lesser General Public License version * 00009 * 2.1 as published by the Free Software Foundation. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, but * 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00014 * Lesser General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Lesser General Public * 00017 * License along with this library; if not, write to the Free Software * 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 00019 * 02110-1301 USA * 00020 * * 00021 * Alternatively, this file is available under the Mozilla Public * 00022 * License Version 1.1. You may obtain a copy of the License at * 00023 * http://www.mozilla.org/MPL/ * 00024 ***************************************************************************/ 00025 00026 #ifndef TAGLIB_TEXTIDENTIFICATIONFRAME_H 00027 #define TAGLIB_TEXTIDENTIFICATIONFRAME_H 00028 00029 #include "tstringlist.h" 00030 #include "tmap.h" 00031 #include "taglib_export.h" 00032 00033 #include "id3v2frame.h" 00034 00035 namespace TagLib { 00036 00037 namespace ID3v2 { 00038 00039 class Tag; 00040 typedef Map<String, String> KeyConversionMap; 00041 00043 00106 class TAGLIB_EXPORT TextIdentificationFrame : public Frame 00107 { 00108 friend class FrameFactory; 00109 00110 public: 00120 TextIdentificationFrame(const ByteVector &type, String::Type encoding); 00121 00126 explicit TextIdentificationFrame(const ByteVector &data); 00127 00133 static TextIdentificationFrame *createTIPLFrame(const PropertyMap &properties); 00134 00141 static TextIdentificationFrame *createTMCLFrame(const PropertyMap &properties); 00145 virtual ~TextIdentificationFrame(); 00146 00157 void setText(const StringList &l); 00158 00159 // Reimplementations. 00160 00161 virtual void setText(const String &s); 00162 virtual String toString() const; 00163 00174 String::Type textEncoding() const; 00175 00185 void setTextEncoding(String::Type encoding); 00186 00190 StringList fieldList() const; 00191 00196 static const KeyConversionMap &involvedPeopleMap(); 00197 00198 PropertyMap asProperties() const; 00199 00200 protected: 00201 // Reimplementations. 00202 00203 virtual void parseFields(const ByteVector &data); 00204 virtual ByteVector renderFields() const; 00205 00209 TextIdentificationFrame(const ByteVector &data, Header *h); 00210 00211 private: 00212 TextIdentificationFrame(const TextIdentificationFrame &); 00213 TextIdentificationFrame &operator=(const TextIdentificationFrame &); 00214 00220 PropertyMap makeTIPLProperties() const; 00224 PropertyMap makeTMCLProperties() const; 00225 class TextIdentificationFramePrivate; 00226 TextIdentificationFramePrivate *d; 00227 }; 00228 00237 00238 00239 class TAGLIB_EXPORT UserTextIdentificationFrame : public TextIdentificationFrame 00240 { 00241 friend class FrameFactory; 00242 00243 public: 00248 explicit UserTextIdentificationFrame(String::Type encoding = String::Latin1); 00249 00253 explicit UserTextIdentificationFrame(const ByteVector &data); 00254 00259 UserTextIdentificationFrame(const String &description, const StringList &values, String::Type encoding = String::UTF8); 00260 00261 virtual String toString() const; 00262 00266 String description() const; 00267 00273 void setDescription(const String &s); 00274 00275 StringList fieldList() const; 00276 void setText(const String &text); 00277 void setText(const StringList &fields); 00278 00292 PropertyMap asProperties() const; 00293 00298 static UserTextIdentificationFrame *find(Tag *tag, const String &description); 00299 00300 private: 00301 UserTextIdentificationFrame(const ByteVector &data, Header *h); 00302 UserTextIdentificationFrame(const TextIdentificationFrame &); 00303 UserTextIdentificationFrame &operator=(const UserTextIdentificationFrame &); 00304 00305 void checkFields(); 00306 00307 class UserTextIdentificationFramePrivate; 00308 UserTextIdentificationFramePrivate *d; 00309 }; 00310 00311 } 00312 } 00313 #endif