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_WRITER_H 00047 #define XSPF_WRITER_H 00048 00049 #include "XspfDefines.h" 00050 00051 namespace Xspf { 00052 00053 00054 class XspfXmlFormatter; 00055 class XspfTrack; 00056 class XspfProps; 00057 class XspfWriterPrivate; 00058 00059 00063 enum XspfWriterReturnCode { 00064 XSPF_WRITER_SUCCESS, 00065 00066 XSPF_WRITER_ERROR_OPENING, 00067 XSPF_WRITER_ERROR_BASE_URI_USELESS 00068 }; 00069 00070 00075 class XspfWriter { 00076 00077 private: 00079 XspfWriterPrivate * const d; 00080 00081 00082 private: 00093 XspfWriter(XspfXmlFormatter & formatter, XML_Char const * baseUri, 00094 bool embedBase); 00095 00096 public: 00111 static XspfWriter * makeWriter(XspfXmlFormatter & formatter, 00112 XML_Char const * baseUri, bool embedBase = false, 00113 int * errorCode = NULL); 00114 00120 XspfWriter(XspfWriter const & source); 00121 00127 XspfWriter & operator=(XspfWriter const & source); 00128 00132 ~XspfWriter(); 00133 00146 bool registerNamespace(XML_Char const * uri, 00147 XML_Char const * prefixSuggestion); 00148 00158 bool addTrack(XspfTrack const * track); 00159 00169 bool addTrack(XspfTrack const & track); 00170 00184 bool setProps(XspfProps const * props); 00185 00199 bool setProps(XspfProps const & props); 00200 00210 int writeFile(XML_Char const * filename); 00211 00222 int writeMemory(char * & memory, int & numBytes); 00223 00234 void reset(XspfXmlFormatter & formatter, 00235 XML_Char const * baseUri, bool embedBase = false); 00236 00237 private: 00241 void onBeforeWrite(); 00242 00243 public: 00245 static bool const EMBED_AS_XML_BASE; 00246 00248 static bool const NO_XML_BASE; 00249 }; 00250 00251 00252 } 00253 00254 00255 #endif // XSPF_WRITER_H