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_PROPS_H 00047 #define XSPF_PROPS_H 00048 00049 00050 #include "XspfData.h" 00051 00052 namespace Xspf { 00053 00054 00055 class XspfPropsPrivate; 00056 class XspfDateTime; 00057 00058 00064 class XspfProps : public XspfData { 00065 00066 friend class XspfPropsPrivate; // Give access to static helpers 00067 00068 private: 00070 XspfPropsPrivate * const d; 00071 00072 00073 public: 00077 XspfProps(); 00078 00084 XspfProps(XspfProps const & source); 00085 00091 XspfProps & operator=(XspfProps const & source); 00092 00097 ~XspfProps(); 00098 00108 void giveIdentifier(XML_Char const * identifier, bool copy); 00109 00119 void giveLicense(XML_Char const * license, bool copy); 00120 00130 void giveLocation(XML_Char const * location, bool copy); 00131 00138 void giveAppendAttributionIdentifier(XML_Char const * identifier, bool copy); 00139 00146 void giveAppendAttributionLocation(XML_Char const * location, bool copy); 00147 00157 void giveDate(XspfDateTime const * date, bool copy); 00158 00166 void lendIdentifier(XML_Char const * identifier); 00167 00175 void lendLicense(XML_Char const * license); 00176 00184 void lendLocation(XML_Char const * location); 00185 00193 void lendAppendAttributionIdentifier(XML_Char const * identifier); 00194 00202 void lendAppendAttributionLocation(XML_Char const * location); 00203 00211 void lendDate(XspfDateTime const * date); 00212 00218 void setVersion(int version); 00219 00225 XML_Char * stealLicense(); 00226 00232 XML_Char * stealLocation(); 00233 00239 XML_Char * stealIdentifier(); 00240 00249 std::pair<bool, XML_Char *> * stealFirstAttribution(); 00250 00256 XspfDateTime * stealDate(); 00257 00263 XML_Char const * getLicense() const; 00264 00270 XML_Char const * getLocation() const; 00271 00277 XML_Char const * getIdentifier() const; 00278 00287 std::pair<bool, XML_Char const *> * getAttribution(int index) const; 00288 00294 int getAttributionCount() const; 00295 00301 XspfDateTime const * getDate() const; 00302 00308 int getVersion() const; 00309 00310 private: 00319 static void appendHelper(std::deque<std::pair<bool, std::pair<XML_Char const *, bool> *> *> * & container, 00320 XML_Char const * value, bool ownership, bool isLocation); 00321 00332 static std::pair<bool, XML_Char const *> * getHelper( 00333 std::deque<std::pair<bool, std::pair<XML_Char const *, bool> *> *> * & container, int index); 00334 00344 static XspfDateTime * stealHelper(XspfDateTime const * & dateTime, 00345 bool own); 00346 00353 static std::pair<bool, XML_Char *> * stealFirstHelper( 00354 std::deque<std::pair<bool, std::pair<XML_Char const *, bool> *> *> * & container); 00355 00368 static void deleteNewAndCopy(XspfDateTime const * & dest, bool & destOwnership, 00369 XspfDateTime const * source, bool sourceCopy); 00370 00371 }; 00372 00373 00374 } 00375 00376 #endif // XSPF_PROPS_H