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
|
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// 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/MediaAreaCoordinates.h"
#include "td/utils/tl_helpers.h"
namespace td {
template <class StorerT>
void MediaAreaCoordinates::store(StorerT &storer) const {
using td::store;
bool has_radius = radius_ > 0.0;
BEGIN_STORE_FLAGS();
STORE_FLAG(has_radius);
END_STORE_FLAGS();
store(x_, storer);
store(y_, storer);
store(width_, storer);
store(height_, storer);
store(rotation_angle_, storer);
if (has_radius) {
store(radius_, storer);
}
}
template <class ParserT>
void MediaAreaCoordinates::parse(ParserT &parser) {
using td::parse;
bool has_radius;
BEGIN_PARSE_FLAGS();
PARSE_FLAG(has_radius);
END_PARSE_FLAGS();
double x;
double y;
double width;
double height;
double rotation_angle;
double radius = 0.0;
parse(x, parser);
parse(y, parser);
parse(width, parser);
parse(height, parser);
parse(rotation_angle, parser);
if (has_radius) {
parse(radius, parser);
}
init(x, y, width, height, rotation_angle, radius);
}
} // namespace td
|