133eb0b6dSopenharmony_ci/*
233eb0b6dSopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
333eb0b6dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
433eb0b6dSopenharmony_ci * you may not use this file except in compliance with the License.
533eb0b6dSopenharmony_ci * You may obtain a copy of the License at
633eb0b6dSopenharmony_ci *
733eb0b6dSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
833eb0b6dSopenharmony_ci *
933eb0b6dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1033eb0b6dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1133eb0b6dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1233eb0b6dSopenharmony_ci * See the License for the specific language governing permissions and
1333eb0b6dSopenharmony_ci * limitations under the License.
1433eb0b6dSopenharmony_ci */
1533eb0b6dSopenharmony_ci
1633eb0b6dSopenharmony_ci#ifndef FOUNDATION_ACE_NAPI_NATIVE_ENGINE_NATIVE_PROPERTY_H
1733eb0b6dSopenharmony_ci#define FOUNDATION_ACE_NAPI_NATIVE_ENGINE_NATIVE_PROPERTY_H
1833eb0b6dSopenharmony_ci
1933eb0b6dSopenharmony_ci#include "native_engine/native_value.h"
2033eb0b6dSopenharmony_ci
2133eb0b6dSopenharmony_ciclass NativeEngine;
2233eb0b6dSopenharmony_ci
2333eb0b6dSopenharmony_ci#define NATIVE_DEFAULT 0
2433eb0b6dSopenharmony_ci#define NATIVE_WRITABLE 1 << 0
2533eb0b6dSopenharmony_ci#define NATIVE_ENUMERABLE 1 << 1
2633eb0b6dSopenharmony_ci#define NATIVE_CONFIGURABLE 1 << 2
2733eb0b6dSopenharmony_ci#define NATIVE_KEY_SKIP_STRINGS 1 << 3
2833eb0b6dSopenharmony_ci#define NATIVE_KEY_SKIP_SYMBOLS 1 << 4
2933eb0b6dSopenharmony_ci#define NATIVE_KEY_INCLUDE_PROTOTYPES 1 << 5
3033eb0b6dSopenharmony_ci#define NATIVE_KEY_OWN_ONLY 1 << 6
3133eb0b6dSopenharmony_ci#define NATIVE_KEY_KEEP_NUMBERS 1 << 7
3233eb0b6dSopenharmony_ci#define NATIVE_KEY_NUMBERS_TO_STRINGS 1 << 8
3333eb0b6dSopenharmony_ci#define NATIVE_INSTANCE 1 << 9
3433eb0b6dSopenharmony_ci#define NATIVE_STATIC 1 << 10
3533eb0b6dSopenharmony_ci#define NATIVE_INSTANCE_OBJECT 1 << 11
3633eb0b6dSopenharmony_ci#define NATIVE_INSTANCE_GENERIC 1 << 12
3733eb0b6dSopenharmony_ci#define NATIVE_DEFAULT_METHOD NATIVE_WRITABLE | NATIVE_CONFIGURABLE,
3833eb0b6dSopenharmony_ci#define NATIVE_DEFAULT_PROPERTY (NATIVE_WRITABLE | NATIVE_ENUMERABLE | NATIVE_CONFIGURABLE)
3933eb0b6dSopenharmony_ci
4033eb0b6dSopenharmony_cistruct NapiPropertyDescriptor {
4133eb0b6dSopenharmony_ci    const char* utf8name = nullptr;
4233eb0b6dSopenharmony_ci    napi_value name = nullptr;
4333eb0b6dSopenharmony_ci    NapiNativeCallback method = nullptr;
4433eb0b6dSopenharmony_ci    NapiNativeCallback getter = nullptr;
4533eb0b6dSopenharmony_ci    NapiNativeCallback setter = nullptr;
4633eb0b6dSopenharmony_ci    napi_value value = nullptr;
4733eb0b6dSopenharmony_ci    uint32_t attributes = NATIVE_DEFAULT;
4833eb0b6dSopenharmony_ci    void* data = nullptr;
4933eb0b6dSopenharmony_ci};
5033eb0b6dSopenharmony_ci
5133eb0b6dSopenharmony_ci#endif /* FOUNDATION_ACE_NAPI_NATIVE_ENGINE_NATIVE_PROPERTY_H */
52