2 Copyright (C) 2000-2003 SKYRIX Software AG
4 This file is part of OGo
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
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.
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
23 #ifndef __NGJavaScriptObjectMappingContext_H__
24 #define __NGJavaScriptObjectMappingContext_H__
26 #include <NGScripting/NGObjectMappingContext.h>
27 #import <Foundation/NSMapTable.h>
29 @class NGJavaScriptContext, NGJavaScriptObjectHandler;
32 A context which maps JavaScript objects to ObjC objects.
34 Note: do *not* create a context manually, use NGScriptLanguage
35 -createMappingContext !
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
43 @interface NGJavaScriptObjectMappingContext : NGObjectMappingContext
45 NSMapTable *objcToJS; // ObjC proxies
46 NSMapTable *jsToObjC; // pure JS objects (others stored in private)
47 NGJavaScriptContext *jsContext;
50 - (NGJavaScriptContext *)jsContext;
54 - (void)setGlobalObject:(id)_object;
59 - (void)registerObject:(id)_object forImportedHandle:(void *)_handle;
60 - (void)forgetImportedHandle:(void *)_handle;
64 - (NGJavaScriptObjectHandler *)handlerForObject:(id)_object;
68 - (id)objectForJSValue:(void *)_value;
69 - (BOOL)jsValue:(void *)_value forObject:(id)_obj;
73 @interface NGJavaScriptObjectMappingContext(CombinedObjects)
75 - (void)makeObjectCombined:(id)_object;
76 - (BOOL)isCombinedObject:(id)_object;
80 @interface JSCombinedObjectBehaviour : NSObject
81 - (id)evaluateScript:(NSString *)_js language:(NSString *)_language;
84 @interface NSObject(JSCombinedObjects)
85 + (BOOL)isJSCombinedObjectClass;
86 - (BOOL)isJSCombinedObject;
87 - (NGJavaScriptObjectMappingContext *)jsObjectMappingContext;
90 @interface NGJavaScriptObjectMappingContext(Debugging)
91 - (void)_logExportedJavaScriptObjects;
92 - (void)_logExportedObjCObjects;
93 - (void)_logCombinedObjects;
96 #endif /* __NGJavaScriptObjectMappingContext_H__ */