• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  /*
2  * Copyright (c) 2022 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 NAPI_CONSTANTS_H
17 #define NAPI_CONSTANTS_H
18 
19 #include <cstddef>
20 #include <string_view>
21 
22 namespace OHOS {
23 namespace MMI {
24 inline constexpr std::string_view CALL_FUNCTION = "napi_call_function";
25 inline constexpr std::string_view CREATE_OBJECT = "napi_create_object";
26 inline constexpr std::string_view CREATE_INT32 = "napi_create_int32";
27 inline constexpr std::string_view CREATE_PROMISE = "napi_create_promise";
28 inline constexpr std::string_view CREATE_REFERENCE = "napi_create_reference";
29 inline constexpr std::string_view CREATE_ASYNC_WORK = "napi_create_async_work";
30 inline constexpr std::string_view DEFINE_PROPERTIES = "napi_define_properties";
31 inline constexpr std::string_view DEFINE_CLASS = "napi_define_class";
32 inline constexpr std::string_view DELETE_REFERENCE = "napi_delete_reference";
33 inline constexpr std::string_view GET_CB_INFO = "napi_get_cb_info";
34 inline constexpr std::string_view GET_VALUE_BOOL = "napi_get_value_bool";
35 inline constexpr std::string_view GET_GLOBAL = "napi_get_global";
36 inline constexpr std::string_view GET_REFERENCE_VALUE = "napi_get_reference_value";
37 inline constexpr std::string_view GET_BOOLEAN = "napi_get_boolean";
38 inline constexpr std::string_view GET_VALUE_INT32 = "napi_get_value_int32";
39 inline constexpr std::string_view GET_UV_EVENT_LOOP = "napi_get_uv_event_loop";
40 inline constexpr std::string_view GET_UNDEFINED = "napi_get_undefined";
41 inline constexpr std::string_view GET_NAMED_PROPERTY = "napi_get_named_property";
42 inline constexpr std::string_view HAS_NAMED_PROPERTY = "napi_has_named_property";
43 inline constexpr std::string_view NEW_INSTANCE = "napi_new_instance";
44 inline constexpr std::string_view QUEUE_ASYNC_WORK = "napi_queue_async_work";
45 inline constexpr std::string_view RESOLVE_DEFERRED = "napi_resolve_deferred";
46 inline constexpr std::string_view REJECT_DEFERRED = "napi_reject_deferred";
47 inline constexpr std::string_view REFERENCE_REF = "napi_reference_ref";
48 inline constexpr std::string_view SET_NAMED_PROPERTY = "napi_set_named_property";
49 inline constexpr std::string_view STRICT_EQUALS = "napi_strict_equals";
50 inline constexpr std::string_view TYPEOF = "napi_typeof";
51 inline constexpr std::string_view UNWRAP = "napi_unwrap";
52 inline constexpr std::string_view WRAP = "napi_wrap";
53 inline constexpr std::string_view GET_VALUE_STRING_UTF8 = "napi_get_value_string_utf8";
54 inline constexpr std::string_view GET_ARRAY_LENGTH = "napi_get_array_length";
55 inline constexpr std::string_view GET_ELEMENT = "napi_get_element";
56 inline constexpr std::string_view CREATE_ARRAY = "napi_create_array";
57 inline constexpr std::string_view SET_ELEMENT = "napi_set_element";
58 inline constexpr std::string_view CREATE_STRING_UTF8 = "napi_create_string_utf8";
59 inline const std::string CHANGED_TYPE = "change";
60 inline const std::string SUBSCRIBE_TYPE = "key";
61 inline constexpr std::string_view DELETE_ASYNC_WORK = "napi_delete_async_work";
62 inline constexpr std::string_view COERCE_TO_BOOL = "napi_coerce_to_bool";
63 inline constexpr std::string_view CREATE_ERROR = "napi_create_error";
64 
65 inline constexpr size_t MAX_STRING_LEN = 1024;
66 
67 inline constexpr int SUCCESS = 0;
68 inline constexpr int FAILED = -1;
69 inline constexpr int32_t ANR_DISPATCH = 0;
70 inline constexpr int32_t ANR_MONITOR = 1;
71 
72 inline constexpr uint32_t EVDEV_UDEV_TAG_KEYBOARD = (1 << 1);
73 inline constexpr uint32_t EVDEV_UDEV_TAG_MOUSE = (1 << 2);
74 inline constexpr uint32_t EVDEV_UDEV_TAG_TOUCHPAD = (1 << 3);
75 } // namespace MMI
76 } // namespace OHOS
77 #endif // NAPI_CONSTANTS_H