• 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_ARK_NATIVE_VALUE_ARK_NATIVE_VALUE_H
17 #define FOUNDATION_ACE_NAPI_NATIVE_ENGINE_IMPL_ARK_NATIVE_VALUE_ARK_NATIVE_VALUE_H
18 
19 #include "ark_native_engine.h"
20 
21 using panda::Local;
22 using panda::LocalScope;
23 using panda::Global;
24 using panda::JSValueRef;
25 class ArkNativeValue : public NativeValue {
26 public:
27     ArkNativeValue(ArkNativeEngine* engine, Local<JSValueRef> value);
28     ~ArkNativeValue() override;
29 
30     void* GetInterface(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;
43     bool IsCallable() override;
44 
45     bool IsArgumentsObject() override;
46     bool IsAsyncFunction() override;
47     bool IsBooleanObject() override;
48     bool IsGeneratorFunction() override;
49     bool IsGeneratorObject() override;
50     bool IsMap() override;
51     bool IsMapIterator() override;
52     bool IsModuleNamespaceObject() override;
53     bool IsNumberObject() override;
54     bool IsProxy() override;
55     bool IsRegExp() override;
56     bool IsSet() override;
57     bool IsSetIterator() override;
58     bool IsStringObject() override;
59     bool IsSymbolObject() override;
60     bool IsWeakMap() override;
61     bool IsWeakSet() override;
62 
63     NativeValue* ToBoolean() override;
64     NativeValue* ToNumber() override;
65     NativeValue* ToString() override;
66     NativeValue* ToObject() override;
67 
68     bool StrictEquals(NativeValue* value) override;
69 
70     // value_ in NativeValue should not be replaced directly.
71     // If you must replace it, you should use this method.
72     void UpdateValue(Local<JSValueRef> value);
73 
74 protected:
75     ArkNativeEngine* engine_;
76 };
77 
78 #endif /* FOUNDATION_ACE_NAPI_NATIVE_ENGINE_IMPL_ARK_NATIVE_VALUE_ARK_NATIVE_VALUE_H */