• 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 
16 #ifndef INTERFACES_KITS_JS_SRC_MOD_FILEIO_COMMON_FUNC_H
17 #define INTERFACES_KITS_JS_SRC_MOD_FILEIO_COMMON_FUNC_H
18 
19 #include "../common/napi/uni_header.h"
20 
21 namespace OHOS {
22 namespace DistributedFS {
23 namespace ModuleFileIO {
24 constexpr int64_t INVALID_POSITION = std::numeric_limits<decltype(INVALID_POSITION)>::max();
25 
26 struct CommonFunc {
27     static std::tuple<bool, void *, int64_t, bool, int64_t, int> GetReadArg(napi_env env,
28                                                                        napi_value readBuf,
29                                                                        napi_value option);
30     static std::tuple<bool, std::unique_ptr<char[]>, void *, int64_t, bool, int64_t> GetWriteArg(napi_env env,
31                                                                                                  napi_value argWBuf,
32                                                                                                  napi_value argOption);
33     static std::tuple<bool, std::unique_ptr<char[]>, std::unique_ptr<char[]>> GetCopyPathArg(napi_env env,
34                                                                                              napi_value srcPath,
35                                                                                              napi_value dstPath);
36 };
37 } // namespace ModuleFileIO
38 } // namespace DistributedFS
39 } // namespace OHOS
40 #endif