2023-08-01 13:20:42 +02:00
|
|
|
//
|
2024-01-01 01:07:21 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
2023-08-01 13:20:42 +02:00
|
|
|
//
|
|
|
|
// 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;
|
2024-06-16 21:00:48 +02:00
|
|
|
bool has_radius = radius_ > 0.0;
|
2023-08-01 13:20:42 +02:00
|
|
|
BEGIN_STORE_FLAGS();
|
2024-06-16 21:00:48 +02:00
|
|
|
STORE_FLAG(has_radius);
|
2023-08-01 13:20:42 +02:00
|
|
|
END_STORE_FLAGS();
|
|
|
|
store(x_, storer);
|
|
|
|
store(y_, storer);
|
|
|
|
store(width_, storer);
|
|
|
|
store(height_, storer);
|
|
|
|
store(rotation_angle_, storer);
|
2024-06-16 21:00:48 +02:00
|
|
|
if (has_radius) {
|
|
|
|
store(radius_, storer);
|
|
|
|
}
|
2023-08-01 13:20:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void MediaAreaCoordinates::parse(ParserT &parser) {
|
|
|
|
using td::parse;
|
2024-06-16 21:00:48 +02:00
|
|
|
bool has_radius;
|
2023-08-01 13:20:42 +02:00
|
|
|
BEGIN_PARSE_FLAGS();
|
2024-06-16 21:00:48 +02:00
|
|
|
PARSE_FLAG(has_radius);
|
2023-08-01 13:20:42 +02:00
|
|
|
END_PARSE_FLAGS();
|
|
|
|
double x;
|
|
|
|
double y;
|
|
|
|
double width;
|
|
|
|
double height;
|
|
|
|
double rotation_angle;
|
2024-06-16 21:00:48 +02:00
|
|
|
double radius = 0.0;
|
2023-08-01 13:20:42 +02:00
|
|
|
parse(x, parser);
|
|
|
|
parse(y, parser);
|
|
|
|
parse(width, parser);
|
|
|
|
parse(height, parser);
|
|
|
|
parse(rotation_angle, parser);
|
2024-06-16 21:00:48 +02:00
|
|
|
if (has_radius) {
|
|
|
|
parse(radius, parser);
|
|
|
|
}
|
|
|
|
init(x, y, width, height, rotation_angle, radius);
|
2023-08-01 13:20:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace td
|