From 179fa413b047bede6e32109e2ce82437c5fb8d34 Mon Sep 17 00:00:00 2001 From: MenTaLguY Date: Mon, 16 Jan 2006 02:36:01 +0000 Subject: moving trunk for module inkscape (bzr r1) --- src/extension/script/InkscapeInterpreter.cpp | 93 ++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 src/extension/script/InkscapeInterpreter.cpp (limited to 'src/extension/script/InkscapeInterpreter.cpp') 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 + * + * Copyright (C) 2004 Authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "InkscapeInterpreter.h" + +#include + +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 +//######################################################################### -- cgit v1.2.3