• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-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 #define MLOG_TAG "Album"
16 
17 #include "album_asset.h"
18 
19 #include "media_file_utils.h"
20 #include "medialibrary_type_const.h"
21 #include "media_log.h"
22 
23 using namespace std;
24 
25 namespace OHOS {
26 namespace Media {
AlbumAsset()27 AlbumAsset::AlbumAsset()
28 {
29     albumId_ = DEFAULT_ALBUM_ID;
30     albumName_ = DEFAULT_ALBUM_NAME;
31     albumUri_ = DEFAULT_ALBUM_URI;
32     albumDateModified_ = DEFAULT_ALBUM_DATE_MODIFIED;
33     count_ = DEFAULT_COUNT;
34     albumRelativePath_ = DEFAULT_ALBUM_RELATIVE_PATH;
35     coverUri_ = DEFAULT_COVERURI;
36     albumPath_ = DEFAULT_ALBUM_PATH;
37     albumVirtual_ = DEFAULT_ALBUM_VIRTUAL;
38     resultNapiType_ = ResultNapiType::TYPE_MEDIALIBRARY;
39 }
40 
41 AlbumAsset::~AlbumAsset() = default;
42 
43 
SetAlbumId(const int32_t albumId)44 void AlbumAsset::SetAlbumId(const int32_t albumId)
45 {
46     albumId_ = albumId;
47 }
48 
SetAlbumName(const string & albumName)49 void AlbumAsset::SetAlbumName(const string& albumName)
50 {
51     albumName_ = albumName;
52 }
53 
SetAlbumUri(const string & albumUri)54 void AlbumAsset::SetAlbumUri(const string& albumUri)
55 {
56     albumUri_ = albumUri;
57 }
58 
SetAlbumDateModified(const int64_t albumDateModified)59 void AlbumAsset::SetAlbumDateModified(const int64_t albumDateModified)
60 {
61     albumDateModified_ = albumDateModified;
62 }
63 
SetCount(const int32_t count)64 void AlbumAsset::SetCount(const int32_t count)
65 {
66     count_ = count;
67 }
68 
SetAlbumRelativePath(const string & albumRelativePath)69 void AlbumAsset::SetAlbumRelativePath(const string& albumRelativePath)
70 {
71     albumRelativePath_ = albumRelativePath;
72 }
73 
SetCoverUri(const string & coverUri)74 void AlbumAsset::SetCoverUri(const string& coverUri)
75 {
76     coverUri_ = coverUri;
77 }
78 
SetAlbumPath(const string & albumPath)79 void AlbumAsset::SetAlbumPath(const string& albumPath)
80 {
81     albumPath_ = albumPath;
82 }
83 
SetAlbumVirtual(const bool albumVirtual)84 void AlbumAsset::SetAlbumVirtual(const bool albumVirtual)
85 {
86     albumVirtual_ = albumVirtual;
87 }
88 
GetAlbumId() const89 int32_t AlbumAsset::GetAlbumId() const
90 {
91     return albumId_;
92 }
93 
GetAlbumName() const94 const string& AlbumAsset::GetAlbumName() const
95 {
96     return albumName_;
97 }
98 
GetAlbumUri() const99 const string& AlbumAsset::GetAlbumUri() const
100 {
101     return albumUri_;
102 }
103 
GetAlbumDateModified() const104 int64_t AlbumAsset::GetAlbumDateModified() const
105 {
106     return albumDateModified_;
107 }
108 
GetCount() const109 int32_t AlbumAsset::GetCount() const
110 {
111     return count_;
112 }
113 
GetAlbumRelativePath() const114 const string& AlbumAsset::GetAlbumRelativePath() const
115 {
116     return albumRelativePath_;
117 }
118 
GetCoverUri() const119 const string& AlbumAsset::GetCoverUri() const
120 {
121     return coverUri_;
122 }
123 
GetAlbumPath() const124 const string& AlbumAsset::GetAlbumPath() const
125 {
126     return albumPath_;
127 }
128 
GetAlbumVirtual() const129 bool AlbumAsset::GetAlbumVirtual() const
130 {
131     return albumVirtual_;
132 }
133 
SetResultNapiType(const ResultNapiType type)134 void AlbumAsset::SetResultNapiType(const ResultNapiType type)
135 {
136     resultNapiType_ = type;
137 }
138 
GetResultNapiType() const139 ResultNapiType AlbumAsset::GetResultNapiType() const
140 {
141     return resultNapiType_;
142 }
143 
144 #ifdef MEDIALIBRARY_COMPATIBILITY
SetAlbumType(const PhotoAlbumType albumType)145 void AlbumAsset::SetAlbumType(const PhotoAlbumType albumType)
146 {
147     albumType_ = albumType;
148 }
SetAlbumSubType(const PhotoAlbumSubType albumSubType)149 void AlbumAsset::SetAlbumSubType(const PhotoAlbumSubType albumSubType)
150 {
151     albumSubType_ = albumSubType;
152 }
153 
GetAlbumType() const154 PhotoAlbumType AlbumAsset::GetAlbumType() const
155 {
156     return albumType_;
157 }
GetAlbumSubType() const158 PhotoAlbumSubType AlbumAsset::GetAlbumSubType() const
159 {
160     return albumSubType_;
161 }
162 #endif
163 }  // namespace Media
164 }  // namespace OHOS
165