libxspf  1.2.0
XspfProps.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_PROPS_H
47 #define XSPF_PROPS_H
48 
49 
50 #include "XspfData.h"
51 
52 namespace Xspf {
53 
54 
55 class XspfPropsPrivate;
56 class XspfDateTime;
57 
58 
64 class XspfProps : public XspfData {
65 
66  friend class XspfPropsPrivate; // Give access to static helpers
67 
68 private:
70  XspfPropsPrivate * const d;
71 
73 public:
77  XspfProps();
78 
84  XspfProps(XspfProps const & source);
85 
91  XspfProps & operator=(XspfProps const & source);
92 
97  ~XspfProps();
98 
108  void giveIdentifier(XML_Char const * identifier, bool copy);
109 
119  void giveLicense(XML_Char const * license, bool copy);
120 
130  void giveLocation(XML_Char const * location, bool copy);
131 
138  void giveAppendAttributionIdentifier(XML_Char const * identifier, bool copy);
139 
146  void giveAppendAttributionLocation(XML_Char const * location, bool copy);
147 
157  void giveDate(XspfDateTime const * date, bool copy);
158 
166  void lendIdentifier(XML_Char const * identifier);
167 
175  void lendLicense(XML_Char const * license);
176 
184  void lendLocation(XML_Char const * location);
185 
193  void lendAppendAttributionIdentifier(XML_Char const * identifier);
194 
202  void lendAppendAttributionLocation(XML_Char const * location);
203 
211  void lendDate(XspfDateTime const * date);
212 
218  void setVersion(int version);
219 
225  XML_Char * stealLicense();
226 
232  XML_Char * stealLocation();
233 
239  XML_Char * stealIdentifier();
240 
249  std::pair<bool, XML_Char *> * stealFirstAttribution();
250 
257 
263  XML_Char const * getLicense() const;
264 
270  XML_Char const * getLocation() const;
271 
277  XML_Char const * getIdentifier() const;
278 
287  std::pair<bool, XML_Char const *> * getAttribution(int index) const;
288 
294  int getAttributionCount() const;
295 
301  XspfDateTime const * getDate() const;
302 
308  int getVersion() const;
309 
310 private:
319  static void appendHelper(std::deque<std::pair<bool, std::pair<XML_Char const *, bool> *> *> * & container,
320  XML_Char const * value, bool ownership, bool isLocation);
321 
332  static std::pair<bool, XML_Char const *> * getHelper(
333  std::deque<std::pair<bool, std::pair<XML_Char const *, bool> *> *> * & container, int index);
334 
344  static XspfDateTime * stealHelper(XspfDateTime const * & dateTime,
345  bool own);
346 
353  static std::pair<bool, XML_Char *> * stealFirstHelper(
354  std::deque<std::pair<bool, std::pair<XML_Char const *, bool> *> *> * & container);
355 
368  static void deleteNewAndCopy(XspfDateTime const * & dest, bool & destOwnership,
369  XspfDateTime const * source, bool sourceCopy);
370 
371 };
372 
373 
374 }
375 
376 #endif // XSPF_PROPS_H
void deleteNewAndCopy(XML_Char **dest, XML_Char const *src)
XspfProps & operator=(XspfProps const &source)
void lendDate(XspfDateTime const *date)
XspfDateTime * stealDate()
XML_Char const * getIdentifier() const
XML_Char const * getLicense() const
void lendAppendAttributionIdentifier(XML_Char const *identifier)
void setVersion(int version)
std::pair< bool, XML_Char const * > * getAttribution(int index) const
XML_Char * stealLocation()
XML_Char * stealIdentifier()
XspfDateTime const * getDate() const
void giveAppendAttributionLocation(XML_Char const *location, bool copy)
int getVersion() const
void giveLocation(XML_Char const *location, bool copy)
std::pair< bool, XML_Char * > * stealFirstAttribution()
void lendIdentifier(XML_Char const *identifier)
void giveIdentifier(XML_Char const *identifier, bool copy)
void lendLocation(XML_Char const *location)
XML_Char * stealLicense()
void lendAppendAttributionLocation(XML_Char const *location)
XML_Char const * getLocation() const
void giveLicense(XML_Char const *license, bool copy)
void giveDate(XspfDateTime const *date, bool copy)
void giveAppendAttributionIdentifier(XML_Char const *identifier, bool copy)
int getAttributionCount() const
void lendLicense(XML_Char const *license)