1bc03f14fSopenharmony_ci/* 2bc03f14fSopenharmony_ci * Copyright (C) 2021 Huawei Device Co., Ltd. 3bc03f14fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4bc03f14fSopenharmony_ci * you may not use this file except in compliance with the License. 5bc03f14fSopenharmony_ci * You may obtain a copy of the License at 6bc03f14fSopenharmony_ci * 7bc03f14fSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8bc03f14fSopenharmony_ci * 9bc03f14fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10bc03f14fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11bc03f14fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12bc03f14fSopenharmony_ci * See the License for the specific language governing permissions and 13bc03f14fSopenharmony_ci * limitations under the License. 14bc03f14fSopenharmony_ci */ 15bc03f14fSopenharmony_ci#ifndef N_NAPI_PASTEBOARD_COMMON_H 16bc03f14fSopenharmony_ci#define N_NAPI_PASTEBOARD_COMMON_H 17bc03f14fSopenharmony_ci 18bc03f14fSopenharmony_ci#include <string> 19bc03f14fSopenharmony_ci 20bc03f14fSopenharmony_ci#include "napi/native_api.h" 21bc03f14fSopenharmony_ci#include "napi/native_node_api.h" 22bc03f14fSopenharmony_ci#include "napi_common_want.h" 23bc03f14fSopenharmony_ci#include "paste_data_record.h" 24bc03f14fSopenharmony_ci#include "pasteboard_js_err.h" 25bc03f14fSopenharmony_ci#include "pasteboard_pattern.h" 26bc03f14fSopenharmony_ci#include "pixel_map_napi.h" 27bc03f14fSopenharmony_ci#include "tlv_object.h" 28bc03f14fSopenharmony_ci#include "napi_data_utils.h" 29bc03f14fSopenharmony_cinamespace OHOS { 30bc03f14fSopenharmony_cinamespace MiscServicesNapi { 31bc03f14fSopenharmony_cinapi_value GetCallbackErrorValue(napi_env env, int32_t errorCode); 32bc03f14fSopenharmony_civoid SetCallback(const napi_env &env, const napi_ref &callbackIn, const napi_value *result); 33bc03f14fSopenharmony_cinapi_value NapiGetNull(napi_env env); 34bc03f14fSopenharmony_cinapi_value CreateNapiNumber(napi_env env, int32_t num); 35bc03f14fSopenharmony_cinapi_value CreateNapiString(napi_env env, std::string str); 36bc03f14fSopenharmony_cibool GetValue(napi_env env, napi_value in, std::string &out); 37bc03f14fSopenharmony_cibool GetValue(napi_env env, napi_value in, std::set<MiscServices::Pattern> &out); 38bc03f14fSopenharmony_cinapi_status SetValue(napi_env env, std::set<MiscServices::Pattern> &in, napi_value &result); 39bc03f14fSopenharmony_cibool CheckArgsType(napi_env env, napi_value in, napi_valuetype expectedType, const char *message); 40bc03f14fSopenharmony_cibool CheckExpression(napi_env env, bool expression, MiscServices::JSErrorCode errCode, const char *message); 41bc03f14fSopenharmony_cibool CheckArgs(napi_env env, napi_value *argv, size_t argc, std::string &mimeType); 42bc03f14fSopenharmony_cibool CheckArgsMimeType(napi_env env, napi_value in, std::string &mimeType); 43bc03f14fSopenharmony_cibool CheckArgsArray(napi_env env, napi_value in, std::vector<std::string> &mimeTypes); 44bc03f14fSopenharmony_cibool CheckArgsFunc(napi_env env, napi_value in, napi_ref &provider); 45bc03f14fSopenharmony_cibool CheckArgsMap(napi_env env, napi_value in, 46bc03f14fSopenharmony_ci std::shared_ptr<std::map<std::string, std::shared_ptr<MiscServices::EntryValue>>> result); 47bc03f14fSopenharmony_cinapi_status ConvertEntryValue(napi_env env, napi_value *result, std::string &udtType, 48bc03f14fSopenharmony_ci std::shared_ptr<MiscServices::PasteDataEntry> value); 49bc03f14fSopenharmony_cibool GetNativeValue(napi_env env, std::string type, napi_value valueNapi, MiscServices::EntryValue &value); 50bc03f14fSopenharmony_ci} // namespace MiscServicesNapi 51bc03f14fSopenharmony_ci} // namespace OHOS 52bc03f14fSopenharmony_ci#endif