1 /*
2  * Copyright (C) 2024-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 
16 #ifndef OHOS_MEDIA_PHOTO_ALBUM_INFO_PO_H
17 #define OHOS_MEDIA_PHOTO_ALBUM_INFO_PO_H
18 
19 #include <sstream>
20 #include <string>
21 
22 #include "result_set.h"
23 #include "result_set_utils.h"
24 
25 namespace OHOS::Media {
26 class PhotoAlbumInfoPo {
27 public:
28     int32_t albumId;
29     std::string albumName;
30     std::string lPath;
31     int32_t albumType;
32     int32_t albumSubType;
33     std::string bundleName;
34     int32_t dirty;
35     int32_t count;
36     std::string cloudId;
37     int32_t priority;
38 
39 public:
ToString()40     std::string ToString() const
41     {
42         std::stringstream ss;
43         ss << "{"
44            << "albumId: " << this->albumId << ", albumName: " << this->albumName << ", lPath: " << this->lPath
45            << ", albumType: " << this->albumType << ", albumSubType: " << this->albumSubType
46            << ", bundleName: " << this->bundleName << ", cloudId: " << this->cloudId << ", dirty: " << this->dirty
47            << ", count: " << this->count << ", priority: " << this->priority << "}";
48         return ss.str();
49     }
50 
Parse(const shared_ptr<NativeRdb::ResultSet> & resultSet)51     PhotoAlbumInfoPo &Parse(const shared_ptr<NativeRdb::ResultSet> &resultSet)
52     {
53         if (resultSet == nullptr) {
54             return *this;
55         }
56         this->albumId = GetInt64Val("album_id", resultSet);
57         this->albumName = GetStringVal("album_name", resultSet);
58         this->albumType = GetInt32Val("album_type", resultSet);
59         this->albumSubType = GetInt32Val("album_subtype", resultSet);
60         this->lPath = GetStringVal("lpath", resultSet);
61         this->bundleName = GetStringVal("bundle_name", resultSet);
62         this->dirty = GetInt32Val("dirty", resultSet);
63         this->count = GetInt32Val("count", resultSet);
64         this->cloudId = GetStringVal("cloud_id", resultSet);
65         this->priority = GetInt32Val("priority", resultSet);
66         return *this;
67     }
68 };
69 }  // namespace OHOS::Media
70 #endif  // OHOS_MEDIA_PHOTO_ALBUM_INFO_PO_H