Code

Got initial JS execution working
[inkscape.git] / src / bind / javabind-private.h
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();
45     
46     virtual ~JavaBinderyImpl();
47     
48     virtual bool loadJVM();
49     
50     virtual bool callStatic(int type,
51                             const String &className,
52                             const String &methodName,
53                             const String &signature,
54                             const std::vector<Value> &params,
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);
63  
64     virtual bool doBinding();
66     virtual bool setupScriptRunner();
68     static JavaBinderyImpl *getInstance();
71 private:
73     JavaVM *jvm;
74     JNIEnv  *env;
76 };
79 //########################################################################
80 //# MESSAGES
81 //########################################################################
83 void err(const char *fmt, ...);
85 void msg(const char *fmt, ...);
87 //########################################################################
88 //# UTILITY
89 //########################################################################
91 jint getInt(JNIEnv *env, jobject obj, const char *name);
93 void setInt(JNIEnv *env, jobject obj, const char *name, jint val);
95 jlong getLong(JNIEnv *env, jobject obj, const char *name);
97 void setLong(JNIEnv *env, jobject obj, const char *name, jlong val);
99 jfloat getFloat(JNIEnv *env, jobject obj, const char *name);
101 void setFloat(JNIEnv *env, jobject obj, const char *name, jfloat val);
103 jdouble getDouble(JNIEnv *env, jobject obj, const char *name);
105 void setDouble(JNIEnv *env, jobject obj, const char *name, jdouble val);
107 String getString(JNIEnv *env, jobject obj, const char *name);
109 void setString(JNIEnv *env, jobject obj, const char *name, const String &val);
113 } // namespace Bind
114 } // namespace Inkscape
116 #endif /* __JAVABIND_PRIVATE_H__ */
117 //########################################################################
118 //# E N D    O F    F I L E
119 //########################################################################