summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6a5b303)
raw | patch | inline | side by side (parent: 6a5b303)
author | ishmal <ishmal@users.sourceforge.net> | |
Thu, 13 Mar 2008 21:02:36 +0000 (21:02 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Thu, 13 Mar 2008 21:02:36 +0000 (21:02 +0000) |
src/xml/repr-io.cpp | patch | blob | history | |
src/xml/repr.h | patch | blob | history |
diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp
index 26537d750764a17031f7ceb84480a624f19bb95d..bd9e4a2e0419633d2fbae4257c121c3c2c1c7748 100644 (file)
--- a/src/xml/repr-io.cpp
+++ b/src/xml/repr-io.cpp
#include "io/sys.h"
#include "io/uristream.h"
+#include "io/stringstream.h"
#include "io/gzipstream.h"
#include "prefs-utils.h"
return rdoc;
}
+/**
+ * Reads and parses XML from a buffer, returning it as an Document
+ */
+Document *
+sp_repr_read_buf (const Glib::ustring &buf, const gchar *default_ns)
+{
+ return sp_repr_read_mem(buf.c_str(), buf.size(), default_ns);
+}
+
+
namespace Inkscape {
struct compare_quark_ids {
}
}
+
+Glib::ustring
+sp_repr_write_buf(Node *repr, gint indent_level,
+ bool add_whitespace, Glib::QueryQuark elide_prefix,
+ int inlineattrs, int indent)
+{
+ Glib::ustring buf;
+ Inkscape::IO::StringOutputStream souts;
+ Inkscape::IO::OutputStreamWriter outs(souts);
+ sp_repr_write_stream(repr, outs, indent_level, add_whitespace,
+ elide_prefix, inlineattrs, indent);
+ outs.close();
+ buf = souts.getString();
+ return buf;
+}
+
+
void
sp_repr_write_stream_element (Node * repr, Writer & out, gint indent_level,
bool add_whitespace,
diff --git a/src/xml/repr.h b/src/xml/repr.h
index 56b37ebe26739ef600210c2b07c81ef7ac485248..69fe2adcefbd9294ff7ac69d090f5a02739b0c6d 100644 (file)
--- a/src/xml/repr.h
+++ b/src/xml/repr.h
@@ -181,6 +181,10 @@ Inkscape::XML::Document *sp_repr_read_mem(gchar const *buffer, int length, gchar
void sp_repr_write_stream (Inkscape::XML::Node *repr, Inkscape::IO::Writer &out,
gint indent_level, bool add_whitespace, Glib::QueryQuark elide_prefix,
int inlineattrs, int indent);
+Inkscape::XML::Document *sp_repr_read_buf (const Glib::ustring &buf, const gchar *default_ns);
+Glib::ustring sp_repr_write_buf(Inkscape::XML::Node *repr, gint indent_level,
+ bool add_whitespace, Glib::QueryQuark elide_prefix,
+ int inlineattrs, int indent);
void sp_repr_save_stream(Inkscape::XML::Document *doc, FILE *to_file, gchar const *default_ns=NULL, bool compress = false);
bool sp_repr_save_file(Inkscape::XML::Document *doc, gchar const *filename, gchar const *default_ns=NULL);