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_V8_NATIVE_VALUE_V8_NATIVE_OBJECT_H 17 #define FOUNDATION_ACE_NAPI_NATIVE_ENGINE_IMPL_V8_NATIVE_VALUE_V8_NATIVE_OBJECT_H 18 19 #include "v8_native_value.h" 20 21 class V8NativeObject : public V8NativeValue, public NativeObject { 22 public: 23 explicit V8NativeObject(V8NativeEngine* engine); 24 V8NativeObject(V8NativeEngine* engine, v8::Local<v8::Value> value); 25 ~V8NativeObject() override; 26 27 void* GetInterface(int interfaceId) override; 28 bool ConvertToNativeBindingObject( 29 void* engine, DetachCallback detach, AttachCallback attach, void *object, void *hint) override; 30 void SetNativePointer(void* pointer, NativeFinalize cb, void* hint, NativeReference** reference = nullptr, 31 size_t nativeBindingSize) override; 32 void* GetNativePointer() override; 33 void SetNativeBindingPointer( 34 void* enginePointer, void* objPointer, void* hint, void* detachData, void* attachData) override; 35 void* GetNativeBindingPointer(uint32_t index) override; 36 37 NativeValue* GetPropertyNames() override; 38 NativeValue* GetEnumerablePropertyNames() override; 39 40 NativeValue* GetPrototype() override; 41 42 bool DefineProperty(NativePropertyDescriptor propertyDescriptor) override; 43 44 bool SetProperty(NativeValue* key, NativeValue* value) override; 45 NativeValue* GetProperty(NativeValue* key) override; 46 bool HasProperty(NativeValue* key) override; 47 bool DeleteProperty(NativeValue* key) override; 48 49 bool SetProperty(const char* name, NativeValue* value) override; 50 NativeValue* GetProperty(const char* name) override; 51 bool HasProperty(const char* name) override; 52 bool DeleteProperty(const char* name) override; 53 54 bool SetPrivateProperty(const char* name, NativeValue* value) override; 55 NativeValue* GetPrivateProperty(const char* name) override; 56 bool HasPrivateProperty(const char* name) override; 57 bool DeletePrivateProperty(const char* name) override; 58 }; 59 60 #endif /* FOUNDATION_ACE_NAPI_NATIVE_ENGINE_IMPL_V8_NATIVE_VALUE_V8_NATIVE_OBJECT_H */ 61