KJS

function_object.h
1 /*
2  * This file is part of the KDE libraries
3  * Copyright (C) 1999-2000 Harri Porten ([email protected])
4  * Copyright (C) 2006 Apple Computer, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  */
21 
22 #ifndef FUNCTION_OBJECT_H_
23 #define FUNCTION_OBJECT_H_
24 
25 #include "object_object.h"
26 #include "function.h"
27 
28 namespace KJS
29 {
30 
31 /**
32  * @internal
33  *
34  * Class to implement all methods that are properties of the
35  * Function.prototype object
36  */
37 class FunctionProtoFunc : public InternalFunctionImp
38 {
39 public:
40  FunctionProtoFunc(ExecState *, FunctionPrototype *, int i, int len, const Identifier &);
41 
42  JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args) override;
43 
44  enum { ToString, Apply, Call, Bind };
45 private:
46  int id;
47 };
48 
49 /**
50  * @internal (but exported for KHTML)
51  *
52  * The initial value of the global variable's "Function" property
53  */
54 class KJS_EXPORT FunctionObjectImp : public InternalFunctionImp
55 {
56 public:
58  ~FunctionObjectImp() override;
59 
60  bool implementsConstruct() const override;
61  JSObject *construct(ExecState *, const List &args) override;
62  JSObject *construct(ExecState *, const List &args, const Identifier &functionName, const UString &sourceURL, int lineNumber) override;
63  JSValue *callAsFunction(ExecState *, JSObject *thisObj, const List &args) override;
64 };
65 
66 } // namespace
67 
68 #endif // _FUNCTION_OBJECT_H_
JSValue is the base type for all primitives (Undefined, Null, Boolean, String, Number) and objects in...
Definition: value.h:58
Represents the current state of script execution.
Definition: ExecState.h:53
Represents an Identifier for a Javascript object.
Definition: identifier.h:36
Native list type.
Definition: list.h:52
virtual QVariant callAsFunction(ScriptableExtension *callerPrincipal, quint64 objId, const ArgList &args)
Unicode string class.
Definition: ustring.h:153
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu May 26 2022 03:55:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.