gwt.team.knorton | cf24455 | 2008-03-20 09:40:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2008 Google Inc. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 5 | * use this file except in compliance with the License. You may obtain a copy of |
| 6 | * the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | * License for the specific language governing permissions and limitations under |
| 14 | * the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef JAVA_DISPATCHER_H__ |
| 18 | #define JAVA_DISPATCHER_H__ |
| 19 | #include <iostream> |
| 20 | #include <JavaScriptCore/JavaScriptCore.h> |
| 21 | #include <jni.h> |
| 22 | |
| 23 | namespace gwt { |
| 24 | |
| 25 | /* |
gwt.team.knorton | b3682d7 | 2008-03-29 03:19:56 +0000 | [diff] [blame] | 26 | * Initializes static members needed by DispatchObject, DispatchMethod, |
| 27 | * and LowLevelSaf. This should be called before before calling anything |
| 28 | * else. |
gwt.team.knorton | cf24455 | 2008-03-20 09:40:25 +0000 | [diff] [blame] | 29 | */ |
gwt.team.knorton | b3682d7 | 2008-03-29 03:19:56 +0000 | [diff] [blame] | 30 | bool Initialize(JNIEnv*, jclass, jclass, jclass); |
gwt.team.knorton | cf24455 | 2008-03-20 09:40:25 +0000 | [diff] [blame] | 31 | |
| 32 | /* |
| 33 | * Returns a shared reference to the DispatchObject class |
| 34 | */ |
| 35 | JSClassRef GetDispatchObjectClass(); |
| 36 | |
| 37 | /* |
| 38 | * Constructs a new DispatchObject. |
| 39 | * |
| 40 | * jContext - the JavaScript context |
| 41 | * jObject - the java instance of DispatchObject to which |
| 42 | * this instance will dispatch calls |
| 43 | */ |
| 44 | JSObjectRef DispatchObjectCreate(JSContextRef jContext, jobject jObject); |
| 45 | |
| 46 | /* |
| 47 | * Returns a shared reference to the DispatchMethod class |
| 48 | */ |
| 49 | JSClassRef GetDispatchMethodClass(); |
| 50 | |
| 51 | /* |
| 52 | * Constructs a new DispatchMethod object. |
| 53 | * |
| 54 | * jsContext - the JavaScript context |
| 55 | * name - the name of the method (used in toString) |
| 56 | * jObject - the java instance of DispatchMethod to which this object will |
| 57 | * delegate calls. |
| 58 | */ |
| 59 | JSObjectRef DispatchMethodCreate(JSContextRef jsContext, std::string& name, |
| 60 | jobject jObject); |
| 61 | |
| 62 | |
| 63 | } // namespace gwt |
| 64 | |
| 65 | #endif // JAVA_DISPATCHER_H__ |