fix logic
[personal-kdelibs.git] / kjs / function_object.h
blobebcb9378deab0f1ae8b5aba09018c1dcb9c9b1cd
1 // -*- c-basic-offset: 2 -*-
2 /*
3 * This file is part of the KDE libraries
4 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
5 * Copyright (C) 2006 Apple Computer, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #ifndef FUNCTION_OBJECT_H_
24 #define FUNCTION_OBJECT_H_
26 #include "object_object.h"
27 #include "function.h"
29 namespace KJS {
31 /**
32 * @internal
34 * Class to implement all methods that are properties of the
35 * Function.prototype object
37 class FunctionProtoFunc : public InternalFunctionImp {
38 public:
39 FunctionProtoFunc(ExecState*, FunctionPrototype*, int i, int len, const Identifier&);
41 virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
43 enum { ToString, Apply, Call };
44 private:
45 int id;
48 /**
49 * @internal
51 * The initial value of the global variable's "Function" property
53 class FunctionObjectImp : public InternalFunctionImp {
54 public:
55 FunctionObjectImp(ExecState*, FunctionPrototype*);
56 virtual ~FunctionObjectImp();
58 virtual bool implementsConstruct() const;
59 virtual JSObject* construct(ExecState*, const List& args);
60 virtual JSObject* construct(ExecState*, const List& args, const Identifier& functionName, const UString& sourceURL, int lineNumber);
61 virtual JSValue* callAsFunction(ExecState*, JSObject* thisObj, const List& args);
64 } // namespace
66 #endif // _FUNCTION_OBJECT_H_