summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBob Jamison <ishmalius@gmail.com>2008-05-04 16:09:41 +0000
committerishmal <ishmal@users.sourceforge.net>2008-05-04 16:09:41 +0000
commit724525e5ffdf20b34596bee58113011e98dff6f6 (patch)
tree6c8faf1845dab1208ba747b03a716aefd3e7427d /src
parent* configure.ac: Have the "linker tolerates -z relro" configure test do (diff)
downloadinkscape-724525e5ffdf20b34596bee58113011e98dff6f6.tar.gz
inkscape-724525e5ffdf20b34596bee58113011e98dff6f6.zip
Remove warnings
(bzr r5599)
Diffstat (limited to 'src')
-rw-r--r--src/io/xsltstream.cpp39
-rw-r--r--src/io/xsltstream.h22
2 files changed, 53 insertions, 8 deletions
diff --git a/src/io/xsltstream.cpp b/src/io/xsltstream.cpp
index 71619a51e..6f35d9cb6 100644
--- a/src/io/xsltstream.cpp
+++ b/src/io/xsltstream.cpp
@@ -2,9 +2,9 @@
* 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
*/
@@ -25,25 +25,54 @@ namespace IO
//#########################################################################
//# 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 13d9550fa..32d9d12f8 100644
--- a/src/io/xsltstream.h
+++ b/src/io/xsltstream.h
@@ -5,9 +5,9 @@
*
*
* 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
*/
@@ -35,8 +35,24 @@ class XsltStyleSheet
public:
+ /**
+ * Constructor with loading
+ */
XsltStyleSheet(InputStream &source) throw (StreamException);
-
+
+ /**
+ * Simple constructor, no loading
+ */
+ XsltStyleSheet();
+
+ /**
+ * Loader
+ */
+ bool read(InputStream &source);
+
+ /**
+ * Destructor
+ */
virtual ~XsltStyleSheet();
xsltStylesheetPtr stylesheet;