TagLib API Documentation

flactag.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     copyright            : (C) 2003 by Allan Sandfeld Jensen
00003     email                : kde@carewolf.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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
00019  *   USA                                                                   *
00020  ***************************************************************************/
00021 
00022 #ifndef DO_NOT_DOCUMENT // Tell Doxygen not to document this header
00023 
00024 #ifndef TAGLIB_FLACTAG_H
00025 #define TAGLIB_FLACTAG_H
00026 
00028 // Note that this header is not installed.
00030 
00031 #include <xiphcomment.h>
00032 #include <id3v2tag.h>
00033 #include <id3v1tag.h>
00034 
00035 namespace TagLib {
00036 
00037   namespace FLAC {
00038 
00042     class Tag : public TagLib::Tag
00043     {
00044     public:
00045       Tag(Ogg::XiphComment *xiph, ID3v2::Tag *id3v2 = 0, ID3v1::Tag *id3v1 = 0) :
00046         TagLib::Tag(),
00047         xiph(xiph), id3v2(id3v2), id3v1(id3v1) {}
00048 
00049       virtual String title() const {
00050         if(xiph && !xiph->title().isEmpty())
00051           return xiph->title();
00052 
00053         if(id3v2 && !id3v2->title().isEmpty())
00054           return id3v2->title();
00055 
00056         if(id3v1)
00057           return id3v1->title();
00058 
00059         return String::null;
00060       }
00061 
00062       virtual String artist() const {
00063         if(xiph && !xiph->artist().isEmpty())
00064           return xiph->artist();
00065 
00066         if(id3v2 && !id3v2->artist().isEmpty())
00067           return id3v2->artist();
00068 
00069         if(id3v1)
00070           return id3v1->artist();
00071 
00072         return String::null;
00073       }
00074 
00075       virtual String album() const {
00076         if(xiph && !xiph->album().isEmpty())
00077           return xiph->album();
00078 
00079         if(id3v2 && !id3v2->album().isEmpty())
00080           return id3v2->album();
00081 
00082         if(id3v1)
00083           return id3v1->album();
00084 
00085         return String::null;
00086       }
00087 
00088       virtual String comment() const {
00089         if(xiph && !xiph->comment().isEmpty())
00090           return xiph->comment();
00091 
00092         if(id3v2 && !id3v2->comment().isEmpty())
00093           return id3v2->comment();
00094 
00095         if(id3v1)
00096           return id3v1->comment();
00097 
00098         return String::null;
00099       }
00100 
00101       virtual String genre() const {
00102         if(xiph && !xiph->genre().isEmpty())
00103           return xiph->genre();
00104 
00105         if(id3v2 && !id3v2->genre().isEmpty())
00106           return id3v2->genre();
00107 
00108         if(id3v1)
00109           return id3v1->genre();
00110 
00111         return String::null;
00112       }
00113 
00114       virtual uint year() const {
00115         if(xiph && xiph->year() > 0)
00116           return xiph->year();
00117 
00118         if(id3v2 && id3v2->year() > 0)
00119           return id3v2->year();
00120 
00121         if(id3v1)
00122           return id3v1->year();
00123 
00124         return 0;
00125       }
00126 
00127       virtual uint track() const {
00128         if(xiph && xiph->track() > 0)
00129           return xiph->track();
00130 
00131         if(id3v2 && id3v2->track() > 0)
00132           return id3v2->track();
00133 
00134         if(id3v1)
00135           return id3v1->track();
00136 
00137         return 0;
00138       }
00139 
00140       virtual void setTitle(const String &s) {
00141         if(xiph)
00142           xiph->setTitle(s);
00143         if(id3v2)
00144           id3v2->setTitle(s);
00145         if(id3v1)
00146           id3v1->setTitle(s);
00147       }
00148 
00149       virtual void setArtist(const String &s) {
00150         if(xiph)
00151           xiph->setArtist(s);
00152         if(id3v2)
00153           id3v2->setArtist(s);
00154         if(id3v1)
00155           id3v1->setArtist(s);
00156       }
00157 
00158       virtual void setAlbum(const String &s) {
00159         if(xiph)
00160           xiph->setAlbum(s);
00161         if(id3v2)
00162           id3v2->setAlbum(s);
00163         if(id3v1)
00164           id3v1->setAlbum(s);
00165       }
00166 
00167       virtual void setComment(const String &s) {
00168         if(xiph)
00169           xiph->setComment(s);
00170         if(id3v2)
00171           id3v2->setComment(s);
00172         if(id3v1)
00173           id3v1->setComment(s);
00174       }
00175 
00176       virtual void setGenre(const String &s) {
00177         if(xiph)
00178           xiph->setGenre(s);
00179         if(id3v2)
00180           id3v2->setGenre(s);
00181         if(id3v1)
00182           id3v1->setGenre(s);
00183       }
00184 
00185       virtual void setYear(uint i) {
00186         if(xiph)
00187           xiph->setYear(i);
00188         if(id3v2)
00189           id3v2->setYear(i);
00190         if(id3v1)
00191           id3v1->setYear(i);
00192       }
00193 
00194       virtual void setTrack(uint i) {
00195         if(xiph)
00196           xiph->setTrack(i);
00197         if(id3v2)
00198           id3v2->setTrack(i);
00199         if(id3v1)
00200           id3v1->setTrack(i);
00201       }
00202 
00203     private:
00204       Ogg::XiphComment *xiph;
00205       ID3v2::Tag *id3v2;
00206       ID3v1::Tag *id3v1;
00207     };
00208   }
00209 }
00210 
00211 #endif
00212 #endif
KDE Logo
This file is part of the documentation for TagLib Version 1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Jan 22 05:44:21 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2003