1 /* 2 * Copyright (c) 2024 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 PHOTO_ALBUM_IMPL_H 16 #define PHOTO_ALBUM_IMPL_H 17 18 #include "photo_album.h" 19 20 #include "cj_ffi/cj_common_ffi.h" 21 #include "datashare_helper.h" 22 #include "datashare_values_bucket.h" 23 #include "fetch_result.h" 24 #include "file_asset.h" 25 #include "photo_accesshelper_utils.h" 26 27 namespace OHOS { 28 namespace Media { 29 class PhotoAlbumImpl : public OHOS::FFI::FFIData { 30 DECL_TYPE(PhotoAlbumImpl, OHOS::FFI::FFIData) 31 public: 32 explicit PhotoAlbumImpl(std::unique_ptr<PhotoAlbum> photoAlbumPtr_); 33 explicit PhotoAlbumImpl(std::shared_ptr<PhotoAlbum> photoAlbumPtr_); ~PhotoAlbumImpl()34 ~PhotoAlbumImpl() override 35 { 36 photoAlbumPtr = nullptr; 37 } 38 std::shared_ptr<PhotoAlbum> GetPhotoAlbumInstance(); 39 int32_t GetPhotoAlbumType() const; 40 int32_t GetPhotoAlbumSubType() const; 41 std::string GetAlbumName() const; 42 void SetAlbumName(char* cAlbumName); 43 std::string GetAlbumUri() const; 44 int32_t GetCount() const; 45 std::string GetCoverUri() const; 46 int32_t GetImageCount() const; 47 int32_t GetVideoCount() const; 48 std::shared_ptr<FetchResult<FileAsset>> GetAssets(COptions options, int32_t &errCode); 49 void ParseArgsGetPhotoAssets(COptions options, DataShare::DataSharePredicates &predicates, 50 std::vector<std::string> &fetchColumn, ExtraInfo &extraInfo, int32_t &errCode); 51 void CommitModify(int32_t &errCode); 52 53 private: 54 std::shared_ptr<PhotoAlbum> photoAlbumPtr = nullptr; 55 }; 56 } 57 } 58 #endif