blob: ba159dadcf23d1c4a3e05f39a7188a5b3c808be7 (
plain)
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
|
//
// 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/SuggestedPost.h"
#include "td/telegram/SuggestedPostPrice.hpp"
#include "td/utils/tl_helpers.h"
namespace td {
template <class StorerT>
void SuggestedPost::store(StorerT &storer) const {
bool has_price = !price_.is_empty();
bool has_schedule_date = schedule_date_ != 0;
BEGIN_STORE_FLAGS();
STORE_FLAG(is_accepted_);
STORE_FLAG(is_rejected_);
STORE_FLAG(has_price);
STORE_FLAG(has_schedule_date);
END_STORE_FLAGS();
if (has_price) {
td::store(price_, storer);
}
if (has_schedule_date) {
td::store(schedule_date_, storer);
}
}
template <class ParserT>
void SuggestedPost::parse(ParserT &parser) {
bool has_price;
bool has_schedule_date;
BEGIN_PARSE_FLAGS();
PARSE_FLAG(is_accepted_);
PARSE_FLAG(is_rejected_);
PARSE_FLAG(has_price);
PARSE_FLAG(has_schedule_date);
END_PARSE_FLAGS();
if (has_price) {
td::parse(price_, parser);
}
if (has_schedule_date) {
td::parse(schedule_date_, parser);
}
}
} // namespace td
|