1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2026
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
#include "td/telegram/files/FileId.hpp"
#include "td/telegram/Photo.h"
#include "td/telegram/PhotoSize.hpp"
#include "td/telegram/StickerPhotoSize.hpp"
#include "td/utils/tl_helpers.h"
namespace td {
template <class StorerT>
void store(const Photo &photo, StorerT &storer) {
bool has_minithumbnail = !photo.minithumbnail.empty();
bool has_animations = !photo.animations.empty();
bool has_sticker_photo_size = photo.sticker_photo_size != nullptr;
BEGIN_STORE_FLAGS();
STORE_FLAG(photo.has_stickers);
STORE_FLAG(has_minithumbnail);
STORE_FLAG(has_animations);
STORE_FLAG(has_sticker_photo_size);
END_STORE_FLAGS();
store(photo.id.get(), storer);
store(photo.date, storer);
store(photo.photos, storer);
if (photo.has_stickers) {
store(photo.sticker_file_ids, storer);
}
if (has_minithumbnail) {
store(photo.minithumbnail, storer);
}
if (has_animations) {
store(photo.animations, storer);
}
if (has_sticker_photo_size) {
store(photo.sticker_photo_size, storer);
}
}
template <class ParserT>
void parse(Photo &photo, ParserT &parser) {
bool has_minithumbnail;
bool has_animations;
bool has_sticker_photo_size;
BEGIN_PARSE_FLAGS();
PARSE_FLAG(photo.has_stickers);
PARSE_FLAG(has_minithumbnail);
PARSE_FLAG(has_animations);
PARSE_FLAG(has_sticker_photo_size);
END_PARSE_FLAGS();
int64 id;
parse(id, parser);
photo.id = id;
parse(photo.date, parser);
parse(photo.photos, parser);
if (photo.has_stickers) {
parse(photo.sticker_file_ids, parser);
}
if (has_minithumbnail) {
parse(photo.minithumbnail, parser);
}
if (has_animations) {
parse(photo.animations, parser);
}
if (has_sticker_photo_size) {
parse(photo.sticker_photo_size, parser);
}
}
} // namespace td
|