libxspf  1.2.0
XspfExtensionReader.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_EXTENSION_READER_H
00047 #define XSPF_EXTENSION_READER_H
00048 
00049 
00050 #include "XspfDefines.h"
00051 #include <string>
00052 
00053 namespace Xspf {
00054 
00055 
00056 template <class T> class XspfStack;
00057 class XspfReader;
00058 class XspfExtension;
00059 class XspfExtensionReaderPrivate;
00060 class XspfExtensionReaderFactoryPrivate;
00061 
00062 
00066 class XspfExtensionReader {
00067 
00068         friend class XspfReader;
00069         friend class XspfReaderPrivate;
00070         friend class XspfExtensionReaderFactory;
00071         friend class XspfExtensionReaderFactoryPrivate;
00072 
00073 private:
00075         XspfExtensionReaderPrivate * const d; 
00076 
00077 
00078 public:
00084         XspfExtensionReader(XspfReader * reader);
00085 
00091         XspfExtensionReader(XspfExtensionReader const & source);
00092 
00098         XspfExtensionReader & operator=(XspfExtensionReader const & source);
00099 
00104         virtual ~XspfExtensionReader();
00105 
00106 protected:
00113         bool handleError(int code, XML_Char const * text);
00114 
00122         bool handleError(int code, XML_Char const * format, XML_Char const * param);
00123 
00129         XspfStack<unsigned int> & getElementStack() const;
00130 
00136         XspfStack<std::basic_string<XML_Char> > & getBaseUriStack() const;
00137 
00144         bool handleXmlBaseAttribute(XML_Char const * xmlBase);
00145 
00146 protected:
00155         virtual bool handleExtensionStart(XML_Char const * fullName,
00156                         XML_Char const ** atts) = 0;
00157 
00165         virtual bool handleExtensionEnd(XML_Char const * fullName) = 0;
00166 
00173         virtual bool handleExtensionCharacters(XML_Char const * s, int len) = 0;
00174 
00180         virtual XspfExtension * wrap() = 0;
00181 
00189         virtual XspfExtensionReader * createBrother(XspfReader * reader) const = 0;
00190 
00191 private:
00199         XspfExtensionReader * createBrother() const;
00200 
00201 protected:
00203         void virtualHook(int methodId, void * parameters);
00205 
00206 };
00207 
00208 
00209 } // namespace Xspf
00210 
00211 #endif // XSPF_EXTENSION_READER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines