blob: f8fa80b278452bed79b2a21658c3b3a748288815 [file] [log] [blame]
gwt.team.knortoncf244552008-03-20 09:40:25 +00001/*
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
23namespace gwt {
24
25/*
gwt.team.knortonb3682d72008-03-29 03:19:56 +000026 * Initializes static members needed by DispatchObject, DispatchMethod,
27 * and LowLevelSaf. This should be called before before calling anything
28 * else.
gwt.team.knortoncf244552008-03-20 09:40:25 +000029 */
gwt.team.knortonb3682d72008-03-29 03:19:56 +000030bool Initialize(JNIEnv*, jclass, jclass, jclass);
gwt.team.knortoncf244552008-03-20 09:40:25 +000031
32/*
33 * Returns a shared reference to the DispatchObject class
34 */
35JSClassRef 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 */
44JSObjectRef DispatchObjectCreate(JSContextRef jContext, jobject jObject);
45
46/*
47 * Returns a shared reference to the DispatchMethod class
48 */
49JSClassRef 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 */
59JSObjectRef DispatchMethodCreate(JSContextRef jsContext, std::string& name,
60 jobject jObject);
61
62
63} // namespace gwt
64
65#endif // JAVA_DISPATCHER_H__