• 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_OBJECT_H
17 #define FOUNDATION_ACE_NAPI_NATIVE_ENGINE_IMPL_ARK_NATIVE_VALUE_ARK_NATIVE_OBJECT_H
18 
19 #include "ark_native_value.h"
20 
21 class ArkNativeObject : public ArkNativeValue, public NativeObject {
22 public:
23     explicit ArkNativeObject(ArkNativeEngine* engine);
24     ArkNativeObject(ArkNativeEngine* engine, Local<JSValueRef> value);
25     ~ArkNativeObject() override;
26 
27     void* GetInterface(int interfaceId) override;
28 
29     void SetNativePointer(void* pointer, NativeFinalize cb, void* hint) override;
30     void* GetNativePointer() override;
31     void AddFinalizer(void* pointer, NativeFinalize cb, void* hint) override;
32     virtual void Freeze() override;
33     virtual void Seal() override;
34     NativeValue* GetPropertyNames() override;
35 
36     NativeValue* GetPrototype() override;
37 
38     bool DefineProperty(NativePropertyDescriptor propertyDescriptor) override;
39 
40     bool SetProperty(NativeValue* key, NativeValue* value) override;
41     NativeValue* GetProperty(NativeValue* key) override;
42     bool HasProperty(NativeValue* key) override;
43     bool DeleteProperty(NativeValue* key) override;
44 
45     bool SetProperty(const char* name, NativeValue* value) override;
46     NativeValue* GetProperty(const char* name) override;
47     bool HasProperty(const char* name) override;
48     bool DeleteProperty(const char* name) override;
49 
50     bool SetPrivateProperty(const char* name, NativeValue* value) override;
51     NativeValue* GetPrivateProperty(const char* name) override;
52     bool HasPrivateProperty(const char* name) override;
53     bool DeletePrivateProperty(const char* name) override;
54 
55     NativeValue* GetAllPropertyNames(
56         napi_key_collection_mode keyMode, napi_key_filter keyFilter, napi_key_conversion keyConversion) override;
57     virtual bool AssociateTypeTag(NapiTypeTag* typeTag) override;
58     virtual bool CheckTypeTag(NapiTypeTag* typeTag) override;
59 };
60 
61 #endif /* FOUNDATION_ACE_NAPI_NATIVE_ENGINE_IMPL_ARK_NATIVE_VALUE_ARK_NATIVE_OBJECT_H */