| 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 QV4DATAVIEW_H |
| 4 | #define QV4DATAVIEW_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 | |
| 20 | QT_BEGIN_NAMESPACE |
| 21 | |
| 22 | namespace QV4 { |
| 23 | |
| 24 | namespace Heap { |
| 25 | |
| 26 | struct DataViewCtor : FunctionObject { |
| 27 | void init(ExecutionEngine *engine); |
| 28 | }; |
| 29 | |
| 30 | #define DataViewMembers(class, Member) \ |
| 31 | Member(class, Pointer, SharedArrayBuffer *, buffer) \ |
| 32 | Member(class, NoMark, uint, byteLength) \ |
| 33 | Member(class, NoMark, uint, byteOffset) |
| 34 | |
| 35 | DECLARE_HEAP_OBJECT(DataView, Object) { |
| 36 | DECLARE_MARKOBJECTS(DataView) |
| 37 | void init() { Object::init(); } |
| 38 | }; |
| 39 | |
| 40 | } |
| 41 | |
| 42 | struct DataViewCtor: FunctionObject |
| 43 | { |
| 44 | V4_OBJECT2(DataViewCtor, FunctionObject) |
| 45 | |
| 46 | static ReturnedValue virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc, const Value *); |
| 47 | static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc); |
| 48 | }; |
| 49 | |
| 50 | struct DataView : Object |
| 51 | { |
| 52 | V4_OBJECT2(DataView, Object) |
| 53 | V4_PROTOTYPE(dataViewPrototype) |
| 54 | }; |
| 55 | |
| 56 | struct DataViewPrototype: Object |
| 57 | { |
| 58 | void init(ExecutionEngine *engine, Object *ctor); |
| 59 | |
| 60 | static ReturnedValue method_get_buffer(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
| 61 | static ReturnedValue method_get_byteLength(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
| 62 | static ReturnedValue method_get_byteOffset(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
| 63 | template <typename T> |
| 64 | static ReturnedValue method_getChar(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
| 65 | template <typename T> |
| 66 | static ReturnedValue method_get(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
| 67 | template <typename T> |
| 68 | static ReturnedValue method_getFloat(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
| 69 | template <typename T> |
| 70 | static ReturnedValue method_setChar(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
| 71 | template <typename T> |
| 72 | static ReturnedValue method_set(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
| 73 | template <typename T> |
| 74 | static ReturnedValue method_setFloat(const FunctionObject *, const Value *thisObject, const Value *argv, int argc); |
| 75 | }; |
| 76 | |
| 77 | |
| 78 | } // namespace QV4 |
| 79 | |
| 80 | QT_END_NAMESPACE |
| 81 | |
| 82 | #endif |
| 83 | |