[xiph-commits] SF.net SVN: libspiff:[513] trunk
hartwork at users.sourceforge.net
hartwork at users.sourceforge.net
Tue Feb 17 12:42:17 PST 2009
Revision: 513
http://libspiff.svn.sourceforge.net/libspiff/?rev=513&view=rev
Author: hartwork
Date: 2009-02-17 20:42:15 +0000 (Tue, 17 Feb 2009)
Log Message:
-----------
Rename libSpiff to libxspf - step 1: file level
Added Paths:
-----------
trunk/bindings/c/xspf_c.cpp
trunk/bindings/c/xspf_c.h
trunk/include/xspf/
trunk/include/xspf/ProjectOpus/
trunk/include/xspf/Xspf.h
trunk/include/xspf/XspfChunkCallback.h
trunk/include/xspf/XspfData.h
trunk/include/xspf/XspfDateTime.h
trunk/include/xspf/XspfDefines.h
trunk/include/xspf/XspfExtension.h
trunk/include/xspf/XspfExtensionReader.h
trunk/include/xspf/XspfExtensionReaderFactory.h
trunk/include/xspf/XspfExtensionWriter.h
trunk/include/xspf/XspfIndentFormatter.h
trunk/include/xspf/XspfProps.h
trunk/include/xspf/XspfReader.h
trunk/include/xspf/XspfReaderCallback.h
trunk/include/xspf/XspfSeamlessFormatter.h
trunk/include/xspf/XspfStack.h
trunk/include/xspf/XspfToolbox.h
trunk/include/xspf/XspfTrack.h
trunk/include/xspf/XspfVersion.h
trunk/include/xspf/XspfWriter.h
trunk/include/xspf/XspfXmlFormatter.h
trunk/include/xspf/ZirkorosOnline/
trunk/src/XspfChunkCallback.cpp
trunk/src/XspfData.cpp
trunk/src/XspfDataWriter.cpp
trunk/src/XspfDataWriter.h
trunk/src/XspfDateTime.cpp
trunk/src/XspfExtension.cpp
trunk/src/XspfExtensionReader.cpp
trunk/src/XspfExtensionReaderFactory.cpp
trunk/src/XspfExtensionWriter.cpp
trunk/src/XspfIndentFormatter.cpp
trunk/src/XspfProps.cpp
trunk/src/XspfPropsWriter.cpp
trunk/src/XspfPropsWriter.h
trunk/src/XspfReader.cpp
trunk/src/XspfReaderCallback.cpp
trunk/src/XspfSeamlessFormatter.cpp
trunk/src/XspfSkipExtensionReader.cpp
trunk/src/XspfSkipExtensionReader.h
trunk/src/XspfStrictReaderCallback.cpp
trunk/src/XspfStrictReaderCallback.h
trunk/src/XspfToolbox.cpp
trunk/src/XspfTrack.cpp
trunk/src/XspfTrackWriter.cpp
trunk/src/XspfTrackWriter.h
trunk/src/XspfWriter.cpp
trunk/src/XspfXmlFormatter.cpp
trunk/win32/Code_Blocks/libxspf.cbp
trunk/win32/Code_Blocks/libxspf.workspace
trunk/win32/Visual_Studio_2005/libxspf.sln
trunk/win32/Visual_Studio_2005/libxspf.vcproj
Removed Paths:
-------------
trunk/bindings/c/spiff_c.cpp
trunk/bindings/c/spiff_c.h
trunk/include/spiff/
trunk/src/SpiffChunkCallback.cpp
trunk/src/SpiffData.cpp
trunk/src/SpiffDataWriter.cpp
trunk/src/SpiffDataWriter.h
trunk/src/SpiffDateTime.cpp
trunk/src/SpiffExtension.cpp
trunk/src/SpiffExtensionReader.cpp
trunk/src/SpiffExtensionReaderFactory.cpp
trunk/src/SpiffExtensionWriter.cpp
trunk/src/SpiffIndentFormatter.cpp
trunk/src/SpiffProps.cpp
trunk/src/SpiffPropsWriter.cpp
trunk/src/SpiffPropsWriter.h
trunk/src/SpiffReader.cpp
trunk/src/SpiffReaderCallback.cpp
trunk/src/SpiffSeamlessFormatter.cpp
trunk/src/SpiffSkipExtensionReader.cpp
trunk/src/SpiffSkipExtensionReader.h
trunk/src/SpiffStrictReaderCallback.cpp
trunk/src/SpiffStrictReaderCallback.h
trunk/src/SpiffToolbox.cpp
trunk/src/SpiffTrack.cpp
trunk/src/SpiffTrackWriter.cpp
trunk/src/SpiffTrackWriter.h
trunk/src/SpiffWriter.cpp
trunk/src/SpiffXmlFormatter.cpp
trunk/win32/Code_Blocks/libspiff.cbp
trunk/win32/Code_Blocks/libspiff.workspace
trunk/win32/Visual_Studio_2005/libspiff.sln
trunk/win32/Visual_Studio_2005/libspiff.vcproj
Deleted: trunk/bindings/c/spiff_c.cpp
===================================================================
--- trunk/bindings/c/spiff_c.cpp 2009-02-13 13:10:07 UTC (rev 512)
+++ trunk/bindings/c/spiff_c.cpp 2009-02-17 20:42:15 UTC (rev 513)
@@ -1,341 +0,0 @@
-/*
- * spiff_c - Simple C interface for libSpiff
- *
- * Copyright (C) 2007, Ed Schouten / Xiph.Org Foundation
- * Copyright (C) 2008, Sebastian Pipping / Xiph.Org Foundation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the following
- * disclaimer.
- *
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * * Neither the name of the Xiph.Org Foundation nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Ed Schouten <ed at fxq.nl>
- * Sebastian Pipping <sping at xiph.org>
- */
-/**
- * @file spiff_c.cpp
- * @brief Simple libSpiff C bindings.
- */
-
-#include <spiff/SpiffIndentFormatter.h>
-#include <spiff/SpiffProps.h>
-#include <spiff/SpiffReader.h>
-#include <spiff/SpiffReaderCallback.h>
-#include <spiff/SpiffTrack.h>
-#include <spiff/SpiffWriter.h>
-#include <cstring>
-
-extern "C" {
-#include "spiff_c.h"
-}
-
-using namespace Spiff;
-
-/**
- * @brief Spiff list reading callback, which stores data in a specific
- * C-style Spiff list.
- */
-class SpiffCReaderCallback : public SpiffReaderCallback {
-private:
- /**
- * @brief The C-style Spiff list the tracks should be appended
- * to.
- */
- spiff_list *list;
- /**
- * @brief Pointer to the `next' field in the last inserted item
- * for improving append speed.
- */
- spiff_track **newtrack;
-
- /**
- * @brief Callback which adds tracks to the spiff_list.
- */
- void addTrack(SpiffTrack *track);
- /**
- * @brief Callback which sets properties in the spiff_list.
- */
- void setProps(SpiffProps *props);
-public:
- /**
- * @brief Create callback interface for filling a spiff_list.
- */
- SpiffCReaderCallback(spiff_list *list);
- /**
- * @brief Finalize the spiff_list.
- */
- virtual ~SpiffCReaderCallback();
-};
-
-SpiffCReaderCallback::SpiffCReaderCallback(spiff_list *list)
-{
- this->list = list;
- newtrack = &list->tracks;
-}
-
-SpiffCReaderCallback::~SpiffCReaderCallback()
-{
- /* Null-terminate the tracks list */
- *newtrack = NULL;
-}
-
-void
-SpiffCReaderCallback::addTrack(SpiffTrack *track)
-{
- spiff_mvalue **newmv;
- char *str;
-
- /* Append new item to the track list */
- *newtrack = new spiff_track;
-
- (*newtrack)->creator = track->stealCreator();
- (*newtrack)->title = track->stealTitle();
- (*newtrack)->album = track->stealAlbum();
- (*newtrack)->duration = track->getDuration();
- (*newtrack)->tracknum = track->getTrackNum();
- (*newtrack)->pdata = NULL;
-
- /* Locations */
- newmv = &(*newtrack)->locations;
- while ((str = track->stealFirstLocation()) != NULL) {
- *newmv = new spiff_mvalue;
- (*newmv)->value = str;
- (*newmv)->pdata = NULL;
-
- /* On to the next location */
- newmv = &(*newmv)->next;
- }
- *newmv = NULL;
-
- /* Identifiers */
- newmv = &(*newtrack)->identifiers;
- while ((str = track->stealFirstIdentifier()) != NULL) {
- *newmv = new spiff_mvalue;
- (*newmv)->value = str;
- (*newmv)->pdata = NULL;
-
- /* On to the next location */
- newmv = &(*newmv)->next;
- }
- *newmv = NULL;
-
- /* Clean up and move to the next track */
- delete track;
- newtrack = &(*newtrack)->next;
-}
-
-void
-SpiffCReaderCallback::setProps(SpiffProps *props)
-{
- list->license = props->stealLicense();
- list->location = props->stealLocation();
- list->identifier = props->stealIdentifier();
-
- delete props;
-}
-
-/**
- * @brief Deallocate all objects in a spiff_mvalue linked list.
- */
-static void
-spiff_mvalue_free(struct spiff_mvalue *mv)
-{
- struct spiff_mvalue *nmv;
-
- for (; mv != NULL; mv = nmv) {
- /* Back-up pointer */
- nmv = mv->next;
- delete [] mv->value;
- delete mv;
- }
-}
-
-/*
- * Public C interface
- */
-
-extern "C" struct spiff_list *
-spiff_parse(char const *filename, char const *baseuri)
-{
- SpiffReader read;
- spiff_list *ret;
-
- /* Allocate empty playlist */
- ret = new spiff_list;
-
- /* Fill the list with parser results */
- SpiffCReaderCallback readcb(ret);
- if (read.parseFile(filename, &readcb, baseuri) == SPIFF_READER_SUCCESS) {
- /* Success */
- return (ret);
- } else {
- /* Malformed/non-existent list */
- delete ret;
- return (NULL);
- }
-}
-
-extern "C" struct spiff_list *
-spiff_new(void)
-{
- spiff_list *ret;
-
- ret = new spiff_list;
- ret->license = NULL;
- ret->location = NULL;
- ret->identifier = NULL;
- ret->tracks = NULL;
- ret->pdata = NULL;
-
- return (ret);
-}
-
-extern "C" void
-spiff_free(struct spiff_list *list)
-{
- spiff_track *tr, *ntr;
-
- delete [] list->license;
- delete [] list->location;
- delete [] list->identifier;
-
- for (tr = list->tracks; tr != NULL; tr = ntr) {
- /* Back-up pointer */
- ntr = tr->next;
-
- delete [] tr->creator;
- delete [] tr->title;
- delete [] tr->album;
-
- spiff_mvalue_free(tr->locations);
- spiff_mvalue_free(tr->identifiers);
-
- delete tr;
- }
-
- delete list;
-}
-
-extern "C" void
-spiff_setvalue(char **str, char const *nstr)
-{
- /* Delete old string */
- delete [] *str;
-
- if (nstr == NULL) {
- /* Unset value */
- *str = NULL;
- } else {
- /* Copy value */
- size_t len;
- len = strlen(nstr) + 1;
- *str = new char[len];
- strcpy(*str, nstr);
- }
-}
-
-extern "C" struct spiff_mvalue *
-spiff_new_mvalue_before(struct spiff_mvalue **mvalue)
-{
- spiff_mvalue *ret;
-
- ret = new spiff_mvalue;
- ret->value = NULL;
- ret->pdata = NULL;
- ret->next = *mvalue;
- *mvalue = ret;
-
- return (ret);
-}
-
-extern "C" struct spiff_track *
-spiff_new_track_before(struct spiff_track **track)
-{
- spiff_track *ret;
-
- ret = new spiff_track;
- ret->creator = NULL;
- ret->title = NULL;
- ret->album = NULL;
- ret->duration = -1;
- ret->tracknum = -1;
- ret->locations = NULL;
- ret->identifiers = NULL;
- ret->pdata = NULL;
- ret->next = *track;
- *track = ret;
-
- return (ret);
-}
-
-int
-spiff_write(struct spiff_list *list, char const *filename, char const *baseuri)
-{
- spiff_track *strack;
- spiff_mvalue *smvalue;
- SpiffIndentFormatter formatter(-2);
- int error;
- SpiffWriter * const writer = SpiffWriter::makeWriter(formatter,
- baseuri, SpiffWriter::NO_XML_BASE, &error);
- if (writer == NULL) {
- return error;
- }
-
- /* Playlist properties */
- {
- SpiffProps props;
- props.lendLicense(list->license);
- props.lendLocation(list->location);
- props.lendIdentifier(list->identifier);
- writer->setProps(props);
- }
-
- SPIFF_LIST_FOREACH_TRACK(list, strack) {
- /* Tracks */
- SpiffTrack track;
- track.lendCreator(strack->creator);
- track.lendTitle(strack->title);
- track.lendAlbum(strack->album);
- track.setDuration(strack->duration);
- track.setTrackNum(strack->tracknum);
-
- /* Track locations and identifiers */
- SPIFF_TRACK_FOREACH_LOCATION(strack,smvalue)
- track.lendAppendLocation(smvalue->value);
- SPIFF_TRACK_FOREACH_IDENTIFIER(strack, smvalue)
- track.lendAppendIdentifier(smvalue->value);
-
- writer->addTrack(track);
- }
-
- int const res = writer->writeFile(filename);
- delete writer;
- return res;
-}
Deleted: trunk/bindings/c/spiff_c.h
===================================================================
--- trunk/bindings/c/spiff_c.h 2009-02-13 13:10:07 UTC (rev 512)
+++ trunk/bindings/c/spiff_c.h 2009-02-17 20:42:15 UTC (rev 513)
@@ -1,198 +0,0 @@
-/*
- * spiff_c - Simple C interface for libSpiff
- *
- * Copyright (C) 2007, Ed Schouten / Xiph.Org Foundation
- * Copyright (C) 2008, Sebastian Pipping / Xiph.Org Foundation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the following
- * disclaimer.
- *
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * * Neither the name of the Xiph.Org Foundation nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Ed Schouten <ed at fxq.nl>
- * Sebastian Pipping <sping at xiph.org>
- */
-/**
- * @file spiff_c.h
- * @brief Simple libSpiff C bindings.
- */
-
-#ifndef SPIFF_C_H
-#define SPIFF_C_H
-
-/**
- * @brief Linked list for values inside tracks or lists with string
- * values.
- */
-struct spiff_mvalue {
- /**
- * @brief Value of the current list entry.
- */
- char *value;
- /**
- * @brief Pointer to next object in the list.
- */
- struct spiff_mvalue *next;
-
- /**
- * @brief Private data that can be freely used.
- */
- void *pdata;
-};
-
-/**
- * @brief Single track in an XSPF list.
- */
-struct spiff_track {
- /**
- * @brief Track's creator.
- */
- char *creator;
- /**
- * @brief Track's display name.
- */
- char *title;
- /**
- * @brief Album or collection of origin.
- */
- char *album;
-
- /**
- * @brief Track duration in milliseconds.
- */
- int duration;
- /**
- * @brief Track number.
- */
- int tracknum;
-
- /**
- * @brief Track's file locations.
- */
- struct spiff_mvalue *locations;
- /**
- * @brief Unique track identifiers.
- */
- struct spiff_mvalue *identifiers;
-
- /**
- * @brief Pointer to next track.
- */
- struct spiff_track *next;
-
- /**
- * @brief Private data that can be freely used.
- */
- void *pdata;
-};
-
-/**
- * @brief Parsed XSPF file.
- */
-struct spiff_list {
- /**
- * @brief Playlist's license.
- */
- char *license;
- /**
- * @brief Playlist's file location.
- */
- char *location;
- /**
- * @brief Playlist's unique indentifier.
- */
- char *identifier;
-
- /**
- * @brief Linked list of tracks inside the playlist.
- */
- struct spiff_track *tracks;
-
- /**
- * @brief Private data that can be freely used.
- */
- void *pdata;
-};
-
-/**
- * @brief Easy interface for walking through tracks.
- */
-#define SPIFF_LIST_FOREACH_TRACK(l,t) \
- for ((t) = (l)->tracks; (t) != NULL; (t) = (t)->next)
-/**
- * @brief Easy interface for walking through locations.
- */
-#define SPIFF_TRACK_FOREACH_LOCATION(t,l) \
- for ((l) = (t)->locations; (l) != NULL; (l) = (l)->next)
-/**
- * @brief Easy interface for walking through identifiers.
- */
-#define SPIFF_TRACK_FOREACH_IDENTIFIER(t,i) \
- for ((i) = (t)->identifiers; (i) != NULL; (i) = (i)->next)
-
-/**
- * @brief Parse an XSPF file by filename.
- */
-struct spiff_list *spiff_parse(char const *filename, char const *baseuri);
-/**
- * @brief Create a new empty XSPF playlist.
- */
-struct spiff_list *spiff_new(void);
-/**
- * @brief Free the parser results.
- */
-void spiff_free(struct spiff_list *list);
-/**
- * @brief Set or overwrite a value in the spiff_list, spiff_track or
- * spiff_mvalue structures. Passing NULL will unset the string.
- */
-void spiff_setvalue(char **str, char const *nstr);
-/**
- * @brief Insert a new mvalue to the linked list before the specified
- * one. This routine can also be used to insert a new mvalue to
- * the end of the list (or an empty list) by passing the address
- * of the mvalue list or the next field in the last object.
- */
-struct spiff_mvalue *spiff_new_mvalue_before(
- struct spiff_mvalue **mvalue);
-/**
- * @brief Insert a new track to the linked list before the specified
- * one. This routine can also be used to insert a new track to
- * the end of the list (or an empty list) by passing the address
- * of the track list or the next field in the last object.
- */
-struct spiff_track *spiff_new_track_before(
- struct spiff_track **track);
-/**
- * @brief Write the Spiff playlist to a file.
- */
-int spiff_write(struct spiff_list *list, char const *filename, char const *baseuri);
-
-#endif /* !SPIFF_C_H */
Copied: trunk/bindings/c/xspf_c.cpp (from rev 512, trunk/bindings/c/spiff_c.cpp)
===================================================================
--- trunk/bindings/c/xspf_c.cpp (rev 0)
+++ trunk/bindings/c/xspf_c.cpp 2009-02-17 20:42:15 UTC (rev 513)
@@ -0,0 +1,341 @@
+/*
+ * spiff_c - Simple C interface for libSpiff
+ *
+ * Copyright (C) 2007, Ed Schouten / Xiph.Org Foundation
+ * Copyright (C) 2008, Sebastian Pipping / Xiph.Org Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * * Neither the name of the Xiph.Org Foundation nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Ed Schouten <ed at fxq.nl>
+ * Sebastian Pipping <sping at xiph.org>
+ */
+/**
+ * @file spiff_c.cpp
+ * @brief Simple libSpiff C bindings.
+ */
+
+#include <spiff/SpiffIndentFormatter.h>
+#include <spiff/SpiffProps.h>
+#include <spiff/SpiffReader.h>
+#include <spiff/SpiffReaderCallback.h>
+#include <spiff/SpiffTrack.h>
+#include <spiff/SpiffWriter.h>
+#include <cstring>
+
+extern "C" {
+#include "spiff_c.h"
+}
+
+using namespace Spiff;
+
+/**
+ * @brief Spiff list reading callback, which stores data in a specific
+ * C-style Spiff list.
+ */
+class SpiffCReaderCallback : public SpiffReaderCallback {
+private:
+ /**
+ * @brief The C-style Spiff list the tracks should be appended
+ * to.
+ */
+ spiff_list *list;
+ /**
+ * @brief Pointer to the `next' field in the last inserted item
+ * for improving append speed.
+ */
+ spiff_track **newtrack;
+
+ /**
+ * @brief Callback which adds tracks to the spiff_list.
+ */
+ void addTrack(SpiffTrack *track);
+ /**
+ * @brief Callback which sets properties in the spiff_list.
+ */
+ void setProps(SpiffProps *props);
+public:
+ /**
+ * @brief Create callback interface for filling a spiff_list.
+ */
+ SpiffCReaderCallback(spiff_list *list);
+ /**
+ * @brief Finalize the spiff_list.
+ */
+ virtual ~SpiffCReaderCallback();
+};
+
+SpiffCReaderCallback::SpiffCReaderCallback(spiff_list *list)
+{
+ this->list = list;
+ newtrack = &list->tracks;
+}
+
+SpiffCReaderCallback::~SpiffCReaderCallback()
+{
+ /* Null-terminate the tracks list */
+ *newtrack = NULL;
+}
+
+void
+SpiffCReaderCallback::addTrack(SpiffTrack *track)
+{
+ spiff_mvalue **newmv;
+ char *str;
+
+ /* Append new item to the track list */
+ *newtrack = new spiff_track;
+
+ (*newtrack)->creator = track->stealCreator();
+ (*newtrack)->title = track->stealTitle();
+ (*newtrack)->album = track->stealAlbum();
+ (*newtrack)->duration = track->getDuration();
+ (*newtrack)->tracknum = track->getTrackNum();
+ (*newtrack)->pdata = NULL;
+
+ /* Locations */
+ newmv = &(*newtrack)->locations;
+ while ((str = track->stealFirstLocation()) != NULL) {
+ *newmv = new spiff_mvalue;
+ (*newmv)->value = str;
+ (*newmv)->pdata = NULL;
+
+ /* On to the next location */
+ newmv = &(*newmv)->next;
+ }
+ *newmv = NULL;
+
+ /* Identifiers */
+ newmv = &(*newtrack)->identifiers;
+ while ((str = track->stealFirstIdentifier()) != NULL) {
+ *newmv = new spiff_mvalue;
+ (*newmv)->value = str;
+ (*newmv)->pdata = NULL;
+
+ /* On to the next location */
+ newmv = &(*newmv)->next;
+ }
+ *newmv = NULL;
+
+ /* Clean up and move to the next track */
+ delete track;
+ newtrack = &(*newtrack)->next;
+}
+
+void
+SpiffCReaderCallback::setProps(SpiffProps *props)
+{
+ list->license = props->stealLicense();
+ list->location = props->stealLocation();
+ list->identifier = props->stealIdentifier();
+
+ delete props;
+}
+
+/**
+ * @brief Deallocate all objects in a spiff_mvalue linked list.
+ */
+static void
+spiff_mvalue_free(struct spiff_mvalue *mv)
+{
+ struct spiff_mvalue *nmv;
+
+ for (; mv != NULL; mv = nmv) {
+ /* Back-up pointer */
+ nmv = mv->next;
+ delete [] mv->value;
+ delete mv;
+ }
+}
+
+/*
+ * Public C interface
+ */
+
+extern "C" struct spiff_list *
+spiff_parse(char const *filename, char const *baseuri)
+{
+ SpiffReader read;
+ spiff_list *ret;
+
+ /* Allocate empty playlist */
+ ret = new spiff_list;
+
+ /* Fill the list with parser results */
+ SpiffCReaderCallback readcb(ret);
+ if (read.parseFile(filename, &readcb, baseuri) == SPIFF_READER_SUCCESS) {
+ /* Success */
+ return (ret);
+ } else {
+ /* Malformed/non-existent list */
+ delete ret;
+ return (NULL);
+ }
+}
+
+extern "C" struct spiff_list *
+spiff_new(void)
+{
+ spiff_list *ret;
+
+ ret = new spiff_list;
+ ret->license = NULL;
+ ret->location = NULL;
+ ret->identifier = NULL;
+ ret->tracks = NULL;
+ ret->pdata = NULL;
+
+ return (ret);
+}
+
+extern "C" void
+spiff_free(struct spiff_list *list)
+{
+ spiff_track *tr, *ntr;
+
+ delete [] list->license;
+ delete [] list->location;
+ delete [] list->identifier;
+
+ for (tr = list->tracks; tr != NULL; tr = ntr) {
+ /* Back-up pointer */
+ ntr = tr->next;
+
+ delete [] tr->creator;
+ delete [] tr->title;
+ delete [] tr->album;
+
+ spiff_mvalue_free(tr->locations);
+ spiff_mvalue_free(tr->identifiers);
+
+ delete tr;
+ }
+
+ delete list;
+}
+
+extern "C" void
+spiff_setvalue(char **str, char const *nstr)
+{
+ /* Delete old string */
+ delete [] *str;
+
+ if (nstr == NULL) {
+ /* Unset value */
+ *str = NULL;
+ } else {
+ /* Copy value */
+ size_t len;
+ len = strlen(nstr) + 1;
+ *str = new char[len];
+ strcpy(*str, nstr);
+ }
+}
+
+extern "C" struct spiff_mvalue *
+spiff_new_mvalue_before(struct spiff_mvalue **mvalue)
+{
+ spiff_mvalue *ret;
+
+ ret = new spiff_mvalue;
+ ret->value = NULL;
+ ret->pdata = NULL;
+ ret->next = *mvalue;
+ *mvalue = ret;
+
+ return (ret);
+}
+
+extern "C" struct spiff_track *
+spiff_new_track_before(struct spiff_track **track)
+{
+ spiff_track *ret;
+
+ ret = new spiff_track;
+ ret->creator = NULL;
+ ret->title = NULL;
+ ret->album = NULL;
+ ret->duration = -1;
+ ret->tracknum = -1;
+ ret->locations = NULL;
+ ret->identifiers = NULL;
+ ret->pdata = NULL;
+ ret->next = *track;
+ *track = ret;
+
+ return (ret);
+}
+
+int
+spiff_write(struct spiff_list *list, char const *filename, char const *baseuri)
+{
+ spiff_track *strack;
+ spiff_mvalue *smvalue;
+ SpiffIndentFormatter formatter(-2);
+ int error;
+ SpiffWriter * const writer = SpiffWriter::makeWriter(formatter,
+ baseuri, SpiffWriter::NO_XML_BASE, &error);
+ if (writer == NULL) {
+ return error;
+ }
+
+ /* Playlist properties */
+ {
+ SpiffProps props;
+ props.lendLicense(list->license);
+ props.lendLocation(list->location);
+ props.lendIdentifier(list->identifier);
+ writer->setProps(props);
+ }
+
+ SPIFF_LIST_FOREACH_TRACK(list, strack) {
+ /* Tracks */
+ SpiffTrack track;
+ track.lendCreator(strack->creator);
+ track.lendTitle(strack->title);
+ track.lendAlbum(strack->album);
+ track.setDuration(strack->duration);
+ track.setTrackNum(strack->tracknum);
+
+ /* Track locations and identifiers */
+ SPIFF_TRACK_FOREACH_LOCATION(strack,smvalue)
+ track.lendAppendLocation(smvalue->value);
+ SPIFF_TRACK_FOREACH_IDENTIFIER(strack, smvalue)
+ track.lendAppendIdentifier(smvalue->value);
+
+ writer->addTrack(track);
+ }
+
+ int const res = writer->writeFile(filename);
+ delete writer;
+ return res;
+}
Copied: trunk/bindings/c/xspf_c.h (from rev 512, trunk/bindings/c/spiff_c.h)
===================================================================
--- trunk/bindings/c/xspf_c.h (rev 0)
+++ trunk/bindings/c/xspf_c.h 2009-02-17 20:42:15 UTC (rev 513)
@@ -0,0 +1,198 @@
+/*
+ * spiff_c - Simple C interface for libSpiff
+ *
+ * Copyright (C) 2007, Ed Schouten / Xiph.Org Foundation
+ * Copyright (C) 2008, Sebastian Pipping / Xiph.Org Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * * Neither the name of the Xiph.Org Foundation nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Ed Schouten <ed at fxq.nl>
+ * Sebastian Pipping <sping at xiph.org>
+ */
+/**
+ * @file spiff_c.h
+ * @brief Simple libSpiff C bindings.
+ */
+
+#ifndef SPIFF_C_H
+#define SPIFF_C_H
+
+/**
+ * @brief Linked list for values inside tracks or lists with string
+ * values.
+ */
+struct spiff_mvalue {
+ /**
+ * @brief Value of the current list entry.
+ */
+ char *value;
+ /**
+ * @brief Pointer to next object in the list.
+ */
+ struct spiff_mvalue *next;
+
+ /**
+ * @brief Private data that can be freely used.
+ */
+ void *pdata;
+};
+
+/**
+ * @brief Single track in an XSPF list.
+ */
+struct spiff_track {
+ /**
+ * @brief Track's creator.
+ */
+ char *creator;
+ /**
+ * @brief Track's display name.
+ */
+ char *title;
+ /**
+ * @brief Album or collection of origin.
+ */
+ char *album;
+
+ /**
+ * @brief Track duration in milliseconds.
+ */
+ int duration;
+ /**
+ * @brief Track number.
+ */
+ int tracknum;
+
+ /**
+ * @brief Track's file locations.
+ */
+ struct spiff_mvalue *locations;
+ /**
+ * @brief Unique track identifiers.
+ */
+ struct spiff_mvalue *identifiers;
+
+ /**
+ * @brief Pointer to next track.
+ */
+ struct spiff_track *next;
+
+ /**
+ * @brief Private data that can be freely used.
+ */
+ void *pdata;
+};
+
+/**
+ * @brief Parsed XSPF file.
+ */
+struct spiff_list {
+ /**
+ * @brief Playlist's license.
+ */
+ char *license;
+ /**
+ * @brief Playlist's file location.
+ */
+ char *location;
+ /**
+ * @brief Playlist's unique indentifier.
+ */
+ char *identifier;
+
+ /**
+ * @brief Linked list of tracks inside the playlist.
+ */
+ struct spiff_track *tracks;
+
+ /**
+ * @brief Private data that can be freely used.
+ */
+ void *pdata;
+};
+
+/**
+ * @brief Easy interface for walking through tracks.
+ */
+#define SPIFF_LIST_FOREACH_TRACK(l,t) \
+ for ((t) = (l)->tracks; (t) != NULL; (t) = (t)->next)
+/**
+ * @brief Easy interface for walking through locations.
+ */
+#define SPIFF_TRACK_FOREACH_LOCATION(t,l) \
+ for ((l) = (t)->locations; (l) != NULL; (l) = (l)->next)
+/**
+ * @brief Easy interface for walking through identifiers.
+ */
+#define SPIFF_TRACK_FOREACH_IDENTIFIER(t,i) \
+ for ((i) = (t)->identifiers; (i) != NULL; (i) = (i)->next)
+
+/**
+ * @brief Parse an XSPF file by filename.
+ */
+struct spiff_list *spiff_parse(char const *filename, char const *baseuri);
+/**
+ * @brief Create a new empty XSPF playlist.
+ */
+struct spiff_list *spiff_new(void);
+/**
+ * @brief Free the parser results.
+ */
+void spiff_free(struct spiff_list *list);
+/**
+ * @brief Set or overwrite a value in the spiff_list, spiff_track or
+ * spiff_mvalue structures. Passing NULL will unset the string.
+ */
+void spiff_setvalue(char **str, char const *nstr);
+/**
+ * @brief Insert a new mvalue to the linked list before the specified
+ * one. This routine can also be used to insert a new mvalue to
+ * the end of the list (or an empty list) by passing the address
+ * of the mvalue list or the next field in the last object.
+ */
+struct spiff_mvalue *spiff_new_mvalue_before(
+ struct spiff_mvalue **mvalue);
+/**
+ * @brief Insert a new track to the linked list before the specified
+ * one. This routine can also be used to insert a new track to
+ * the end of the list (or an empty list) by passing the address
+ * of the track list or the next field in the last object.
+ */
+struct spiff_track *spiff_new_track_before(
+ struct spiff_track **track);
+/**
+ * @brief Write the Spiff playlist to a file.
+ */
+int spiff_write(struct spiff_list *list, char const *filename, char const *baseuri);
+
+#endif /* !SPIFF_C_H */
Copied: trunk/include/xspf/Xspf.h (from rev 512, trunk/include/spiff/Spiff.h)
===================================================================
--- trunk/include/xspf/Xspf.h (rev 0)
+++ trunk/include/xspf/Xspf.h 2009-02-17 20:42:15 UTC (rev 513)
@@ -0,0 +1,78 @@
+/*
+ * libSpiff - XSPF playlist handling library
+ *
+ * Copyright (C) 2006-2008, Sebastian Pipping / Xiph.Org Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * * Neither the name of the Xiph.Org Foundation nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Sebastian Pipping, sping at xiph.org
+ */
+
+/**
+ * @file Spiff.h
+ * Include-everything header for lazy people with fast machines.
+ */
+
+#ifndef SPIFF_H
+#define SPIFF_H
+
+
+/**
+ * @namespace Spiff
+ * Provides reading and writing functionality
+ * for both XSPF-0 and XSPF-1.
+ */
+
+// #include "Spiff.h"
+ #include "SpiffChunkCallback.h"
+// #include "SpiffData.h"
+ #include "SpiffDateTime.h"
+// #include "SpiffDefines.h"
+ #include "SpiffExtension.h"
+// #include "SpiffExtensionReader.h"
+ #include "SpiffExtensionReaderFactory.h"
+ #include "SpiffExtensionWriter.h"
+ #include "SpiffIndentFormatter.h"
+ #include "SpiffProps.h"
+ #include "SpiffReader.h"
+ #include "SpiffReaderCallback.h"
+ #include "SpiffSeamlessFormatter.h"
+ #include "SpiffStack.h"
+// #include "SpiffToolbox.h"
+ #include "SpiffTrack.h"
+// #include "SpiffVersion.h"
+ #include "SpiffWriter.h"
+// #include "SpiffXmlFormatter.h"
+
+
+#endif // SPIFF_H
Copied: trunk/include/xspf/XspfChunkCallback.h (from rev 512, trunk/include/spiff/SpiffChunkCallback.h)
===================================================================
--- trunk/include/xspf/XspfChunkCallback.h (rev 0)
+++ trunk/include/xspf/XspfChunkCallback.h 2009-02-17 20:42:15 UTC (rev 513)
@@ -0,0 +1,136 @@
+/*
+ * libSpiff - XSPF playlist handling library
+ *
+ * Copyright (C) 2006-2008, Sebastian Pipping / Xiph.Org Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * * Neither the name of the Xiph.Org Foundation nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Sebastian Pipping, sping at xiph.org
+ */
+
+/**
+ * @file SpiffChunkCallback.h
+ * Interface of SpiffChunkCallback.
+ */
+
+#ifndef SPIFF_CHUNK_CALLBACK_H
+#define SPIFF_CHUNK_CALLBACK_H
+
+
+namespace Spiff {
+
+
+class SpiffChunkCallbackPrivate;
+
+
+/**
+ * Hands out text chunks to a SpiffReader.
+ * This enables parsing from non-linear input
+ * structures. It can also be used to parse
+ * bug XSPF files in smaller chunks to lower
+ * memory usage.
+ */
+class SpiffChunkCallback {
+
+ friend class SpiffReader;
+
+private:
+ /// @cond DOXYGEN_NON_API
+ SpiffChunkCallbackPrivate * const d; ///< D pointer
+ /// @endcond
+
+protected:
+ /**
+ * Creates a new chunk callback.
+ */
+ SpiffChunkCallback();
+
+ /**
+ * Copy constructor.
+ *
+ * @param source Source to copy from
+ */
+ SpiffChunkCallback(SpiffChunkCallback const & source);
+
+ /**
+ * Assignment operator.
+ *
+ * @param source Source to copy from
+ */
+ SpiffChunkCallback & operator=(SpiffChunkCallback const & source);
+
+ /**
+ * Destroys this chunk callback.
+ */
+ virtual ~SpiffChunkCallback();
+
+ /**
+ * Returns the minimum size in bytes of the
+ * buffer handed to fillBuffer in a subsequent
+ * call.
+ *
+ * @return Size in bytes
+ */
+ virtual int getMinimumBufferByteSize() = 0;
+
+ /**
+ * Fulls <code>buffer</code> with a new
+ * chunk of input. the chunk copies must
+ * not exceed the number of bytes returned
+ * by the last call to getMinimumBufferByteSize.
+ * NOTE: You do <b>not</b> have to zero-terminate
+ * the string written. If you do so do not count
+ * this into the return value.
+ *
+ * @param buffer Buffer to write to
+ * @return Number of bytes actually written
+ */
+ virtual int fillBuffer(void * buffer) = 0;
+
+ /**
+ * Notifies this chunk callback, that
+ * no more chunks will be needed. You can close
+ * the resource read from in here.
+ */
+ virtual void notifyStop();
+
+ /// @cond DOXYGEN_NON_API
+ void virtualHook(int methodId, void * parameters);
+ /// @endcond
+
+};
+
+
+}
+
+#endif // SPIFF_CHUNK_CALLBACK_H
Copied: trunk/include/xspf/XspfData.h (from rev 512, trunk/include/spiff/SpiffData.h)
===================================================================
--- trunk/include/xspf/XspfData.h (rev 0)
+++ trunk/include/xspf/XspfData.h 2009-02-17 20:42:15 UTC (rev 513)
@@ -0,0 +1,511 @@
+/*
+ * libSpiff - XSPF playlist handling library
+ *
+ * Copyright (C) 2006-2008, Sebastian Pipping / Xiph.Org Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * * Neither the name of the Xiph.Org Foundation nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Sebastian Pipping, sping at xiph.org
+ */
+
+/**
+ * @file SpiffData.h
+ * Interface of SpiffData.
+ */
+
+#ifndef SPIFF_DATA_H
+#define SPIFF_DATA_H
+
+#include "SpiffDefines.h"
+#include <deque>
+
+namespace Spiff {
+
+
+class SpiffExtension;
+class SpiffDataPrivate;
+
+
+/**
+ * Provides shared functionality for SpiffTrack and SpiffProps.
+ */
+class SpiffData {
+
+ friend class SpiffDataPrivate;
+
+private:
+ /// @cond DOXYGEN_NON_API
+ SpiffDataPrivate * const d; ///< D pointer
+ /// @endcond
+
+protected:
+ /**
+ * Creates a new SpiffData object.
+ */
+ SpiffData();
+
+ /**
+ * Copy constructor.
+ *
+ * @param source Source to copy from
+ */
+ SpiffData(SpiffData const & source);
+
+ /**
+ * Assignment operator.
+ *
+ * @param source Source to copy from
+ */
+ SpiffData & operator=(SpiffData const & source);
+
+ /**
+ * Destroys this SpiffData object and deletes all
+ * memory associated with it that has not been stolen before.
+ */
+ virtual ~SpiffData();
+
+public:
+ /**
+ * Overwrites the image property. If <c>copy</c> is true
+ * the string will be copied, otherwise just assigned.
+ * In both cases the associated memory will be deleted on
+ * object destruction.
+ *
+ * @param image Image string to set
+ * @param copy Copy flag
+ */
+ void giveImage(XML_Char const * image, bool copy);
+
+ /**
+ * Overwrites the info property. If <c>copy</c> is true
+ * the string will be copied, otherwise just assigned.
+ * In both cases the associated memory will be deleted on
+ * object destruction.
+ *
+ * @param info Info string to set
+ * @param copy Copy flag
+ */
+ void giveInfo(XML_Char const * info, bool copy);
+
+ /**
+ * Overwrites the annotation property. If <c>copy</c> is true
+ * the string will be copied, otherwise just assigned.
+ * In both cases the associated memory will be deleted on
+ * object destruction.
+ *
+ * @param annotation Annotation string to set
+ * @param copy Copy flag
+ */
+ void giveAnnotation(XML_Char const * annotation, bool copy);
+
+ /**
+ * Overwrites the creator property. If <c>copy</c> is true
+ * the string will be copied, otherwise just assigned.
+ * In both cases the associated memory will be deleted on
+ * object destruction.
+ *
+ * @param creator Creator string to set
+ * @param copy Copy flag
+ */
+ void giveCreator(XML_Char const * creator, bool copy);
+
+ /**
+ * Overwrites the title property. If <c>copy</c> is true
+ * the string will be copied, otherwise just assigned.
+ * In both cases the associated memory will be deleted on
+ * object destruction.
+ *
+ * @param title Title string to set
+ * @param copy Copy flag
+ */
+ void giveTitle(XML_Char const * title, bool copy);
+
+ /**
+ * Appends a link to the link list.
+ *
+ * @param rel Link rel to append
+ * @param copyRel Rel copy flag
+ * @param content Link content to append
+ * @param copyContent Content copy flag
+ */
+ void giveAppendLink(XML_Char const * rel, bool copyRel, XML_Char const * content, bool copyContent);
+
+ /**
+ * Appends a meta to the meta list.
+ *
+ * @param rel Meta rel to append
+ * @param copyRel Rel copy flag
+ * @param content Meta content to append
+ * @param copyContent Content copy flag
+ */
+ void giveAppendMeta(XML_Char const * rel, bool copyRel, XML_Char const * content, bool copyContent);
+
+ /**
+ * Appends an extension to the extension list.
+ *
+ * @param extension Extension to append
+ * @param copy Copy flag
+ */
+ void giveAppendExtension(SpiffExtension const * extension, bool copy);
+
+ /**
+ * Overwrites the image property. The string is
+ * only assigned not copied. The ownership is
+ * not transferred.
+ *
+ * @param image Image string to set
+ */
+ void lendImage(XML_Char const * image);
+
+ /**
+ * Overwrites the info property. The string is
+ * only assigned not copied. The ownership is
+ * not transferred.
+ *
+ * @param info Info string to set
+ */
+ void lendInfo(XML_Char const * info);
+
+ /**
+ * Overwrites the annotation property. The string is
+ * only assigned not copied. The ownership is
+ * not transferred.
+ *
+ * @param annotation Annotation string to set
+ */
+ void lendAnnotation(XML_Char const * annotation);
+
+ /**
+ * Overwrites the creator property. The string is
+ * only assigned not copied. The ownership is
+ * not transferred.
+ *
+ * @param creator Creator string to set
+ */
+ void lendCreator(XML_Char const * creator);
+
+ /**
+ * Overwrites the title property. The string is
+ * only assigned not copied. The ownership is
+ * not transferred.
+ *
+ * @param title Title string to set
+ */
+ void lendTitle(XML_Char const * title);
+
+ /**
+ * Appends a link pair to the link list.
+ * The associated memory is neither copied nor
+ * deleted on onject destruction.
+ *
+ * @param rel Link rel to append
+ * @param content Link content to append
+ */
+ void lendAppendLink(XML_Char const * rel, XML_Char const * content);
+
+ /**
+ * Appends a meta pair to the meta list.
+ * The associated memory is neither copied nor
+ * deleted on onject destruction.
+ *
+ * @param rel Meta rel to append
+ * @param content Meta content to append
+ */
+ void lendAppendMeta(XML_Char const * rel, XML_Char const * content);
+
+ /**
+ * Appends an extension to the extension list.
+ * The associated memory is neither copied nor
+ * deleted on onject destruction.
+ *
+ * @param extension Extension to append
+ */
+ void lendAppendExtension(SpiffExtension * extension);
+
+ /**
+ * Steals the image property.
+ *
+ * @return Image URI, can be NULL
+ */
+ XML_Char * stealImage();
+
+ /**
+ * Steals the info property.
+ *
+ * @return Info URI, can be NULL
+ */
+ XML_Char * stealInfo();
+
+ /**
+ * Steals the annotation property.
+ *
+ * @return Annotation, can be NULL
+ */
+ XML_Char * stealAnnotation();
+
+ /**
+ * Steals the creator property.
+ *
+ * @return Creator, can be NULL
+ */
+ XML_Char * stealCreator();
+
+ /**
+ * Steals the title property.
+ *
+ * @return Title, can be NULL
+ */
+ XML_Char * stealTitle();
+
+ /**
+ * Steals the first link pair from the list.
+ * If the list is empty <c>NULL</c> is returned.
+ *
+ * NOTE: Do not forget to delete the pair!
+ *
+ * @return First link pair, can be NULL
+ */
+ std::pair<XML_Char *, XML_Char *> * stealFirstLink();
+
+ /**
+ * Steals the first meta pair from the list.
+ * If the list is empty <c>NULL</c> is returned.
+ *
+ * NOTE: Do not forget to delete the pair!
+ *
+ * @return First meta pair, can be NULL
+ */
+ std::pair<XML_Char *, XML_Char *> * stealFirstMeta();
+
+ /**
+ * Steals the extension from the list.
+ * If the list is empty <c>NULL</c> is returned.
+ *
+ * NOTE: Do not forget to delete the extension!
+ *
+ * @return First extension, can be NULL
+ */
+ SpiffExtension * stealFirstExtension();
+
+ /**
+ * Returns the image property.
+ *
+ * @return Image URI, can be NULL
+ */
+ XML_Char const * getImage() const;
+
+ /**
+ * Returns the info property.
+ *
+ * @return Info URI, can be NULL
+ */
+ XML_Char const * getInfo() const;
+
+ /**
+ * Returns the annotation property.
+ *
+ * @return Annotation, can be NULL
+ */
+ XML_Char const * getAnnotation() const;
+
+ /**
+ * Returns the creator property.
+ *
+ * @return Creator, can be NULL
+ */
+ XML_Char const * getCreator() const;
+
+ /**
+ * Returns the title property.
+ *
+ * @return Title, can be NULL
+ */
+ XML_Char const * getTitle() const;
+
+ /**
+ * Gets a specific link pair from the list.
+ * If the list is empty <c>NULL</c> is returned.
+ *
+ * NOTE: The returned pair has to be deleted manually!
+ *
+ * @return Specified link pair, can be NULL
+ */
+ std::pair<XML_Char const *, XML_Char const *> * getLink(int index) const;
+
+ /**
+ * Gets a specific meta pair from the list.
+ * If the list is empty <c>NULL</c> is returned.
+ *
+ * NOTE: The returned pair has to be deleted manually!
+ *
+ * @return Specified meta pair, can be NULL
+ */
+ std::pair<XML_Char const *, XML_Char const *> * getMeta(int index) const;
+
+ /**
+ * Gets a specific extension from the list.
+ * If the list is empty <c>NULL</c> is returned.
+ *
+ * NOTE: The returned extension has to be deleted manually!
+ *
+ * @return Specified extension, can be NULL
+ */
+ SpiffExtension const * getExtension(int index) const;
+
+ /**
+ * Returns the number of link pairs.
+ *
+ * @return Number of link pairs
+ */
+ int getLinkCount() const;
+
+ /**
+ * Returns the number of meta pairs.
+ *
+ * @return Number of meta pairs
+ */
+ int getMetaCount() const;
+
+ /**
+ * Returns the number of extensions.
+ *
+ * @return Number of extensions
+ */
+ int getExtensionCount() const;
+
+private:
+ /**
+ * Appends a meta or link pair to a container.
+ *
+ * @param container Container to work with
+ * @param rel Rel to append
+ * @param ownRel Rel ownership flag
+ * @param content Content to append
+ * @param ownContent Content ownership flag
+ */
+ static void appendHelper(std::deque<std::pair<
+ std::pair<XML_Char const *, bool> *,
+ std::pair<XML_Char const *, bool> *> *> * & container,
+ XML_Char const * rel,
+ bool ownRel,
+ XML_Char const * content,
+ bool ownContent);
+
+ /**
+ * Appends an extension to a container.
+ *
+ * @param container Container to work with
+ * @param extenstion Extenstion to append
+ * @param own Ownership flag
+ */
+ static void appendHelper(std::deque<
+ std::pair<SpiffExtension const *, bool> *> * & container,
+ SpiffExtension const * extenstion,
+ bool own);
+
+protected:
+ /**
+ * Steals a property. If the property's memory is not owned
+ * a clone is returned. In any case you own the memory
+ * return and have to delete it.
+ *
+ * @param property Property to steal
+ * @param own Owner flag
+ * @return Stolen property value, can be NULL
+ */
+ static XML_Char * stealHelper(XML_Char const * & property, bool own);
+
+private:
+ /**
+ * Steals the first entry from a container.
+ *
+ * @param container Container to steal from
+ * @return First entry, can be NULL
+ */
+ static std::pair<XML_Char *, XML_Char *> * stealFirstHelper(
+ std::deque<std::pair<std::pair<XML_Char const *, bool> *,
+ std::pair<XML_Char const *, bool> *> *> * & container);
+
+ /**
+ * Steals the first entry from a container.
+ *
+ * @param container Container to steal from
+ * @return First entry, can be NULL
+ */
+ static SpiffExtension * stealFirstHelper(std::deque<
+ std::pair<SpiffExtension const *, bool> *> * & container);
+
+ /**
+ * Returns a specific entry from a container
+ * or <c>NULL</c> if the entry does not exist.
+ *
+ * NOTE: The returned pair has to be deleted manually!
+ *
+ * @param container Container to work with
+ * @param index Index of the entry to return
+ * @return Entry content, can be NULL
+ */
+ static std::pair<XML_Char const *, XML_Char const *> * getHelper(
+ std::deque<std::pair<std::pair<XML_Char const *, bool> *,
+ std::pair<XML_Char const *, bool> *> *> * & container,
+ int index);
+
+ /**
+ * Returns a specific entry from a container
+ * or <c>NULL</c> if the entry does not exist.
+ *
+ * NOTE: The returned pair has to be deleted manually!
+ *
+ * @param container Container to work with
+ * @param index Index of the entry to return
+ * @return Entry content, can be NULL
+ */
+ static SpiffExtension const * getHelper(
+ std::deque<std::pair<SpiffExtension const *, bool> *> * & container,
+ int index);
+
+protected:
+ /// @cond DOXYGEN_NON_API
+ void virtualHook(int methodId, void * parameters);
+ /// @endcond
+
+public:
+ static bool const COPY; ///< Memory is copied
+ static bool const TRANSFER; ///< Memory ownership is transfered
+
+};
+
+
+}
+
+#endif // SPIFF_DATA_H
Copied: trunk/include/xspf/XspfDateTime.h (from rev 512, trunk/include/spiff/SpiffDateTime.h)
===================================================================
--- trunk/include/xspf/XspfDateTime.h (rev 0)
+++ trunk/include/xspf/XspfDateTime.h 2009-02-17 20:42:15 UTC (rev 513)
@@ -0,0 +1,246 @@
+/*
+ * libSpiff - XSPF playlist handling library
+ *
+ * Copyright (C) 2006-2008, Sebastian Pipping / Xiph.Org Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * * Neither the name of the Xiph.Org Foundation nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Sebastian Pipping, sping at xiph.org
+ */
+
+/**
+ * @file SpiffDateTime.h
+ * Interface of SpiffDateTime.
+ */
+
+#ifndef SPIFF_DATE_TIME_H
+#define SPIFF_DATE_TIME_H
+
+#include "SpiffDefines.h"
+
+
+namespace Spiff {
+
+
+class SpiffDateTimePrivate;
+
+
+/**
+ * Represents a "dateTime" timestamp
+ * without fractional second component.
+ */
+class SpiffDateTime {
+
+private:
+ /// @cond DOXYGEN_NON_API
+ SpiffDateTimePrivate * const d; ///< D pointer
+ /// @endcond
+
+public:
+ /**
+ * Creates a new dateTime timestamp.
+ * The given parameters must be valid and are not
+ * checked for validity inside.
+ *
+ * @param year Year [-9999..+9999] but not zero
+ * @param month Month [1..12]
+ * @param day Day [1..31]
+ * @param hour Hour [0..23]
+ * @param minutes Minutes [0..59]
+ * @param seconds Seconds [0..59]
+ * @param distHours Time shift hours [-14..+14]
+ * @param distMinutes Time shift minutes [-59..+59]
+ */
+ SpiffDateTime(int year, int month, int day, int hour, int minutes,
+ int seconds, int distHours, int distMinutes);
+
+ /**
+ * Creates a new dateTime timestamp.
+ */
+ SpiffDateTime();
+
+ /**
+ * Copy constructor.
+ *
+ * @param source Source to copy from
+ */
+ SpiffDateTime(SpiffDateTime const & source);
+
+ /**
+ * Assignment operator.
+ *
+ * @param source Source to copy from
+ */
+ SpiffDateTime & operator=(SpiffDateTime const & source);
+
+ /**
+ * Destroys this dateTime timestamp.
+ */
+ ~SpiffDateTime();
+
+ /**
+ * Clones this dateTime object.
+ *
+ *`@return Cloned object
+ */
+ SpiffDateTime * clone() const;
+
+ /**
+ * Returns the year.
+ *
+ * @return Year
+ */
+ int getYear() const;
+
+ /**
+ * Returns the month.
+ *
+ * @return Month
+ */
+ int getMonth() const;
+
+ /**
+ * Returns the day.
+ *
+ * @return Day
+ */
+ int getDay() const;
+
+ /**
+ * Returns the hour.
+ *
+ * @return Hour
+ */
+ int getHour() const;
+
+ /**
+ * Returns the minutes.
+ *
+ * @return Minutes
+ */
+ int getMinutes() const;
+
+ /**
+ * Returns the seconds.
+ *
+ * @return Seconds
+ */
+ int getSeconds() const;
+
+ /**
+ * Returns the time shift hours.
+ *
+ * @return Time shift hours
+ */
+ int getDistHours() const;
+
+ /**
+ * Returns the time shift minutes.
+ *
+ * @return Time shift minutes
+ */
+ int getDistMinutes() const;
+
+ /**
+ * Sets the year.
+ *
+ * @param year Year to set
+ */
+ void setYear(int year);
+
+ /**
+ * Sets the month.
+ *
+ * @param month Month to set
+ */
+ void setMonth(int month);
+
+ /**
+ * Sets the day.
+ *
+ * @param day Day to set
+ */
+ void setDay(int day);
+
+ /**
+ * Sets the hour.
+ *
+ * @param hour Hour to set
+ */
+ void setHour(int hour);
+
+ /**
+ * Sets the minutes.
+ *
+ * @param minutes Minutes to set
+ */
+ void setMinutes(int minutes);
+
+ /**
+ * Sets the seconds.
+ *
+ * @param seconds Seconds to set
+ */
+ void setSeconds(int seconds);
+
+ /**
+ * Sets the time shift hours.
+ *
+ * @param distHours Time shift hours
+ */
+ void setDistHours(int distHours);
+
+ /**
+ * Sets the time shift minutes.
+ *
+ * @param distMinutes Time shift minutes
+ */
+ void setDistMinutes(int distMinutes);
+
+ /**
+ * Extracts a dateTime from <c>text</c>.
+ *
+ * @param text Text
+ * @param output dateTime storage destination
+ * @return Valid dateTime flag
+ * @since 1.0.0rc1
+ */
+ static bool extractDateTime(XML_Char const * text,
+ SpiffDateTime * output);
+
+};
+
+
+} // namespace Spiff
+
+#endif // SPIFF_DATE_TIME_H
Copied: trunk/include/xspf/XspfDefines.h (from rev 512, trunk/include/spiff/SpiffDefines.h)
===================================================================
--- trunk/include/xspf/XspfDefines.h (rev 0)
+++ trunk/include/xspf/XspfDefines.h 2009-02-17 20:42:15 UTC (rev 513)
@@ -0,0 +1,145 @@
+/*
+ * libSpiff - XSPF playlist handling library
+ *
+ * Copyright (C) 2006-2008, Sebastian Pipping / Xiph.Org Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * * Neither the name of the Xiph.Org Foundation nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Sebastian Pipping, sping at xiph.org
+ */
+
+/**
+ * @file SpiffDefines.h
+ */
+
+#ifndef SPIFF_DEFINES_H
+#define SPIFF_DEFINES_H
+
+
+#include "SpiffVersion.h"
+
+
+// Namespace handling
+#define SPIFF_NS_HOME _PT("http://xspf.org/ns/0/") ///< XSPF namespace URI
+#define SPIFF_NS_HOME_LEN 21 ///< XSPF namespace URI string length
+#define SPIFF_NS_SEP_CHAR _PT(' ') ///< Namespace separator as character
+#define SPIFF_NS_SEP_STRING _PT(" ") ///< Namespace separator as string
+#define XML_NS_HOME _PT("http://www.w3.org/XML/1998/namespace") ///< XML namespace URI
+#define XML_NS_HOME_LEN 36 ///< XML namespace URI string length
+
+
+// Expat 1.95.8 or later
+#include <expat.h>
+#if (!defined(XML_MAJOR_VERSION) || !defined(XML_MINOR_VERSION) \
+ || !defined(XML_MICRO_VERSION) || (XML_MAJOR_VERSION < 1) \
+ || ((XML_MAJOR_VERSION == 1) && ((XML_MINOR_VERSION < 95) \
+ || ((XML_MINOR_VERSION == 95) && (XML_MICRO_VERSION < 8)))))
+# error Expat 1.95.8 or later is required
+#endif
+
+
+/**
+ * Maximum size in bytes of a file that
+ * will be loaded into a buffer in whole
+ */
+#define SPIFF_MAX_BLOCK_SIZE 100000
+
+
+/// @cond DOXYGEN_IGNORE
+
+// Deny overriding from outside
+#undef SPIFF_OS_WINDOWS
+#undef SPIFF_OS_UNIX
+
+
+// Portability defines
+#if (defined(__WIN32__) || defined(_WIN32) || defined(WIN32))
+
+// Windows =========================
+#include <windows.h>
+#include <tchar.h>
+
+#define SPIFF_OS_WINDOWS 1
+// =================================
+
+# ifdef UNICODE
+# ifndef _UNICODE
+# error _UNICODE not defined
+# endif
+# else
+# ifdef _UNICODE
+# error UNICODE not defined
+# endif
+# endif
+#else
+
+// Unix, ANSI ======================
+#define SPIFF_OS_UNIX 1
+// =================================
+
+#endif
+
+
+// OS-specific selection macro
+#ifdef SPIFF_OS_WINDOWS
+# define SPIFF_OS_SELECT(windows, unix) windows
+#else
+# ifdef SPIFF_OS_UNIX
+# define SPIFF_OS_SELECT(windows, unix) unix
+# endif
+#endif
+
+
+#define PORT_ATOI SPIFF_OS_SELECT(_ttoi, atoi)
+#define PORT_FOPEN SPIFF_OS_SELECT(_tfopen, fopen)
+#define PORT_MAIN SPIFF_OS_SELECT(_tmain, main)
+#define PORT_PRINTF SPIFF_OS_SELECT(_tprintf, printf)
+
+#ifdef UNICODE
+# define PORT_SNPRINTF SPIFF_OS_SELECT(_snwprintf, snprintf)
+#else
+# define PORT_SNPRINTF SPIFF_OS_SELECT(_snprintf, snprintf)
+#endif
+
+#define PORT_STRCMP SPIFF_OS_SELECT(_tcscmp, strcmp)
+#define PORT_STRCPY SPIFF_OS_SELECT(_tcscpy, strcpy)
+#define PORT_STRLEN SPIFF_OS_SELECT(_tcslen, strlen)
+#define PORT_STRNCMP SPIFF_OS_SELECT(_tcsncmp, strncmp)
+#define PORT_STRNCPY SPIFF_OS_SELECT(_tcsncpy, strncpy)
+#define PORT_STRNICMP SPIFF_OS_SELECT(_tcsnicmp, strnicmp)
+#define _PT(x) SPIFF_OS_SELECT(_T(x), x)
+
+/// @endcond
+
+
+#endif // SPIFF_DEFINES_H
Copied: trunk/include/xspf/XspfExtension.h (from rev 512, trunk/include/spiff/SpiffExtension.h)
===================================================================
--- trunk/include/xspf/XspfExtension.h (rev 0)
+++ trunk/include/xspf/XspfExtension.h 2009-02-17 20:42:15 UTC (rev 513)
@@ -0,0 +1,136 @@
+/*
+ * libSpiff - XSPF playlist handling library
+ *
+ * Copyright (C) 2006-2008, Sebastian Pipping / Xiph.Org Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * * Neither the name of the Xiph.Org Foundation nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Sebastian Pipping, sping at xiph.org
+ */
+
+/**
+ * @file SpiffExtension.h
+ * Interface of SpiffExtension.
+ */
+
+#ifndef SPIFF_EXTENSION_H
+#define SPIFF_EXTENSION_H
+
+
+#include "SpiffDefines.h"
+
+namespace Spiff {
+
+
+class SpiffXmlFormatter;
+class SpiffExtensionWriter;
+class SpiffTrackWriter;
+class SpiffPropsWriter;
+class SpiffExtensionPrivate;
+
+
+/**
+ * Extends SpiffTrack and SpiffProps objects by arbitrary information.
+ */
+class SpiffExtension {
+
+private:
+ /// @cond DOXYGEN_NON_API
+ SpiffExtensionPrivate * const d; ///< D pointer
+ /// @endcond
+
+protected:
+ /**
+ * Creates a new SpiffExtension object.
+ *
+ * @param applicationUri Application URI
+ */
+ SpiffExtension(XML_Char const * applicationUri);
+
+public:
+ /**
+ * Copy constructor.
+ *
+ * @param source Source to copy from
+ */
+ SpiffExtension(SpiffExtension const & source);
+
+ /**
+ * Assignment operator.
+ *
+ * @param source Source to copy from
+ */
+ SpiffExtension & operator=(SpiffExtension const & source);
+
+ /**
+ * Destroys this SpiffExtension object and deletes all
+ * memory associated with it.
+ */
+ virtual ~SpiffExtension();
+
+ /**
+ * Clones this extension.
+ *
+ * @return A clone of this extension
+ */
+ virtual SpiffExtension * clone() const = 0;
+
+ /**
+ * Returns the application URI.
+ *
+ * @return Application URI
+ */
+ XML_Char const * getApplicationUri() const;
+
+ /**
+ * Creates a new writer that can write
+ * this extension instance
+ *
+ * @param output Output formatter to use
+ * @param baseUri Base URI to reduce URIs against
+ * @return Extension writer for this
+ */
+ virtual SpiffExtensionWriter * newWriter(SpiffXmlFormatter * output,
+ XML_Char const * baseUri) const = 0;
+
+protected:
+ /// @cond DOXYGEN_NON_API
+ void virtualHook(int methodId, void * parameters);
+ /// @endcond
+
+};
+
+
+} // namespace Spiff
+
+#endif // SPIFF_EXTENSION_H
Copied: trunk/include/xspf/XspfExtensionReader.h (from rev 512, trunk/include/spiff/SpiffExtensionReader.h)
===================================================================
--- trunk/include/xspf/XspfExtensionReader.h (rev 0)
+++ trunk/include/xspf/XspfExtensionReader.h 2009-02-17 20:42:15 UTC (rev 513)
@@ -0,0 +1,211 @@
+/*
+ * libSpiff - XSPF playlist handling library
+ *
+ * Copyright (C) 2006-2008, Sebastian Pipping / Xiph.Org Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * * Neither the name of the Xiph.Org Foundation nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Sebastian Pipping, sping at xiph.org
+ */
+
+/**
+ * @file SpiffExtensionReader.h
+ * Interface of SpiffExtensionReader.
+ */
+
+#ifndef SPIFF_EXTENSION_READER_H
+#define SPIFF_EXTENSION_READER_H
+
+
+#include "SpiffDefines.h"
+#include <string>
+
+namespace Spiff {
+
+
+template <class T> class SpiffStack;
+class SpiffReader;
+class SpiffExtension;
+class SpiffExtensionReaderPrivate;
+class SpiffExtensionReaderFactoryPrivate;
+
+
+/**
+ * Provides the base for specific extention readers to derive from.
+ */
+class SpiffExtensionReader {
+
+ friend class SpiffReader;
+ friend class SpiffReaderPrivate;
+ friend class SpiffExtensionReaderFactory;
+ friend class SpiffExtensionReaderFactoryPrivate;
+
+private:
+ /// @cond DOXYGEN_NON_API
+ SpiffExtensionReaderPrivate * const d; ///< D pointer
+ /// @endcond
+
+public:
+ /**
+ * Creates a new SpiffExtensionReader object.
+ *
+ * @param reader SpiffReader to interact with
+ */
+ SpiffExtensionReader(SpiffReader * reader);
+
+ /**
+ * Copy constructor.
+ *
+ * @param source Source to copy from
+ */
+ SpiffExtensionReader(SpiffExtensionReader const & source);
+
+ /**
+ * Assignment operator.
+ *
+ * @param source Source to copy from
+ */
+ SpiffExtensionReader & operator=(SpiffExtensionReader const & source);
+
+ /**
+ * Destroys this SpiffExtensionReader object and deletes all
+ * memory associated with it.
+ */
+ virtual ~SpiffExtensionReader();
+
+protected:
+ /**
+ * Passes error handling to the parent SpiffReader.
+ *
+ * @param code Error code
+ * @param text Error description
+ */
+ bool handleError(int code, XML_Char const * text);
+
+ /**
+ * Passes error handling to the parent SpiffReader.
+ *
+ * @param code Error code
+ * @param format Error description format string containg <c>%s</c>
+ * @param param Text parameter to insert for <c>%s</c>
+ */
+ bool handleError(int code, XML_Char const * format, XML_Char const * param);
+
+ /**
+ * Gives access to the element stack in use.
+ *
+ * @return Element stack reference
+ */
+ SpiffStack<unsigned int> & getElementStack() const;
+
+ /**
+ * Gives access to the Base URI stack in use.
+ *
+ * @return Base URI stack reference
+ */
+ SpiffStack<std::basic_string<XML_Char> > & getBaseUriStack() const;
+
+ /**
+ * Passes xml:base handling to the parent SpiffReader.
+ *
+ * @param xmlBase Value of xml:base attribute
+ * @return Continue parsing flag
+ */
+ bool handleXmlBaseAttribute(XML_Char const * xmlBase);
+
+protected:
+ /**
+ * Handles tag opening inside an extension including
+ * the extension tag itself.
+ *
+ * @param fullName Full tag name ("<namespace_uri> <localname>")
+ * @param atts Alternating list of attribute keys and values
+ * @return Continue parsing flag
+ */
+ virtual bool handleExtensionStart(XML_Char const * fullName,
+ XML_Char const ** atts) = 0;
+
+ /**
+ * Handles tag closing inside an extension including
+ * the extension tag itself.
+ *
+ * @param fullName Full tag name ("<namespace_uri> <localname>")
+ * @return Continue parsing flag
+ */
+ virtual bool handleExtensionEnd(XML_Char const * fullName) = 0;
+
+ /**
+ * Handles element content.
+ *
+ * @param s Text content
+ * @param len Characters allowed to read
+ */
+ virtual bool handleExtensionCharacters(XML_Char const * s, int len) = 0;
+
+ /**
+ * Makes a SpiffExtension of the data collected.
+ *
+ * @return New built extension
+ */
+ virtual SpiffExtension * wrap() = 0;
+
+ /**
+ * Creates new SpiffExtensionReader of the very same
+ * type as this reader.
+ *
+ * @param reader SpiffReader to interact with, must not be NULL
+ * @return A new extension reader of the same type.
+ */
+ virtual SpiffExtensionReader * createBrother(SpiffReader * reader) const = 0;
+
+private:
+ /**
+ * Creates new SpiffExtensionReader of the very same
+ * type as this reader that will work with the same
+ * SpiffReader as this instance.
+ *
+ * @return A new extension reader of the same type.
+ */
+ SpiffExtensionReader * createBrother() const;
+
+protected:
+ /// @cond DOXYGEN_NON_API
+ void virtualHook(int methodId, void * parameters);
+ /// @endcond
+
+};
+
+
+} // namespace Spiff
+
+#endif // SPIFF_EXTENSION_READER_H
Copied: trunk/include/xspf/XspfExtensionReaderFactory.h (from rev 512, trunk/include/spiff/SpiffExtensionReaderFactory.h)
===================================================================
--- trunk/include/xspf/XspfExtensionReaderFactory.h (rev 0)
+++ trunk/include/xspf/XspfExtensionReaderFactory.h 2009-02-17 20:42:15 UTC (rev 513)
@@ -0,0 +1,221 @@
+/*
+ * libSpiff - XSPF playlist handling library
+ *
+ * Copyright (C) 2006-2008, Sebastian Pipping / Xiph.Org Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * * Neither the name of the Xiph.Org Foundation nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Sebastian Pipping, sping at xiph.org
+ */
+
+/**
+ * @file SpiffExtensionReaderFactory.h
+ * Interface of SpiffExtensionReaderFactory.
+ */
+
+#ifndef SPIFF_EXTENSION_READER_FACTROY_H
+#define SPIFF_EXTENSION_READER_FACTROY_H
+
+
+#include "SpiffDefines.h"
+#include "SpiffToolbox.h"
+#include <map>
+
+namespace Spiff {
+
+
+class SpiffExtensionReader;
+class SpiffReader;
+class SpiffExtensionReaderFactoryPrivate;
+
+
+/**
+ * Manages creation of SpiffExtensionReader instances.
+ * SpiffExtensionReaders can be registered/unregistered dynamically.
+ */
+class SpiffExtensionReaderFactory {
+
+private:
+ /// @cond DOXYGEN_NON_API
+ SpiffExtensionReaderFactoryPrivate * const d; ///< D pointer
+ /// @endcond
+
+public:
+ /**
+ * Creates a new SpiffExtensionReaderFactory object.
+ */
+ SpiffExtensionReaderFactory();
+
+ /**
+ * Copy constructor.
+ *
+ * @param source Source to copy from
+ */
+ SpiffExtensionReaderFactory(const SpiffExtensionReaderFactory
+ & source);
+
+ /**
+ * Assignment operator.
+ *
+ * @param source Source to copy from
+ */
+ SpiffExtensionReaderFactory & operator=(
+ SpiffExtensionReaderFactory const & source);
+
+ /**
+ * Destroys this SpiffExtensionReaderFactory object and deletes all
+ * memory associated with it.
+ */
+ ~SpiffExtensionReaderFactory();
+
+ /**
+ * Overwrites the registered reader for the given application URI.
+ * Pass NULL for the URI to make this the catch-all reader.
+ * The reader will be cloned internally so can safely delete
+ * the instance passed for registration.
+ *
+ * @param example Representative for the extension reader cleass
+ * @param triggerUri Application URI associate, must not be NULL
+ */
+ void registerPlaylistExtensionReader(SpiffExtensionReader const * example,
+ XML_Char const * triggerUri);
+
+ /**
+ * Overwrites the registered reader for the given application URI.
+ * Pass NULL for the URI to make this the catch-all reader.
+ * The reader will be cloned internally so can safely delete
+ * the instance passed for registration.
+ *
+ * @param example Representative for the extension reader cleass
+ * @param triggerUri Application URI associate, must not be NULL
+ */
+ void registerTrackExtensionReader(SpiffExtensionReader const * example,
+ XML_Char const * triggerUri);
+
+ /**
+ * Unregisteres the given application URI.
+ * NOTE: This URI will still be handled if a catch-all
+ * handler has been set.
+ *
+ * @param triggerUri Application URI to unregister
+ */
+ void unregisterPlaylistExtensionReader(
+ XML_Char const * triggerUri);
+
+ /**
+ * Unregisteres the given application URI.
+ * NOTE: This URI will still be handled if a catch-all
+ * handler has been set.
+ *
+ * @param triggerUri Application URI to unregister
+ */
+ void unregisterTrackExtensionReader(
+ XML_Char const * triggerUri);
+
+ /**
+ * Creates a new SpiffExtensionReader whose type was
+ * registered for this application URI.
+ *
+ * @param applicationUri Application URI
+ * @param reader SpiffReader for the extension reader
+ * @return New playlist extension reader
+ */
+ SpiffExtensionReader * newPlaylistExtensionReader(
+ XML_Char const * applicationUri, SpiffReader * reader);
+
+ /**
+ * Creates a new SpiffExtensionReader whose type was
+ * registered for this application URI.
+ *
+ * @param applicationUri Application URI
+ * @param reader SpiffReader for the extension reader
+ * @return New track extension reader
+ */
+ SpiffExtensionReader * newTrackExtensionReader(
+ XML_Char const * applicationUri, SpiffReader * reader);
+
+private:
+ /**
+ * Overwrites the registered reader for the given application URI.
+ * Pass NULL for the URI to make this the catch-all reader.
+ * The reader will be cloned internally so can safely delete
+ * the instance passed for registration.
+ *
+ * @param container Container to unregister from
+ * @param catchAll Catch-all slot to modifiy
+ * @param example Reader class representative
+ * @param triggerUri Application URI to unregister
+ */
+ void registerReader(std::map<XML_Char const *,
+ SpiffExtensionReader const *,
+ Toolbox::SpiffStringCompare> & container,
+ SpiffExtensionReader const * & catchAll,
+ SpiffExtensionReader const * example,
+ XML_Char const * triggerUri);
+
+ /**
+ * Unregisteres the given application URI.
+ *
+ * @param container Container to unregister from
+ * @param catchAll Catch-all slot to modifiy
+ * @param triggerUri Application URI to unregister
+ */
+ void unregisterReader(std::map<XML_Char const *,
+ SpiffExtensionReader const *,
+ Toolbox::SpiffStringCompare> & container,
+ SpiffExtensionReader const * & catchAll,
+ XML_Char const * triggerUri);
+
+ /**
+ * Creates a new SpiffExtensionReader whose type was
+ * registered for this application URI.
+ *
+ * @param container Container to use
+ * @param catchAll Catch-all slot to use
+ * @param applicationUri Application URI
+ * @param reader SpiffReader for the extension reader
+ * @return New extension reader
+ */
+ SpiffExtensionReader * newReader(std::map<XML_Char const *,
+ SpiffExtensionReader const *,
+ Toolbox::SpiffStringCompare> & container,
+ SpiffExtensionReader const * catchAll,
+ XML_Char const * applicationUri,
+ SpiffReader * reader);
+
+};
+
+
+}
+
+#endif // SPIFF_EXTENSION_READER_FACTROY_H
Copied: trunk/include/xspf/XspfExtensionWriter.h (from rev 512, trunk/include/spiff/SpiffExtensionWriter.h)
===================================================================
--- trunk/include/xspf/XspfExtensionWriter.h (rev 0)
+++ trunk/include/xspf/XspfExtensionWriter.h 2009-02-17 20:42:15 UTC (rev 513)
@@ -0,0 +1,170 @@
+/*
+ * libSpiff - XSPF playlist handling library
+ *
+ * Copyright (C) 2006-2008, Sebastian Pipping / Xiph.Org Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * * Neither the name of the Xiph.Org Foundation nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Sebastian Pipping, sping at xiph.org
+ */
+
+/**
+ * @file SpiffExtensionWriter.h
+ * Interface of SpiffExtensionWriter.
+ */
+
+#ifndef SPIFF_EXTENSION_WRITER_H
+#define SPIFF_EXTENSION_WRITER_H
+
+
+#include "SpiffDefines.h"
+#include <string>
+
+namespace Spiff {
+
+
+class SpiffExtension;
+class SpiffXmlFormatter;
+class SpiffExtensionWriterPrivate;
+
+
+/**
+ * Writes a SpiffExtension to a SpiffXmlFormatter.
+ */
+class SpiffExtensionWriter {
+
+private:
+ /// @cond DOXYGEN_NON_API
+ SpiffExtensionWriterPrivate * const d; ///< D pointer
+ /// @endcond
+
+public:
+ /**
+ * Creates a new SpiffExtensionWriter object.
+ *
+ * @param extension Extension to write
+ * @param output Output formatter to write to
+ * @param baseUri Absolute base URI to reduce URIs against,
+ * is \c NULL if only absolute URIs are wanted
+ */
+ SpiffExtensionWriter(SpiffExtension const * extension,
+ SpiffXmlFormatter * output, XML_Char const * baseUri);
+
+ /**
+ * Copy constructor.
+ *
+ * @param source Source to copy from
+ */
+ SpiffExtensionWriter(SpiffExtensionWriter const & source);
+
+ /**
+ * Assignment operator.
+ *
+ * @param source Source to copy from
+ */
+ SpiffExtensionWriter & operator=(SpiffExtensionWriter const & source);
+
+ /**
+ * Destroys this SpiffExtensionWriter object and deletes all
+ * memory associated with it.
+ */
+ virtual ~SpiffExtensionWriter();
+
+ /**
+ * Writes the associated extension to the output formater.
+ */
+ void write();
+
+private:
+ /**
+ * Writes the opening extension tag also registering all
+ * previously unknown namespaces.
+ *
+ * @param nsRegs NULL-terminated list of namespace registrations (uri/prefix pairs)
+ */
+ void writeExtensionStart(XML_Char const * const * nsRegs);
+
+protected:
+ /**
+ * Writes the extension body.
+ */
+ virtual void writeExtensionBody() = 0;
+
+private:
+ /**
+ * Writes the closing extension tag.
+ */
+ void writeExtensionStop();
+
+protected:
+ /**
+ * Returns a list of the namespaces used inside
+ * the extension body. Moreprecisely this
+ * is an alternating NULL-terminated list
+ * of URI/prefix pairs.
+ *
+ * @return List of URI/prefix pairs
+ */
+ virtual XML_Char const * const * getNamespaceRegs();
+
+ /**
+ * Returns the extension to be written.
+ *
+ * @return Extension
+ */
+ SpiffExtension const * getExtension();
+
+ /**
+ * Gives access to the XML formatter in use.
+ *
+ * @return XML formatter reference
+ */
+ SpiffXmlFormatter * & getOutput();
+
+ /**
+ * Returns the base URI in use.
+ *
+ * @return Base URI, can be \c NULL
+ */
+ XML_Char const * getBaseUri() const;
+
+ /// @cond DOXYGEN_NON_API
+ void virtualHook(int methodId, void * parameters);
+ /// @endcond
+
+};
+
+
+} // namespace Spiff
+
+#endif // SPIFF_EXTENSION_WRITER_H
Copied: trunk/include/xspf/XspfIndentFormatter.h (from rev 512, trunk/include/spiff/SpiffIndentFormatter.h)
===================================================================
--- trunk/include/xspf/XspfIndentFormatter.h (rev 0)
+++ trunk/include/xspf/XspfIndentFormatter.h 2009-02-17 20:42:15 UTC (rev 513)
@@ -0,0 +1,109 @@
+/*
+ * libSpiff - XSPF playlist handling library
+ *
+ * Copyright (C) 2006-2008, Sebastian Pipping / Xiph.Org Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * * Neither the name of the Xiph.Org Foundation nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Sebastian Pipping, sping at xiph.org
+ */
+
+/**
+ * @file SpiffIndentFormatter.h
+ * Interface of SpiffIndentFormatter.
+ */
+
+#ifndef SPIFF_INDENT_FORMATTER_H
+#define SPIFF_INDENT_FORMATTER_H
+
+
+#include "SpiffXmlFormatter.h"
+
+namespace Spiff {
+
+
+template <class T> class SpiffStack;
+class SpiffIndentFormatterPrivate;
+
+
+/**
+ * Outputs XML with proper indentation and newlines.
+ * The finishing newline is optional.
+ */
+class SpiffIndentFormatter : public SpiffXmlFormatter {
+
+private:
+ /// @cond DOXYGEN_NON_API
+ SpiffIndentFormatterPrivate * const d; ///< D pointer
+ /// @endcond
+
+public:
+ /**
+ * Creates a new SpiffIndentFormatter object with custom indent shift.
+ *
+ * @param shift Non-positive indent shift (-2 will create two tabs less)
+ */
+ SpiffIndentFormatter(int shift = 0);
+
+ /**
+ * Copy constructor.
+ *
+ * @param source Source to copy from
+ */
+ SpiffIndentFormatter(SpiffIndentFormatter const & source);
+
+ /**
+ * Assignment operator.
+ *
+ * @param source Source to copy from
+ */
+ SpiffIndentFormatter & operator=(SpiffIndentFormatter const & source);
+
+ /**
+ * Destroys this SpiffIndentFormatter object and deletes all
+ * memory associated with it.
+ */
+ ~SpiffIndentFormatter();
+
+private:
+ void writeStart(XML_Char const * name, XML_Char const * const * atts);
+ void writeEnd(XML_Char const * name);
+ void writeBody(XML_Char const * text);
+ void writeBody(int number);
+
+};
+
+
+}
+
+#endif // SPIFF_INDENT_FORMATTER_H
Copied: trunk/include/xspf/XspfProps.h (from rev 512, trunk/include/spiff/SpiffProps.h)
===================================================================
--- trunk/include/xspf/XspfProps.h (rev 0)
+++ trunk/include/xspf/XspfProps.h 2009-02-17 20:42:15 UTC (rev 513)
@@ -0,0 +1,376 @@
+/*
+ * libSpiff - XSPF playlist handling library
+ *
+ * Copyright (C) 2006-2008, Sebastian Pipping / Xiph.Org Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * * Neither the name of the Xiph.Org Foundation nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Sebastian Pipping, sping at xiph.org
+ */
+
+/**
+ * @file SpiffProps.h
+ * Interface of SpiffProps.
+ */
+
+#ifndef SPIFF_PROPS_H
+#define SPIFF_PROPS_H
+
+
+#include "SpiffData.h"
+
+namespace Spiff {
+
+
+class SpiffPropsPrivate;
+class SpiffDateTime;
+
+
+/**
+ * Represents the properties of playlist
+ * without extensions. This includes all
+ * information except the track list.
+ */
+class SpiffProps : public SpiffData {
+
+ friend class SpiffPropsPrivate; // Give access to static helpers
+
+private:
+ /// @cond DOXYGEN_NON_API
+ SpiffPropsPrivate * const d; ///< D pointer
+ /// @endcond
+
+public:
+ /**
+ * Creates a new, blank playlist property package.
+ */
+ SpiffProps();
+
+ /**
+ * Copy constructor.
+ *
+ * @param source Source to copy from
+ */
+ SpiffProps(SpiffProps const & source);
+
+ /**
+ * Assignment operator.
+ *
+ * @param source Source to copy from
+ */
+ SpiffProps & operator=(SpiffProps const & source);
+
+ /**
+ * Destroys this SpiffProps object and deletes all
+ * memory associated with it that has not been stolen before.
+ */
+ ~SpiffProps();
+
+ /**
+ * Overwrites the identifier property. If <c>copy</c> is true
+ * the string will be copied, otherwise just assigned.
+ * In both cases the associated memory will be deleted on
+ * object destruction.
+ *
+ * @param identifier Identifier string to set
+ * @param copy Copy flag
+ */
+ void giveIdentifier(XML_Char const * identifier, bool copy);
+
+ /**
+ * Overwrites the license property. If <c>copy</c> is true
+ * the string will be copied, otherwise just assigned.
+ * In both cases the associated memory will be deleted on
+ * object destruction.
+ *
+ * @param license License string to set
+ * @param copy Copy flag
+ */
+ void giveLicense(XML_Char const * license, bool copy);
+
+ /**
+ * Overwrites the location property. If <c>copy</c> is true
+ * the string will be copied, otherwise just assigned.
+ * In both cases the associated memory will be deleted on
+ * object destruction.
+ *
+ * @param location Location string to set
+ * @param copy Copy flag
+ */
+ void giveLocation(XML_Char const * location, bool copy);
+
+ /**
+ * Appends an identifier to the attribution list.
+ *
+ * @param identifier Identifier to append
+ * @param copy Copy flag
+ */
+ void giveAppendAttributionIdentifier(XML_Char const * identifier, bool copy);
+
+ /**
+ * Appends an location to the attribution list.
+ *
+ * @param location Location to append
+ * @param copy Copy flag
+ */
+ void giveAppendAttributionLocation(XML_Char const * location, bool copy);
+
+ /**
+ * Overwrites the date property. If <c>copy</c> is true
+ * the date object will be copied, otherwise just assigned.
+ * In both cases the associated memory will be deleted on
+ * object destruction.
+ *
+ * @param date Date object to set
+ * @param copy Copy flag
+ */
+ void giveDate(SpiffDateTime const * date, bool copy);
+
+ /**
+ * Overwrites the identifier property. The string is
+ * only assigned not copied. The ownership is
+ * not transferred.
+ *
+ * @param identifier Identifier string to set
+ */
+ void lendIdentifier(XML_Char const * identifier);
+
+ /**
+ * Overwrites the license property. The string is
+ * only assigned not copied. The ownership is
+ * not transferred.
+ *
+ * @param license License string to set
+ */
+ void lendLicense(XML_Char const * license);
+
+ /**
+ * Overwrites the location property. The string is
+ * only assigned not copied. The ownership is
+ * not transferred.
+ *
+ * @param location Location string to set
+ */
+ void lendLocation(XML_Char const * location);
+
+ /**
+ * Appends an identifier to the attribution list.
+ * The associated memory is neither copied nor
+ * deleted on onject destruction.
+ *
+ * @param identifier Identifier to append
+ */
+ void lendAppendAttributionIdentifier(XML_Char const * identifier);
+
+ /**
+ * Appends an location to the attribution list.
+ * The associated memory is neither copied nor
+ * deleted on onject destruction.
+ *
+ * @param location Location to append
+ */
+ void lendAppendAttributionLocation(XML_Char const * location);
+
+ /**
+ * Overwrites the date property. The date object is
+ * only assigned not copied. The ownership is
+ * not transferred.
+ *
+ * @param date Date object to set
+ */
+ void lendDate(SpiffDateTime const * date);
+
+ /**
+ * Overwrites the XSPF version property.
+ *
+ * @param version XSPF version (0 or 1)
+ */
+ void setVersion(int version);
+
+ /**
+ * Steals the license property.
+ *
+ * @return License URI, can be NULL
+ */
+ XML_Char * stealLicense();
+
+ /**
+ * Steals the location property.
+ *
+ * @return Location URI, can be NULL
+ */
+ XML_Char * stealLocation();
+
+ /**
+ * Steals the identifier property.
+ *
+ * @return Identifier URI, can be NULL
+ */
+ XML_Char * stealIdentifier();
+
+ /**
+ * Steals the first attribution entry from the list.
+ * If the list is empty <c>NULL</c> is returned.
+ *
+ * NOTE: Do not forget to delete the pair!
+ *
+ * @return First attribution entry, can be NULL
+ */
+ std::pair<bool, XML_Char *> * stealFirstAttribution();
+
+ /**
+ * Steals the date object property.
+ *
+ * @return Date object, can be NULL
+ */
+ SpiffDateTime * stealDate();
+
+ /**
+ * Returns the license property.
+ *
+ * @return License, can be NULL
+ */
+ XML_Char const * getLicense() const;
+
+ /**
+ * Returns the location property.
+ *
+ * @return Location, can be NULL
+ */
+ XML_Char const * getLocation() const;
+
+ /**
+ * Returns the identifier property.
+ *
+ * @return Identifier, can be NULL
+ */
+ XML_Char const * getIdentifier() const;
+
+ /**
+ * Gets the specific attribution entry from the list.
+ * If the list is empty <c>NULL</c> is returned.
+ *
+ * NOTE: The returned pair has to be deleted manually!
+ *
+ * @return Specified attribution entry, can be NULL
+ */
+ std::pair<bool, XML_Char const *> * getAttribution(int index) const;
+
+ /**
+ * Returns the number of attributions.
+ *
+ * @return Number of attributions
+ */
+ int getAttributionCount() const;
+
+ /**
+ * Returns the date object property.
+ *
+ * @return Date object, can be NULL
+ */
+ SpiffDateTime const * getDate() const;
+
+ /**
+ * Returns the XSPF version property.
+ *
+ * @return XSPF version (0 or 1)
+ */
+ int getVersion() const;
+
+private:
+ /**
+ * Appends a location or identifier to a container.
+ *
+ * @param container Container to work with
+ * @param value Value
+ * @param ownership Ownership flag
+ * @param isLocation Location/identifier switch
+ */
+ static void appendHelper(std::deque<std::pair<bool, std::pair<XML_Char const *, bool> *> *> * & container,
+ XML_Char const * value, bool ownership, bool isLocation);
+
+ /**
+ * Returns a specific entry from a container
+ * or <c>NULL</c> if the entry does not exist.
+ *
+ * NOTE: The returned pair has to be deleted manually!
+ *
+ * @param container Container to work with
+ * @param index Index of the entry to return
+ * @return Entry content, can be NULL
+ */
+ static std::pair<bool, XML_Char const *> * getHelper(
+ std::deque<std::pair<bool, std::pair<XML_Char const *, bool> *> *> * & container, int index);
+
+ /**
+ * Steals a SpiffDateTime. If its memory is not owned
+ * a clone is returned. In any case you own the memory
+ * return and have to delete it.
+ *
+ * @param dateTime SpiffDateTime to steal
+ * @param own Owner flag
+ * @return Stolen SpiffDateTime value, can be NULL
+ */
+ static SpiffDateTime * stealHelper(SpiffDateTime const * & dateTime,
+ bool own);
+
+ /**
+ * Steals the first entry from a container.
+ *
+ * @param container Container to steal from
+ * @return First entry, can be NULL
+ */
+ static std::pair<bool, XML_Char *> * stealFirstHelper(
+ std::deque<std::pair<bool, std::pair<XML_Char const *, bool> *> *> * & container);
+
+ /**
+ * Replaces the date object in <c>dest</c> by a duplicate of the date object
+ * in <c>src</c> (using new() not malloc()). The old object is deleted.
+ * If <c>destOwnership</c> is false the old string is not deleted.
+ * If <c>sourceCopy</c> is false only <c>source</c>'s pointer is copied,
+ * not the whole object.
+ *
+ * @param dest Destination date object
+ * @param destOwnership Destination ownership flag
+ * @param source Source date object
+ * @param sourceCopy Source copy flag
+ */
+ static void deleteNewAndCopy(SpiffDateTime const * & dest, bool & destOwnership,
+ SpiffDateTime const * source, bool sourceCopy);
+
+};
+
+
+}
+
+#endif // SPIFF_PROPS_H
Copied: trunk/include/xspf/XspfReader.h (from rev 512, trunk/include/spiff/SpiffReader.h)
===================================================================
--- trunk/include/xspf/XspfReader.h (rev 0)
+++ trunk/include/xspf/XspfReader.h 2009-02-17 20:42:15 UTC (rev 513)
@@ -0,0 +1,698 @@
+/*
+ * libSpiff - XSPF playlist handling library
+ *
+ * Copyright (C) 2006-2008, Sebastian Pipping / Xiph.Org Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * * Neither the name of the Xiph.Org Foundation nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Sebastian Pipping, sping at xiph.org
+ */
+
+/**
+ * @file SpiffReader.h
+ * Interface of SpiffReader.
+ */
+
+#ifndef SPIFF_READER_H
+#define SPIFF_READER_H
+
+
+#include "SpiffDefines.h"
+#include <string>
+
+
+namespace Spiff {
+
+
+/// @cond DOXYGEN_IGNORE
+
+// Messages with ONE "%s" in it
+#define SPIFF_READER_TEXT_ONE_ATTRIBUTE_FORBIDDEN _PT("Attribute '%s' not allowed.")
+#define SPIFF_READER_TEXT_ONE_EXPAT_ERROR _PT("Expat error '%s'")
+#define SPIFF_READER_TEXT_ONE_ELEMENT_FORBIDDEN _PT("Element '%s' not allowed.")
+#define SPIFF_READER_TEXT_ONE_ELEMENT_FORBIDDEN_VERSION_ZERO _PT("Element '%s' not allowed in XSPF-0.")
+#define SPIFF_READER_TEXT_ONE_FILE_READING_ERROR _PT("File '%s' could not be read.")
+#define SPIFF_READER_TEXT_ONE_WRONG_ROOT_NAME _PT("Root element must be '") SPIFF_NS_HOME SPIFF_NS_SEP_STRING _PT("playlist', not '%s'.")
+#define SPIFF_READER_TEXT_ONE_WRONG_VERSION _PT("Version must be '0' or '1', not '%s'.")
+
+// Messages with ZERO "%s" in it
+#define SPIFF_READER_TEXT_ZERO_ATTRIBUTE_MISSING(name) _PT("Attribute '") name _PT("' missing.")
+#define SPIFF_READER_TEXT_ZERO_ELEMENT_MISSING(ns, name) _PT("Element '") ns SPIFF_NS_SEP_STRING name _PT("' missing.")
+#define SPIFF_READER_TEXT_ZERO_ELEMENT_MISSING_VERSION_ZERO(ns, name) _PT("Element '") ns SPIFF_NS_SEP_STRING name _PT("' missing. This is not allowed in XSPF-0.")
+#define SPIFF_READER_TEXT_ZERO_FILENAME_NULL _PT("Filename must not be NULL.")
+#define SPIFF_READER_TEXT_ZERO_TOO_MANY_ELEMENTS(ns, name) _PT("Only one '") ns SPIFF_NS_SEP_STRING name _PT("' allowed.")
+#define SPIFF_READER_TEXT_ZERO_WRONG_ATTRIBUTE_TYPE(attr, type) _PT("Attribute '") attr _PT("' is not a valid ") type _PT(".")
+#define SPIFF_READER_TEXT_ZERO_WRONG_CONTENT_TYPE(ns, elem, type) _PT("Content of '") ns SPIFF_NS_SEP_STRING elem _PT("' is not a valid ") type _PT(".")
+#define SPIFF_READER_TEXT_ZERO_TEXT_FORBIDDEN(ns, elem) _PT("Content of '") ns SPIFF_NS_SEP_STRING elem _PT("' must be whitespace or child elements, not text.")
+#define SPIFF_READER_TEXT_ZERO_KEY_WITHOUT_VERSION(name) _PT("Attribute '") name _PT("' does not carry version information.")
+#define SPIFF_READER_TEXT_ZERO_KEY_WITH_REL_URI(name) _PT("Attribute '") name _PT("' does not contain an absolute URI.")
+
+/// @endcond
+
+
+/**
+ * Specifies the result of a parse operation.
+ */
+enum SpiffReaderReturnCode {
+ SPIFF_READER_SUCCESS, ///< Everything fine
+
+ SPIFF_READER_ERROR_NO_INPUT, ///< No input given
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the commits
mailing list