• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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 #ifndef FRAMEWORKS_MEDIATOOLS_USER_FILE_CLIENT_EX_H_
16 #define FRAMEWORKS_MEDIATOOLS_USER_FILE_CLIENT_EX_H_
17 #include <string>
18 #include <vector>
19 
20 #include "fetch_result.h"
21 #include "iremote_object.h"
22 
23 namespace OHOS {
24 namespace Media {
25 namespace MediaTool {
26 class UserFileClientEx {
27 public:
28     static int32_t Init();
29     static void Clear();
30     static int32_t InsertExt(const std::string &tableName, const std::string &name,
31         std::string &outString, bool isRestart = false);
32     static int32_t Query(const std::string &tableName, const std::string &uri,
33         std::shared_ptr<DataShare::DataShareResultSet> &resultSet, bool isList = false, bool isRestart = false);
34     static int Open(const std::string &uri, const std::string &mode, bool isRestart = false);
35     static int Close(const std::string &uri, const int fileFd, const std::string &mode,
36         bool isCreateThumbSync = false, bool isRestart = false);
37     static int Trash(const std::string &uri, bool isRestart = false);
38     static int Delete(const std::string &uri, bool isRestart = false);
39     static int Delete(bool isOnlyDeleteDb, bool isRestart = false);
40     static std::string GetTableNameByMediaType(const MediaType mediaType);
41     static std::string GetTableNameByUri(const std::string &uri);
42     static const std::vector<MediaType> &GetSupportTypes();
43     static const std::vector<std::string> &GetSupportTables();
44     static std::shared_ptr<DataShare::DataShareResultSet> GetResultsetByDisplayName(
45         const std::string &tableName, const std::string &displayName);
46     static bool CheckTableName(const std::string &tableName);
47 
48     static std::string GetQueryUri(const std::string &tableName);
49 };
50 } // namespace MediaTool
51 } // namespace Media
52 } // namespace OHOS
53 #endif // FRAMEWORKS_MEDIATOOLS_USER_FILE_CLIENT_EX_H_
54