X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fbind%2Fjavabind.h;h=894f52d5dddffe902625054a7b4d97ffbbf34f8f;hb=aa42d0d7b4bbf2f20b5f3329d00c4a80ad1598ec;hp=f01627a1533125e20366991ce676a8bdc214109b;hpb=132aed75d6bd4f10df1699a4ac8b328249a5b4b9;p=inkscape.git diff --git a/src/bind/javabind.h b/src/bind/javabind.h index f01627a15..894f52d5d 100644 --- a/src/bind/javabind.h +++ b/src/bind/javabind.h @@ -1,7 +1,6 @@ -#ifndef __JAVABIND_H__ -#define __JAVABIND_H__ /** - * This is a simple mechanism to bind Inkscape to Java, and thence + * @file + * @brief This is a simple mechanism to bind Inkscape to Java, and thence * to all of the nice things that can be layered upon that. * * Authors: @@ -24,6 +23,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifndef __JAVABIND_H__ +#define __JAVABIND_H__ + #include #include @@ -41,6 +43,28 @@ namespace Bind typedef Glib::ustring String; +/** + * This is the base class of all things which will be C++ object + * instances + */ +class BaseObject +{ +public: + + /** + * Simple constructor + */ + BaseObject() + {} + + /** + * Destructor + */ + virtual ~BaseObject() + {} + +}; + /** * @@ -58,7 +82,8 @@ public: BIND_INT, BIND_BOOLEAN, BIND_DOUBLE, - BIND_STRING + BIND_STRING, + BIND_OBJECT } ValueType; /** @@ -69,6 +94,42 @@ public: init(); } + /** + * + */ + Value(int ival) + { + init(); + setInt(ival); + } + + /** + * + */ + Value(bool bval) + { + init(); + setBoolean(bval); + } + + /** + * + */ + Value(double dval) + { + init(); + setDouble(dval); + } + + /** + * + */ + Value(const String &sval) + { + init(); + setString(sval); + } + /** * */ @@ -240,7 +301,8 @@ public: /** * */ - virtual bool callMain(const String &/*className*/) + virtual bool callMain(const String &/*className*/, + const std::vector &/*args*/) { return false; } @@ -256,39 +318,61 @@ public: /** * */ - virtual bool doBinding() + virtual bool scriptRun(const String &/*lang*/, const String &/*script*/) { return false; } - - virtual String stdOutGet() + + /** + * + */ + virtual bool scriptRunFile(const String &/*lang*/, const String &/*fileName*/) { - return stdOutBuf; + return false; } - virtual void stdOutClear() + /** + * + */ + virtual bool showConsole() { - stdOutBuf.clear(); + return false; } - virtual String stdErrGet() + /** + * + */ + virtual bool doBinding() { - return stdErrBuf; + return false; } - - virtual void stdErrClear() + + /** + * + */ + virtual String getException() + { + return ""; + } + + virtual String logGet() { - stdErrBuf.clear(); + return logBuf; } - virtual void stdOut(int ch) + virtual void logClear() { - stdOutBuf.push_back((char)ch); + logBuf.clear(); } - virtual void stdErr(int ch) + virtual void log(int ch) { - stdErrBuf.push_back((char)ch); + logBuf.push_back((char)ch); + if (ch == '\n' || ch == '\r') + { + g_message("%s", logBuf.c_str()); + logBuf.clear(); + } } @@ -302,6 +386,7 @@ protected: String stdOutBuf; String stdErrBuf; + String logBuf; };