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_COMMON_FILE_ACCESS_H 17 #define NAPI_COMMON_FILE_ACCESS_H 18 19 #include <map> 20 #include <string> 21 #include <vector> 22 23 #include "file_access_extension_info.h" 24 #include "napi_common_data.h" 25 #include "napi_common_util.h" 26 #include "want.h" 27 28 namespace OHOS { 29 namespace FileAccessFwk { 30 napi_value WrapUint32ToJS(napi_env env, uint32_t value); 31 uint32_t UnwrapUint32FromJS(napi_env env, napi_value param, uint32_t defaultValue = 0); 32 bool UnwrapUint32FromJS2(napi_env env, napi_value param, uint32_t &value); 33 bool UnwrapUint32ByPropertyName(napi_env env, napi_value param, const char *propertyName, uint32_t &value); 34 35 napi_value WrapBigIntUint64ToJS(napi_env env, uint64_t value); 36 uint64_t UnwrapBigIntUint64FromJS(napi_env env, napi_value param, uint64_t defaultValue = 0); 37 bool UnwrapBigIntUint64FromJS2(napi_env env, napi_value param, uint64_t &defaultValue); 38 bool UnwrapBigIntUint64ByPropertyName(napi_env env, napi_value param, const char *propertyName, uint64_t &value); 39 40 napi_value WrapArrayWantToJS(napi_env env, const std::vector<OHOS::AAFwk::Want> &wantVec); 41 bool UnwrapArrayWantFromJS(napi_env env, napi_value param, std::vector<OHOS::AAFwk::Want> &wantVec); 42 napi_value GetUndefinedValue(napi_env env); 43 napi_status GetStringValue(napi_env env, napi_value value, std::string &result); 44 } // namespace FileAccessFwk 45 } // namespace OHOS 46 #endif // NAPI_COMMON_FILE_ACCESS_H