• 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 "image_source.h"
26 #include "iremote_broker.h"
27 #include "iremote_object.h"
28 #include "iremote_proxy.h"
29 #include "refbase.h"
30 #include "uri.h"
31 
32 namespace OHOS {
33 namespace FileAccessFwk {
34 using namespace Media;
35 class FileAccessExtProxy : public IRemoteProxy<IFileAccessExtBase> {
36 public:
FileAccessExtProxy(const sptr<IRemoteObject> & remote)37     explicit FileAccessExtProxy(const sptr<IRemoteObject> &remote) : IRemoteProxy<IFileAccessExtBase>(remote) {}
38 
~FileAccessExtProxy()39     virtual ~FileAccessExtProxy() {}
40 
41     virtual int OpenFile(const Uri &uri, const int flags, int &fd) override;
42     virtual int CreateFile(const Uri &parent, const std::string &displayName, Uri &newFile) override;
43     virtual int Mkdir(const Uri &parent, const std::string &displayName, Uri &newFile) override;
44     virtual int Delete(const Uri &sourceFile) override;
45     virtual int Move(const Uri &sourceFile, const Uri &targetParent, Uri &newFile) override;
46     virtual int Copy(const Uri &sourceUri, const Uri &destUri, std::vector<CopyResult> &copyResult,
47         bool force = false) 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 int64_t maxCount,
50         const FileFilter &filter, std::vector<FileInfo> &fileInfoVec) 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 GetThumbnail(const Uri &uri, const ThumbnailSize &thumbnailSize,
54         std::shared_ptr<PixelMap> &pixelMap) override;
55     virtual int Query(const Uri &uri, std::vector<std::string> &columns, std::vector<std::string> &results) override;
56     virtual int GetFileInfoFromUri(const Uri &selectFile, FileInfo &fileInfo) override;
57     virtual int GetFileInfoFromRelativePath(const std::string &selectFile, FileInfo &fileInfo) override;
58     virtual int GetRoots(std::vector<RootInfo> &rootInfoVec) override;
59     virtual int Access(const Uri &uri, bool &isExist) override;
60     virtual int StartWatcher(const Uri &uri) override;
61     virtual int StopWatcher(const Uri &uri, bool isUnregisterAll) override;
62 private:
63     static inline BrokerDelegator<FileAccessExtProxy> delegator_;
64 };
65 } // namespace FileAccessFwk
66 } // namespace OHOS
67 #endif // FILE_ACCESS_EXT_PROXY_H
68