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 
16 #ifndef MEDIALIBRARY_AUDIO_OPERATIONS_H
17 #define MEDIALIBRARY_AUDIO_OPERATIONS_H
18 
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
23 #include "abs_shared_result_set.h"
24 #include "medialibrary_asset_operations.h"
25 #include "medialibrary_command.h"
26 
27 
28 namespace OHOS {
29 namespace Media {
30 #define EXPORT __attribute__ ((visibility ("default")))
31 class MediaLibraryAudioOperations : public MediaLibraryAssetOperations {
32 public:
33     EXPORT static int32_t Create(MediaLibraryCommand &cmd);
34     EXPORT static std::shared_ptr<NativeRdb::ResultSet> Query(MediaLibraryCommand &cmd,
35         const std::vector<std::string> &columns);
36     EXPORT static int32_t Update(MediaLibraryCommand &cmd);
37     EXPORT static int32_t Delete(MediaLibraryCommand &cmd);
38     EXPORT static int32_t Open(MediaLibraryCommand &cmd, const std::string &mode);
39     EXPORT static int32_t Close(MediaLibraryCommand &cmd);
40     EXPORT static void MoveToMusic();
41     static int32_t TrashAging(std::shared_ptr<int> countPtr = nullptr);
42 
43 private:
44     static int32_t CreateV9(MediaLibraryCommand &cmd);
45     static int32_t CreateV10(MediaLibraryCommand &cmd);
46     static int32_t DeleteAudio(const std::shared_ptr<FileAsset> &fileAsset, MediaLibraryApi api);
47     static int32_t UpdateV9(MediaLibraryCommand &cmd);
48     static int32_t UpdateV10(MediaLibraryCommand &cmd);
49 };
50 } // namespace Media
51 } // namespace OHOS
52 
53 #endif // MEDIALIBRARY_AUDIO_OPERATIONS_H