1 #ifndef __JAVABIND_PRIVATE_H__
2 #define __JAVABIND_PRIVATE_H__
3 /**
4 * This is a simple mechanism to bind Inkscape to Java, and thence
5 * to all of the nice things that can be layered upon that.
6 *
7 * Authors:
8 * Bob Jamison
9 *
10 * Copyright (C) 2007-2008 Bob Jamison
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 */
27 #include <jni.h>
29 #include "javabind.h"
33 namespace Inkscape
34 {
36 namespace Bind
37 {
40 class JavaBinderyImpl : public JavaBindery
41 {
42 public:
44 JavaBinderyImpl();
46 virtual ~JavaBinderyImpl();
48 virtual bool loadJVM();
50 virtual bool callStatic(int type,
51 const String &className,
52 const String &methodName,
53 const String &signature,
54 const std::vector<Value> ¶ms,
55 Value &retval);
57 virtual bool callMain(const String &className);
59 virtual bool isLoaded();
61 virtual bool registerNatives(const String &className,
62 const JNINativeMethod *methods);
64 virtual bool doBinding();
66 static JavaBinderyImpl *getInstance();
69 private:
71 JavaVM *jvm;
72 JNIEnv *env;
74 };
77 //########################################################################
78 //# MESSAGES
79 //########################################################################
81 void err(const char *fmt, ...);
83 void msg(const char *fmt, ...);
85 //########################################################################
86 //# UTILITY
87 //########################################################################
89 jint getInt(JNIEnv *env, jobject obj, const char *name);
91 void setInt(JNIEnv *env, jobject obj, const char *name, jint val);
93 jlong getLong(JNIEnv *env, jobject obj, const char *name);
95 void setLong(JNIEnv *env, jobject obj, const char *name, jlong val);
97 jfloat getFloat(JNIEnv *env, jobject obj, const char *name);
99 void setFloat(JNIEnv *env, jobject obj, const char *name, jfloat val);
101 jdouble getDouble(JNIEnv *env, jobject obj, const char *name);
103 void setDouble(JNIEnv *env, jobject obj, const char *name, jdouble val);
105 String getString(JNIEnv *env, jobject obj, const char *name);
107 void setString(JNIEnv *env, jobject obj, const char *name, const String &val);
111 } // namespace Bind
112 } // namespace Inkscape
114 #endif /* __JAVABIND_PRIVATE_H__ */
115 //########################################################################
116 //# E N D O F F I L E
117 //########################################################################