KJS

bool_object.h
1 /*
2  * This file is part of the KDE libraries
3  * Copyright (C) 1999-2000 Harri Porten ([email protected])
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  */
20 
21 #ifndef BOOL_OBJECT_H_
22 #define BOOL_OBJECT_H_
23 
24 #include "internal.h"
25 #include "function_object.h"
26 #include "JSWrapperObject.h"
27 
28 namespace KJS
29 {
30 
31 class BooleanInstance : public JSWrapperObject
32 {
33 public:
34  BooleanInstance(JSObject *proto);
35 
36  JSObject *valueClone(Interpreter *targetCtx) const override;
37 
38  const ClassInfo *classInfo() const override
39  {
40  return &info;
41  }
42  static const ClassInfo info;
43 };
44 
45 /**
46  * @internal
47  *
48  * The initial value of Boolean.prototype (and thus all objects created
49  * with the Boolean constructor
50  */
51 class BooleanPrototype : public BooleanInstance
52 {
53 public:
55  ObjectPrototype *objectProto,
56  FunctionPrototype *funcProto);
57 };
58 
59 /**
60  * @internal
61  *
62  * Class to implement all methods that are properties of the
63  * Boolean.prototype object
64  */
65 class BooleanProtoFunc : public InternalFunctionImp
66 {
67 public:
68  BooleanProtoFunc(ExecState *, FunctionPrototype *, int i, int len, const Identifier &);
69 
70  JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args) override;
71 
72  enum { ToString, ValueOf };
73 private:
74  int id;
75 };
76 
77 /**
78  * @internal
79  *
80  * The initial value of the global variable's "Boolean" property
81  */
82 class BooleanObjectImp : public InternalFunctionImp
83 {
84  friend class BooleanProtoFunc;
85 public:
87  BooleanPrototype *booleanProto);
88 
89  bool implementsConstruct() const override;
90  using KJS::JSObject::construct;
91  JSObject *construct(ExecState *exec, const List &args) override;
92 
93  JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args) override;
94 };
95 
96 } // namespace
97 
98 #endif
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)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Mar 26 2023 03:56:20 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.