]> err.no Git - sope/blob - Recycler/NGJavaScript/NGJavaScriptObjectMappingContext.h
fixed a warning in resource manager
[sope] / Recycler / NGJavaScript / NGJavaScriptObjectMappingContext.h
1 /*
2   Copyright (C) 2000-2003 SKYRIX Software AG
3
4   This file is part of OGo
5
6   OGo is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 // $Id$
22
23 #ifndef __NGJavaScriptObjectMappingContext_H__
24 #define __NGJavaScriptObjectMappingContext_H__
25
26 #include <NGScripting/NGObjectMappingContext.h>
27 #import <Foundation/NSMapTable.h>
28
29 @class NGJavaScriptContext, NGJavaScriptObjectHandler;
30
31 /*
32   A context which maps JavaScript objects to ObjC objects.
33   
34   Note: do *not* create a context manually, use NGScriptLanguage
35   -createMappingContext !
36   
37   Note: NSCoding is done by NGObjectMappingContext and either unarchives
38   into the active context if one is available or creates a new context
39   if no context is available yet (in other words, NSCoding is context
40   sensitive)
41 */
42
43 @interface NGJavaScriptObjectMappingContext : NGObjectMappingContext
44 {
45   NSMapTable          *objcToJS; // ObjC proxies
46   NSMapTable          *jsToObjC; // pure JS objects (others stored in private)
47   NGJavaScriptContext *jsContext;
48 }
49
50 - (NGJavaScriptContext *)jsContext;
51
52 /* hierachy */
53
54 - (void)setGlobalObject:(id)_object;
55 - (id)globalObject;
56
57 /* mappings */
58
59 - (void)registerObject:(id)_object forImportedHandle:(void *)_handle;
60 - (void)forgetImportedHandle:(void *)_handle;
61
62 /* handler */
63
64 - (NGJavaScriptObjectHandler *)handlerForObject:(id)_object;
65
66 /* values */
67
68 - (id)objectForJSValue:(void *)_value;
69 - (BOOL)jsValue:(void *)_value forObject:(id)_obj;
70
71 @end
72
73 @interface NGJavaScriptObjectMappingContext(CombinedObjects)
74
75 - (void)makeObjectCombined:(id)_object;
76 - (BOOL)isCombinedObject:(id)_object;
77
78 @end
79
80 @interface JSCombinedObjectBehaviour : NSObject
81 - (id)evaluateScript:(NSString *)_js language:(NSString *)_language;
82 @end
83
84 @interface NSObject(JSCombinedObjects)
85 + (BOOL)isJSCombinedObjectClass;
86 - (BOOL)isJSCombinedObject;
87 - (NGJavaScriptObjectMappingContext *)jsObjectMappingContext;
88 @end
89
90 @interface NGJavaScriptObjectMappingContext(Debugging)
91 - (void)_logExportedJavaScriptObjects;
92 - (void)_logExportedObjCObjects;
93 - (void)_logCombinedObjects;
94 @end
95
96 #endif /* __NGJavaScriptObjectMappingContext_H__ */