libxspf
1.2.0
|
00001 /* 00002 * libxspf - XSPF playlist handling library 00003 * 00004 * Copyright (C) 2006-2008, Sebastian Pipping / Xiph.Org Foundation 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * * Redistributions of source code must retain the above 00012 * copyright notice, this list of conditions and the following 00013 * disclaimer. 00014 * 00015 * * Redistributions in binary form must reproduce the above 00016 * copyright notice, this list of conditions and the following 00017 * disclaimer in the documentation and/or other materials 00018 * provided with the distribution. 00019 * 00020 * * Neither the name of the Xiph.Org Foundation nor the names of 00021 * its contributors may be used to endorse or promote products 00022 * derived from this software without specific prior written 00023 * permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00026 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00027 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00028 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00029 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00030 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00031 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00032 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00033 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00034 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00035 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 00036 * OF THE POSSIBILITY OF SUCH DAMAGE. 00037 * 00038 * Sebastian Pipping, sping@xiph.org 00039 */ 00040 00046 #ifndef XSPF_TRACK_H 00047 #define XSPF_TRACK_H 00048 00049 00050 #include "XspfData.h" 00051 00052 namespace Xspf { 00053 00054 00055 class XspfTrackPrivate; 00056 00057 00061 class XspfTrack : public XspfData { 00062 00063 friend class XspfTrackPrivate; 00064 00065 private: 00067 XspfTrackPrivate * const d; 00068 00069 00070 public: 00074 XspfTrack(); 00075 00081 XspfTrack(XspfTrack const & source); 00082 00088 XspfTrack & operator=(XspfTrack const & source); 00089 00093 ~XspfTrack(); 00094 00104 void giveAlbum(XML_Char const * album, bool copy); 00105 00112 void giveAppendIdentifier(XML_Char const * identifier, bool copy); 00113 00120 void giveAppendLocation(XML_Char const * location, bool copy); 00121 00129 void lendAlbum(XML_Char const * album); 00130 00138 void lendAppendLocation(XML_Char const * location); 00139 00147 void lendAppendIdentifier(XML_Char const * identifier); 00148 00154 void setTrackNum(int trackNum); 00155 00162 void setDuration(int duration); 00163 00169 XML_Char * stealAlbum(); 00170 00177 XML_Char * stealFirstIdentifier(); 00178 00185 XML_Char * stealFirstLocation(); 00186 00192 XML_Char const * getAlbum() const; 00193 00200 XML_Char const * getIdentifier(int index) const; 00201 00208 XML_Char const * getLocation(int index) const; 00209 00215 int getIdentifierCount() const; 00216 00222 int getLocationCount() const; 00223 00230 int getDuration() const; 00231 00237 int getTrackNum() const; 00238 00239 private: 00247 static void appendHelper(std::deque<std::pair<XML_Char const *, bool> *> * & container, XML_Char const * value, bool ownership); 00248 00255 static XML_Char * stealFirstHelper(std::deque<std::pair<XML_Char const *, bool> *> * & container); 00256 00265 static XML_Char const * getHelper(std::deque<std::pair<XML_Char const *, bool> *> * & container, int index); 00266 00267 }; 00268 00269 00270 } 00271 00272 #endif // XSPF_TRACK_H