• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 Rename(const Uri &sourceFile, const std::string &displayName, Uri &newFile) override;
45     virtual int ListFile(const FileInfo &fileInfo, const int64_t offset, const int64_t maxCount,
46         const FileFilter &filter, std::vector<FileInfo> &fileInfoVec) override;
47     virtual int ScanFile(const FileInfo &fileInfo, const int64_t offset, const int64_t maxCount,
48         const FileFilter &filter, std::vector<FileInfo> &fileInfoVec) override;
49     virtual int UriToFileInfo(const Uri &selectFile, FileInfo &fileInfo) override;
50     virtual int GetRoots(std::vector<RootInfo> &rootInfoVec) override;
51     virtual int Access(const Uri &uri, bool &isExist) override;
52     virtual int RegisterNotify(sptr<IFileAccessNotify> &notify) override;
53     virtual int UnregisterNotify(sptr<IFileAccessNotify> &notify) override;
54 private:
55     static inline BrokerDelegator<FileAccessExtProxy> delegator_;
56 };
57 } // namespace FileAccessFwk
58 } // namespace OHOS
59 #endif // FILE_ACCESS_EXT_PROXY_H
60