• 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 #ifndef N_NAPI_PASTEBOARD_COMMON_H
16 #define N_NAPI_PASTEBOARD_COMMON_H
17 
18 #include <string>
19 #include "napi/native_api.h"
20 #include "napi/native_node_api.h"
21 #include "pasteboard_js_err.h"
22 namespace OHOS {
23 namespace MiscServicesNapi {
24 napi_value GetCallbackErrorValue(napi_env env, int32_t errorCode);
25 void SetCallback(const napi_env &env, const napi_ref &callbackIn, const napi_value *result);
26 napi_value NapiGetNull(napi_env env);
27 napi_value CreateNapiNumber(napi_env env, int32_t num);
28 napi_value CreateNapiString(napi_env env, std::string str);
29 bool GetValue(napi_env env, napi_value in, std::string &out);
30 bool CheckArgsType(napi_env env, napi_value in, napi_valuetype expectedType, const char *message);
31 bool CheckExpression(napi_env env, bool expression, MiscServices::JSErrorCode errCode, const char *message);
32 bool CheckArgs(napi_env env, napi_value *argv, size_t argc, std::string &mimeType);
33 }  // namespace MiscServicesNapi
34 }  // namespace OHOS
35 #endif