• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FOUNDATION_ACE_NAPI_NATIVE_ENGINE_IMPL_JERRYSCRIPT_NATIVE_VALUE_JERRYSCRIPT_NATIVE_VALUE_H
17 #define FOUNDATION_ACE_NAPI_NATIVE_ENGINE_IMPL_JERRYSCRIPT_NATIVE_VALUE_JERRYSCRIPT_NATIVE_VALUE_H
18 
19 #include "jerryscript_headers.h"
20 
21 #include "native_engine/native_value.h"
22 
23 #include "jerryscript_native_engine.h"
24 
25 class JerryScriptNativeValue : public NativeValue {
26 public:
27     JerryScriptNativeValue(JerryScriptNativeEngine* engine, jerry_value_t value);
28     ~JerryScriptNativeValue() override;
29 
30     void* GetInterface(const int interfaceId) override;
31 
32     NativeValueType TypeOf() override;
33     bool InstanceOf(NativeValue* obj) override;
34 
35     bool IsArray() override;
36     bool IsArrayBuffer() override;
37     bool IsBuffer() override;
38     bool IsDate() override;
39     bool IsError() override;
40     bool IsTypedArray() override;
41     bool IsDataView() override;
42     bool IsPromise() override;
IsCallable()43     bool IsCallable() override { return false; }
44 
45     bool IsMapIterator() override;
46     bool IsSetIterator() override;
47     bool IsGeneratorObject() override;
48     bool IsModuleNamespaceObject() override;
49     bool IsProxy() override;
50     bool IsRegExp() override;
51     bool IsNumberObject() override;
52     bool IsMap() override;
53     bool IsSet() override;
54     bool IsArgumentsObject() override;
55     bool IsAsyncFunction() override;
56     bool IsBooleanObject() override;
57     bool IsGeneratorFunction() override;
58     bool IsStringObject() override;
59     bool IsSymbolObject() override;
60     bool IsWeakMap() override;
61     bool IsWeakSet() override;
62     bool IsBigInt64Array() override;
63     bool IsBigUint64Array() override;
64     bool IsSharedArrayBuffer() override;
65 
66     NativeValue* ToBoolean() override;
67     NativeValue* ToNumber() override;
68     NativeValue* ToString() override;
69     NativeValue* ToObject() override;
70 
71     bool StrictEquals(NativeValue* value) override;
72 
73 protected:
74     JerryScriptNativeEngine* engine_;
75 };
76 
77 #endif /* FOUNDATION_ACE_NAPI_NATIVE_ENGINE_IMPL_JERRYSCRIPT_NATIVE_VALUE_JERRYSCRIPT_NATIVE_VALUE_H */
78