libxspf  1.2.0
XspfData.h
Go to the documentation of this file.
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_DATA_H
00047 #define XSPF_DATA_H
00048 
00049 #include "XspfDefines.h"
00050 #include <deque>
00051 
00052 namespace Xspf {
00053 
00054 
00055 class XspfExtension;
00056 class XspfDataPrivate;
00057 
00058 
00062 class XspfData {
00063 
00064         friend class XspfDataPrivate;
00065 
00066 private:
00068         XspfDataPrivate * const d; 
00069 
00070 
00071 protected:
00075         XspfData();
00076 
00082         XspfData(XspfData const & source);
00083 
00089         XspfData & operator=(XspfData const & source);
00090 
00095         virtual ~XspfData();
00096 
00097 public:
00107         void giveImage(XML_Char const * image, bool copy);
00108 
00118         void giveInfo(XML_Char const * info, bool copy);
00119 
00129         void giveAnnotation(XML_Char const * annotation, bool copy);
00130 
00140         void giveCreator(XML_Char const * creator, bool copy);
00141 
00151         void giveTitle(XML_Char const * title, bool copy);
00152 
00161         void giveAppendLink(XML_Char const * rel, bool copyRel, XML_Char const * content, bool copyContent);
00162 
00171         void giveAppendMeta(XML_Char const * rel, bool copyRel, XML_Char const * content, bool copyContent);
00172 
00179         void giveAppendExtension(XspfExtension const * extension, bool copy);
00180 
00188         void lendImage(XML_Char const * image);
00189 
00197         void lendInfo(XML_Char const * info);
00198 
00206         void lendAnnotation(XML_Char const * annotation);
00207 
00215         void lendCreator(XML_Char const * creator);
00216 
00224         void lendTitle(XML_Char const * title);
00225 
00234         void lendAppendLink(XML_Char const * rel, XML_Char const * content);
00235 
00244         void lendAppendMeta(XML_Char const * rel, XML_Char const * content);
00245 
00253         void lendAppendExtension(XspfExtension * extension);
00254 
00260         XML_Char * stealImage();
00261 
00267         XML_Char * stealInfo();
00268 
00274         XML_Char * stealAnnotation();
00275 
00281         XML_Char * stealCreator();
00282 
00288         XML_Char * stealTitle();
00289 
00298         std::pair<XML_Char *, XML_Char *> * stealFirstLink();
00299 
00308         std::pair<XML_Char *, XML_Char *> * stealFirstMeta();
00309 
00318         XspfExtension * stealFirstExtension();
00319 
00325         XML_Char const * getImage() const;
00326 
00332         XML_Char const * getInfo() const;
00333 
00339         XML_Char const * getAnnotation() const;
00340 
00346         XML_Char const * getCreator() const;
00347 
00353         XML_Char const * getTitle() const;
00354 
00363         std::pair<XML_Char const *, XML_Char const *> * getLink(int index) const;
00364 
00373         std::pair<XML_Char const *, XML_Char const *> * getMeta(int index) const;
00374 
00383         XspfExtension const * getExtension(int index) const;
00384 
00390         int getLinkCount() const;
00391 
00397         int getMetaCount() const;
00398 
00404         int getExtensionCount() const;
00405 
00406 private:
00416         static void appendHelper(std::deque<std::pair<
00417                         std::pair<XML_Char const *, bool> *,
00418                         std::pair<XML_Char const *, bool> *> *> * & container,
00419                         XML_Char const * rel,
00420                         bool ownRel,
00421                         XML_Char const * content,
00422                         bool ownContent);
00423 
00431         static void appendHelper(std::deque<
00432                         std::pair<XspfExtension const *, bool> *> * & container,
00433                         XspfExtension const * extenstion,
00434                         bool own);
00435 
00436 protected:
00446         static XML_Char * stealHelper(XML_Char const * & property, bool own);
00447 
00448 private:
00455         static std::pair<XML_Char *, XML_Char *> * stealFirstHelper(
00456                         std::deque<std::pair<std::pair<XML_Char const *, bool> *,
00457                         std::pair<XML_Char const *, bool> *> *> * & container);
00458 
00465         static XspfExtension * stealFirstHelper(std::deque<
00466                         std::pair<XspfExtension const *, bool> *> * & container);
00467 
00478         static std::pair<XML_Char const *, XML_Char const *> * getHelper(
00479                         std::deque<std::pair<std::pair<XML_Char const *, bool> *,
00480                         std::pair<XML_Char const *, bool> *> *> * & container,
00481                         int index);
00482 
00493         static XspfExtension const * getHelper(
00494                 std::deque<std::pair<XspfExtension const *, bool> *> * & container,
00495                 int index);
00496 
00497 protected:
00499         void virtualHook(int methodId, void * parameters);
00501 
00502 public:
00503         static bool const COPY; 
00504         static bool const TRANSFER; 
00505 
00506 };
00507 
00508 
00509 }
00510 
00511 #endif // XSPF_DATA_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines