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 virtual ~V8NativeObject(); 26 27 void* GetInterface(int interfaceId) override; 28 29 virtual void SetNativePointer(void* pointer, NativeFinalize cb, void* hint) override; 30 virtual void* GetNativePointer() override; 31 32 virtual NativeValue* GetPropertyNames() override; 33 34 virtual NativeValue* GetPrototype() override; 35 36 virtual bool DefineProperty(NativePropertyDescriptor propertyDescriptor) override; 37 38 virtual bool SetProperty(NativeValue* key, NativeValue* value) override; 39 virtual NativeValue* GetProperty(NativeValue* key) override; 40 virtual bool HasProperty(NativeValue* key) override; 41 virtual bool DeleteProperty(NativeValue* key) override; 42 43 virtual bool SetProperty(const char* name, NativeValue* value) override; 44 virtual NativeValue* GetProperty(const char* name) override; 45 virtual bool HasProperty(const char* name) override; 46 virtual bool DeleteProperty(const char* name) override; 47 48 virtual bool SetPrivateProperty(const char* name, NativeValue* value) override; 49 virtual NativeValue* GetPrivateProperty(const char* name) override; 50 virtual bool HasPrivateProperty(const char* name) override; 51 virtual bool DeletePrivateProperty(const char* name) override; 52 }; 53 54 #endif /* FOUNDATION_ACE_NAPI_NATIVE_ENGINE_IMPL_V8_NATIVE_VALUE_V8_NATIVE_OBJECT_H */