summaryrefslogtreecommitdiffstats
path: root/src/extension/script/InkscapeInterpreter.cpp
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2006-01-16 02:36:01 +0000
committermental <mental@users.sourceforge.net>2006-01-16 02:36:01 +0000
commit179fa413b047bede6e32109e2ce82437c5fb8d34 (patch)
treea5a6ac2c1708bd02288fbd8edb2ff500ff2e0916 /src/extension/script/InkscapeInterpreter.cpp
downloadinkscape-179fa413b047bede6e32109e2ce82437c5fb8d34.tar.gz
inkscape-179fa413b047bede6e32109e2ce82437c5fb8d34.zip
moving trunk for module inkscape
(bzr r1)
Diffstat (limited to 'src/extension/script/InkscapeInterpreter.cpp')
-rw-r--r--src/extension/script/InkscapeInterpreter.cpp93
1 files changed, 93 insertions, 0 deletions
diff --git a/src/extension/script/InkscapeInterpreter.cpp b/src/extension/script/InkscapeInterpreter.cpp
new file mode 100644
index 000000000..4342922b1
--- /dev/null
+++ b/src/extension/script/InkscapeInterpreter.cpp
@@ -0,0 +1,93 @@
+/**
+ * Python Interpreter wrapper for Inkscape
+ *
+ * Authors:
+ * Bob Jamison <rjamison@titan.com>
+ *
+ * Copyright (C) 2004 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "InkscapeInterpreter.h"
+
+#include <fstream>
+
+namespace Inkscape {
+namespace Extension {
+namespace Script {
+
+/*
+ *
+ */
+InkscapeInterpreter::InkscapeInterpreter()
+{
+}
+
+
+
+/*
+ *
+ */
+InkscapeInterpreter::~InkscapeInterpreter()
+{
+
+}
+
+
+
+
+/*
+ * Interpret an in-memory string
+ */
+bool InkscapeInterpreter::interpretScript(Glib::ustring &script,
+ Glib::ustring &output,
+ Glib::ustring &error)
+{
+ //do nothing. let the subclasses implement this
+ return true;
+}
+
+
+
+
+/*
+ * Interpret a named file
+ */
+bool InkscapeInterpreter::interpretUri(Glib::ustring &uri,
+ Glib::ustring &output,
+ Glib::ustring &error)
+{
+ char *curi = (char *)uri.raw().c_str();
+ std::ifstream ins(curi);
+ if (!ins.good())
+ {
+ printf("interpretUri: Could not open %s for reading\n", curi);
+ return false;
+ }
+
+ Glib::ustring buf;
+
+ while (!ins.eof())
+ {
+ gunichar ch = (gunichar) ins.get();
+ buf.push_back(ch);
+ }
+
+ ins.close();
+
+ bool ret = interpretScript(buf, output, error);
+
+ return ret;
+
+}
+
+
+
+} // namespace Script
+} // namespace Extension
+} // namespace Inkscape
+
+//#########################################################################
+//# E N D O F F I L E
+//#########################################################################