1 /************************************************************************** 2 copyright : (C) 2005-2007 by Lukáš Lalinský 3 email : [email protected] 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., 51 Franklin Street, Fifth Floor, Boston, MA * 19 * 02110-1301 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_ASFTAG_H 27 #define TAGLIB_ASFTAG_H 28 29 #include "tag.h" 30 #include "tlist.h" 31 #include "tmap.h" 32 #include "taglib_export.h" 33 #include "asfattribute.h" 34 35 namespace TagLib { 36 37 namespace ASF { 38 39 typedef List<Attribute> AttributeList; 40 typedef Map<String, AttributeList> AttributeListMap; 41 42 class TAGLIB_EXPORT Tag : public TagLib::Tag { 43 44 friend class File; 45 46 public: 47 48 Tag(); 49 50 virtual ~Tag(); 51 52 /*! 53 * Returns the track name. 54 */ 55 virtual String title() const; 56 57 /*! 58 * Returns the artist name. 59 */ 60 virtual String artist() const; 61 62 /*! 63 * Returns the album name; if no album name is present in the tag 64 * String::null will be returned. 65 */ 66 virtual String album() const; 67 68 /*! 69 * Returns the track comment. 70 */ 71 virtual String comment() const; 72 73 /*! 74 * Returns the genre name; if no genre is present in the tag String::null 75 * will be returned. 76 */ 77 virtual String genre() const; 78 79 /*! 80 * Returns the rating. 81 */ 82 virtual String rating() const; 83 84 /*! 85 * Returns the genre name; if no genre is present in the tag String::null 86 * will be returned. 87 */ 88 virtual String copyright() const; 89 90 /*! 91 * Returns the year; if there is no year set, this will return 0. 92 */ 93 virtual unsigned int year() const; 94 95 /*! 96 * Returns the track number; if there is no track number set, this will 97 * return 0. 98 */ 99 virtual unsigned int track() const; 100 101 /*! 102 * Sets the title to \a s. 103 */ 104 virtual void setTitle(const String &s); 105 106 /*! 107 * Sets the artist to \a s. 108 */ 109 virtual void setArtist(const String &s); 110 111 /*! 112 * Sets the album to \a s. If \a s is String::null then this value will be 113 * cleared. 114 */ 115 virtual void setAlbum(const String &s); 116 117 /*! 118 * Sets the comment to \a s. 119 */ 120 virtual void setComment(const String &s); 121 122 /*! 123 * Sets the rating to \a s. 124 */ 125 virtual void setRating(const String &s); 126 127 /*! 128 * Sets the copyright to \a s. 129 */ 130 virtual void setCopyright(const String &s); 131 132 /*! 133 * Sets the genre to \a s. 134 */ 135 virtual void setGenre(const String &s); 136 137 /*! 138 * Sets the year to \a i. If \a s is 0 then this value will be cleared. 139 */ 140 virtual void setYear(unsigned int i); 141 142 /*! 143 * Sets the track to \a i. If \a s is 0 then this value will be cleared. 144 */ 145 virtual void setTrack(unsigned int i); 146 147 /*! 148 * Returns true if the tag does not contain any data. This should be 149 * reimplemented in subclasses that provide more than the basic tagging 150 * abilities in this class. 151 */ 152 virtual bool isEmpty() const; 153 154 /*! 155 * \deprecated 156 */ 157 AttributeListMap &attributeListMap(); 158 159 /*! 160 * Returns a reference to the item list map. This is an AttributeListMap of 161 * all of the items in the tag. 162 */ 163 // BIC: return by value 164 const AttributeListMap &attributeListMap() const; 165 166 /*! 167 * \return True if a value for \a attribute is currently set. 168 */ 169 bool contains(const String &name) const; 170 171 /*! 172 * Removes the \a key attribute from the tag 173 */ 174 void removeItem(const String &name); 175 176 /*! 177 * \return The list of values for the key \a name, or an empty list if no 178 * values have been set. 179 */ 180 AttributeList attribute(const String &name) const; 181 182 /*! 183 * Sets the \a key attribute to the value of \a attribute. If an attribute 184 * with the \a key is already present, it will be replaced. 185 */ 186 void setAttribute(const String &name, const Attribute &attribute); 187 188 /*! 189 * Sets multiple \a values to the key \a name. 190 */ 191 void setAttribute(const String &name, const AttributeList &values); 192 193 /*! 194 * Sets the \a key attribute to the value of \a attribute. If an attribute 195 * with the \a key is already present, it will be added to the list. 196 */ 197 void addAttribute(const String &name, const Attribute &attribute); 198 199 PropertyMap properties() const; 200 void removeUnsupportedProperties(const StringList& properties); 201 PropertyMap setProperties(const PropertyMap &properties); 202 203 private: 204 205 class TagPrivate; 206 TagPrivate *d; 207 }; 208 } 209 } 210 #endif 211