1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | #ifndef QV4NUMBEROBJECT_H |
4 | #define QV4NUMBEROBJECT_H |
5 | |
6 | // |
7 | // W A R N I N G |
8 | // ------------- |
9 | // |
10 | // This file is not part of the Qt API. It exists purely as an |
11 | // implementation detail. This header file may change from version to |
12 | // version without notice, or even be removed. |
13 | // |
14 | // We mean it. |
15 | // |
16 | |
17 | #include "qv4object_p.h" |
18 | #include "qv4functionobject_p.h" |
19 | #include <QtCore/qnumeric.h> |
20 | |
21 | QT_BEGIN_NAMESPACE |
22 | |
23 | namespace QV4 { |
24 | |
25 | namespace Heap { |
26 | |
27 | struct NumberCtor : FunctionObject { |
28 | void init(QV4::ExecutionContext *scope); |
29 | }; |
30 | |
31 | } |
32 | |
33 | class NumberLocale : public QLocale |
34 | { |
35 | public: |
36 | static const NumberLocale *instance(); |
37 | const int defaultDoublePrecision; |
38 | protected: |
39 | NumberLocale(); |
40 | }; |
41 | |
42 | struct NumberCtor: FunctionObject |
43 | { |
44 | V4_OBJECT2(NumberCtor, FunctionObject) |
45 | |
46 | static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc, const Value *); |
47 | static ReturnedValue virtualCall(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
48 | }; |
49 | |
50 | struct NumberPrototype: NumberObject |
51 | { |
52 | V4_PROTOTYPE(objectPrototype) |
53 | void init(ExecutionEngine *engine, Object *ctor); |
54 | |
55 | static ReturnedValue method_isFinite(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
56 | static ReturnedValue method_isInteger(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
57 | static ReturnedValue method_isSafeInteger(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
58 | static ReturnedValue method_isNaN(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
59 | static ReturnedValue method_toString(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
60 | static ReturnedValue method_toLocaleString(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
61 | static ReturnedValue method_valueOf(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
62 | static ReturnedValue method_toFixed(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
63 | static ReturnedValue method_toExponential(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
64 | static ReturnedValue method_toPrecision(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
65 | }; |
66 | |
67 | |
68 | } |
69 | |
70 | QT_END_NAMESPACE |
71 | |
72 | #endif // QV4ECMAOBJECTS_P_H |
73 | |