summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 252718e)
raw | patch | inline | side by side (parent: 252718e)
author | ishmal <ishmal@users.sourceforge.net> | |
Sun, 4 May 2008 16:09:41 +0000 (16:09 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Sun, 4 May 2008 16:09:41 +0000 (16:09 +0000) |
src/io/xsltstream.cpp | patch | blob | history | |
src/io/xsltstream.h | patch | blob | history |
diff --git a/src/io/xsltstream.cpp b/src/io/xsltstream.cpp
index 71619a51eab27be9460f681241606959c3c1edee..6f35d9cb62b344688753c1788c9afc855215c6b9 100644 (file)
--- a/src/io/xsltstream.cpp
+++ b/src/io/xsltstream.cpp
* XSL Transforming input and output classes
*
* Authors:
- * Bob Jamison <rjamison@titan.com>
+ * Bob Jamison <ishmalius@gmail.com>
*
- * Copyright (C) 2004 Inkscape.org
+ * Copyright (C) 2004-2008 Inkscape.org
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
//#########################################################################
//# X S L T S T Y L E S H E E T
//#########################################################################
+
/**
*
- */
-XsltStyleSheet::XsltStyleSheet(InputStream &xsltSource) throw (StreamException)
+ */
+XsltStyleSheet::XsltStyleSheet(InputStream &xsltSource)
+ throw (StreamException)
+ : stylesheet(NULL)
+{
+ if (!read(xsltSource)) {
+ throw StreamException("read failed");
+ }
+}
+
+/**
+ *
+ */
+XsltStyleSheet::XsltStyleSheet()
+ : stylesheet(NULL)
+{
+}
+
+
+
+/**
+ *
+ */
+bool XsltStyleSheet::read(InputStream &xsltSource)
{
StringOutputStream outs;
pipeStream(xsltSource, outs);
std::string strBuf = outs.getString().raw();
xmlDocPtr doc = xmlParseMemory(strBuf.c_str(), strBuf.size());
stylesheet = xsltParseStylesheetDoc(doc);
+ //following not necessary. handled by xsltFreeStylesheet(stylesheet);
//xmlFreeDoc(doc);
+ if (!stylesheet)
+ return false;
+ return true;
}
+
/**
*
*/
XsltStyleSheet::~XsltStyleSheet()
{
- xsltFreeStylesheet(stylesheet);
+ if (stylesheet)
+ xsltFreeStylesheet(stylesheet);
}
diff --git a/src/io/xsltstream.h b/src/io/xsltstream.h
index 13d9550faf54c162ba70a22047f6787f735f33d0..32d9d12f86c6ed005d8963587c7527912d72e5e6 100644 (file)
--- a/src/io/xsltstream.h
+++ b/src/io/xsltstream.h
*
*
* Authors:
- * Bob Jamison <rjamison@titan.com>
+ * Bob Jamison <ishmalius@gmail.com>
*
- * Copyright (C) 2004 Inkscape.org
+ * Copyright (C) 2004-2008 Inkscape.org
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
public:
+ /**
+ * Constructor with loading
+ */
XsltStyleSheet(InputStream &source) throw (StreamException);
-
+
+ /**
+ * Simple constructor, no loading
+ */
+ XsltStyleSheet();
+
+ /**
+ * Loader
+ */
+ bool read(InputStream &source);
+
+ /**
+ * Destructor
+ */
virtual ~XsltStyleSheet();
xsltStylesheetPtr stylesheet;