Code

Use subdirectories with icon sizes.
[inkscape.git] / src / bind / javabind-private.h
1 /**
2  * @file
3  * @brief This is a simple mechanism to bind Inkscape to Java, and thence
4  * to all of the nice things that can be layered upon that. 
5  *
6  * Authors:
7  *   Bob Jamison
8  *
9  * Copyright (C) 2007-2008 Bob Jamison
10  *
11  *  This library is free software; you can redistribute it and/or
12  *  modify it under the terms of the GNU Lesser General Public
13  *  License as published by the Free Software Foundation; either
14  *  version 2.1 of the License, or (at your option) any later version.
15  *
16  *  This library is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  *  Lesser General Public License for more details.
20  *
21  *  You should have received a copy of the GNU Lesser General Public
22  *  License along with this library; if not, write to the Free Software
23  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24  */
26 #ifndef __JAVABIND_PRIVATE_H__
27 #define __JAVABIND_PRIVATE_H__
29 #include <jni.h>
30 #include "javabind.h"
32 namespace Inkscape
33 {
35 namespace Bind
36 {
39 class JavaBinderyImpl : public JavaBindery
40 {
41 public:
43     JavaBinderyImpl();
44     
45     virtual ~JavaBinderyImpl();
46     
47     virtual bool loadJVM();
48     
49     virtual bool callStatic(int type,
50                             const String &className,
51                             const String &methodName,
52                             const String &signature,
53                             const std::vector<Value> &params,
54                             Value &retval);
56     virtual bool callInstance(
57                                                         int type,
58                                 const jobject obj,
59                             const String &methodName,
60                             const String &signature,
61                             const std::vector<Value> &params,
62                             Value &retval);
64     virtual bool callMain(const String &className,
65                               const std::vector<String> &args);
67     virtual bool isLoaded();
69     /**
70      *
71      */
72     virtual bool scriptRun(const String &lang, const String &script);
74     /**
75      *
76      */
77     virtual bool scriptRunFile(const String &lang, const String &fileName);
79     virtual bool showConsole();
81     virtual bool registerNatives(const String &className,
82                                  const JNINativeMethod *methods);
83  
84     virtual bool doBinding();
86     virtual String getException();
88     virtual bool setupGateway();
90     static JavaBinderyImpl *getInstance();
93 private:
95     JavaVM *jvm;
96     JNIEnv  *env;
97     jobject gatewayObj;
98 };
101 //########################################################################
102 //# MESSAGES
103 //########################################################################
105 void err(const char *fmt, ...);
107 void msg(const char *fmt, ...);
109 //########################################################################
110 //# UTILITY
111 //########################################################################
113 String normalizePath(const String &str);
115 String getExceptionString(JNIEnv *env);
117 jint getInt(JNIEnv *env, jobject obj, const char *name);
119 void setInt(JNIEnv *env, jobject obj, const char *name, jint val);
121 jlong getLong(JNIEnv *env, jobject obj, const char *name);
123 void setLong(JNIEnv *env, jobject obj, const char *name, jlong val);
125 jfloat getFloat(JNIEnv *env, jobject obj, const char *name);
127 void setFloat(JNIEnv *env, jobject obj, const char *name, jfloat val);
129 jdouble getDouble(JNIEnv *env, jobject obj, const char *name);
131 void setDouble(JNIEnv *env, jobject obj, const char *name, jdouble val);
133 String getString(JNIEnv *env, jobject obj, const char *name);
135 void setString(JNIEnv *env, jobject obj, const char *name, const String &val);
139 } // namespace Bind
140 } // namespace Inkscape
142 #endif /* __JAVABIND_PRIVATE_H__ */
143 //########################################################################
144 //# E N D    O F    F I L E
145 //########################################################################