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 16 #ifndef OHOS_MEDIA_CLOUD_SYNC_CLOUD_CHECK_DATA_H 17 #define OHOS_MEDIA_CLOUD_SYNC_CLOUD_CHECK_DATA_H 18 19 #include <string> 20 #include <sstream> 21 22 #include "cloud_meta_data.h" 23 24 namespace OHOS::Media::CloudSync { 25 #define EXPORT __attribute__ ((visibility ("default"))) 26 class EXPORT CloudCheckData : public CloudMetaData { 27 public: 28 int64_t version; // 本地记录云端版本 29 int32_t position; // 本地数据库记录文件位置 30 int32_t thmStatus; // 本地数据库记录缩略图下载状态 31 int32_t syncStatus; 32 int32_t dirtyType; 33 34 public: // constructor & destructor 35 virtual ~CloudCheckData() = default; 36 37 public: // basic function ToString()38 virtual std::string ToString() const override 39 { 40 std::stringstream ss; 41 ss << "{\"cloudId\": \"" << cloudId << "\", \"size\": " << size << ", \"path\": \"" << path << "\"" 42 << ", \"fileName\": \"" << fileName << "\", \"type\": " << type << ", \"modifiedTime\": " << modifiedTime 43 << ",\"originalCloudId\": \"" << originalCloudId << "\","; 44 ss << "\"version\": " << version << ", \"position\": " << position << ", \"thmStatus\": " << thmStatus 45 << ", \"modifiedTime\": " << modifiedTime << ", \"dirtyType\": " << dirtyType << ", \"attachment\": {"; 46 bool first = true; 47 for (const auto &item : attachment) { 48 if (first) { 49 first = false; 50 } else { 51 ss << ","; 52 } 53 ss << "\"" << item.first << "\":" << item.second.ToString(); 54 first = false; 55 } 56 ss << "}}"; 57 return ss.str(); 58 } 59 }; 60 } // namespace OHOS::Media::CloudSync 61 #endif // OHOS_MEDIA_CLOUD_SYNC_CLOUD_CHECK_DATA_H