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 #include "NGJavaScriptFunction.h"
24 #include "NGJavaScriptContext.h"
25 #include "NGJavaScriptObject.h"
26 #include "NGJavaScriptObjectMappingContext.h"
27 #include "NSString+JS.h"
30 @implementation NGJavaScriptFunction
34 - (NSString *)functionName {
35 return [NSString stringWithCString:JS_GetFunctionName(self->handle)];
40 - (BOOL)isJavaScriptFunction {
43 - (BOOL)isScriptFunction {
49 - (NSString *)decompileBodyWithIndent:(unsigned)_indent
50 inContext:(NGJavaScriptContext *)_ctx
54 s = JS_DecompileFunctionBody([_ctx handle], self->handle, _indent);
55 return [NSString stringWithJavaScriptString:s];
58 - (NSString *)decompileWithIndent:(unsigned)_indent
59 inContext:(NGJavaScriptContext *)_ctx
63 s = JS_DecompileFunction([_ctx handle], self->handle, _indent);
64 return [NSString stringWithJavaScriptString:s];
69 - (id)initWithCoder:(NSCoder *)_coder {
70 NSAssert(NO, @"decoding of functions not supported yet ...");
73 - (void)encodeWithCoder:(NSCoder *)_coder {
74 NSAssert(NO, @"encoding of functions not supported yet ...");
77 @end /* NGJavaScriptFunction */
79 @implementation NSObject(JSFuncTyping)
81 - (BOOL)isJavaScriptFunction {
85 @end /* NSObject(JSFuncTyping) */