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 FILE_ACCESS_EXT_PROXY_H 17 #define FILE_ACCESS_EXT_PROXY_H 18 19 #include <functional> 20 #include <iosfwd> 21 #include <vector> 22 23 #include "file_access_extension_info.h" 24 #include "ifile_access_ext_base.h" 25 #include "iremote_broker.h" 26 #include "iremote_object.h" 27 #include "iremote_proxy.h" 28 #include "refbase.h" 29 #include "uri.h" 30 31 namespace OHOS { 32 namespace FileAccessFwk { 33 class FileAccessExtProxy : public IRemoteProxy<IFileAccessExtBase> { 34 public: FileAccessExtProxy(const sptr<IRemoteObject> & remote)35 explicit FileAccessExtProxy(const sptr<IRemoteObject> &remote) : IRemoteProxy<IFileAccessExtBase>(remote) {} 36 ~FileAccessExtProxy()37 virtual ~FileAccessExtProxy() {} 38 39 virtual int OpenFile(const Uri &uri, const int flags, int &fd) override; 40 virtual int CreateFile(const Uri &parent, const std::string &displayName, Uri &newFile) override; 41 virtual int Mkdir(const Uri &parent, const std::string &displayName, Uri &newFile) override; 42 virtual int Delete(const Uri &sourceFile) override; 43 virtual int Move(const Uri &sourceFile, const Uri &targetParent, Uri &newFile) override; 44 virtual int Copy(const Uri &sourceUri, const Uri &destUri, std::vector<Result> ©Result, 45 bool force = false) override; 46 virtual int CopyFile(const Uri &sourceUri, const Uri &destUri, const std::string &fileName, 47 Uri &newFileUri) override; 48 virtual int Rename(const Uri &sourceFile, const std::string &displayName, Uri &newFile) override; 49 virtual int ListFile(const FileInfo &fileInfo, const int64_t offset, const FileFilter &filter, 50 SharedMemoryInfo &memInfo) override; 51 virtual int ScanFile(const FileInfo &fileInfo, const int64_t offset, const int64_t maxCount, 52 const FileFilter &filter, std::vector<FileInfo> &fileInfoVec) override; 53 virtual int Query(const Uri &uri, std::vector<std::string> &columns, std::vector<std::string> &results) override; 54 virtual int GetFileInfoFromUri(const Uri &selectFile, FileInfo &fileInfo) override; 55 virtual int GetFileInfoFromRelativePath(const std::string &selectFile, FileInfo &fileInfo) override; 56 virtual int GetRoots(std::vector<RootInfo> &rootInfoVec) override; 57 virtual int Access(const Uri &uri, bool &isExist) override; 58 virtual int StartWatcher(const Uri &uri) override; 59 virtual int StopWatcher(const Uri &uri) override; 60 virtual int MoveItem(const Uri &sourceFile, const Uri &targetParent, std::vector<Result> &moveResult, 61 bool force = false) override; 62 virtual int MoveFile(const Uri &sourceFile, const Uri &targetParent, std::string &fileName, Uri &newFile) override; 63 private: 64 static inline BrokerDelegator<FileAccessExtProxy> delegator_; 65 }; 66 } // namespace FileAccessFwk 67 } // namespace OHOS 68 #endif // FILE_ACCESS_EXT_PROXY_H