libxspf  1.2.0
XspfWriter.h
Go to the documentation of this file.
1 /*
2  * libxspf - XSPF playlist handling library
3  *
4  * Copyright (C) 2006-2008, Sebastian Pipping / Xiph.Org Foundation
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above
12  * copyright notice, this list of conditions and the following
13  * disclaimer.
14  *
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials
18  * provided with the distribution.
19  *
20  * * Neither the name of the Xiph.Org Foundation nor the names of
21  * its contributors may be used to endorse or promote products
22  * derived from this software without specific prior written
23  * permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
36  * OF THE POSSIBILITY OF SUCH DAMAGE.
37  *
38  * Sebastian Pipping, sping@xiph.org
39  */
40 
46 #ifndef XSPF_WRITER_H
47 #define XSPF_WRITER_H
48 
49 #include "XspfDefines.h"
50 
51 namespace Xspf {
52 
53 
54 class XspfXmlFormatter;
55 class XspfTrack;
56 class XspfProps;
57 class XspfWriterPrivate;
58 
59 
65 
68 };
69 
70 
75 class XspfWriter {
76 
77 private:
79  XspfWriterPrivate * const d;
80 
82 private:
93  XspfWriter(XspfXmlFormatter & formatter, XML_Char const * baseUri,
94  bool embedBase);
95 
96 public:
111  static XspfWriter * makeWriter(XspfXmlFormatter & formatter,
112  XML_Char const * baseUri, bool embedBase = false,
113  int * errorCode = NULL);
114 
120  XspfWriter(XspfWriter const & source);
121 
127  XspfWriter & operator=(XspfWriter const & source);
128 
132  ~XspfWriter();
133 
146  bool registerNamespace(XML_Char const * uri,
147  XML_Char const * prefixSuggestion);
148 
158  bool addTrack(XspfTrack const * track);
159 
169  bool addTrack(XspfTrack const & track);
170 
184  bool setProps(XspfProps const * props);
185 
199  bool setProps(XspfProps const & props);
200 
210  int writeFile(XML_Char const * filename);
211 
222  int writeMemory(char * & memory, int & numBytes);
223 
234  void reset(XspfXmlFormatter & formatter,
235  XML_Char const * baseUri, bool embedBase = false);
236 
237 private:
241  void onBeforeWrite();
242 
243 public:
245  static bool const EMBED_AS_XML_BASE;
246 
248  static bool const NO_XML_BASE;
249 };
250 
251 
252 }
253 
254 
255 #endif // XSPF_WRITER_H
bool addTrack(XspfTrack const *track)
XspfWriterReturnCode
Definition: XspfWriter.h:63
int writeMemory(char *&memory, int &numBytes)
File could not be opened.
Definition: XspfWriter.h:66
Everything fine.
Definition: XspfWriter.h:64
XspfWriter & operator=(XspfWriter const &source)
static XspfWriter * makeWriter(XspfXmlFormatter &formatter, XML_Char const *baseUri, bool embedBase=false, int *errorCode=NULL)
Given base URI is not a valid absolute URI.
Definition: XspfWriter.h:67
void reset(XspfXmlFormatter &formatter, XML_Char const *baseUri, bool embedBase=false)
bool setProps(XspfProps const *props)
static bool const EMBED_AS_XML_BASE
Base URI is embedded into the document.
Definition: XspfWriter.h:245
bool registerNamespace(XML_Char const *uri, XML_Char const *prefixSuggestion)
int writeFile(XML_Char const *filename)
static bool const NO_XML_BASE
Base URI is not embedded into the document.
Definition: XspfWriter.h:248