aboutsummaryrefslogtreecommitdiffhomepage
path: root/td/telegram/PremiumGiftOption.hpp
blob: ec64d364944b9e0ca8f0dec647ad9a6b4e9f0a3d (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//
// 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/PremiumGiftOption.h"

#include "td/utils/tl_helpers.h"

namespace td {

template <class StorerT>
void PremiumGiftOption::store(StorerT &storer) const {
  bool has_months = months_ != 0;
  bool has_currency = !currency_.empty();
  bool has_amount = amount_ != 0;
  bool has_bot_url = !bot_url_.empty();
  bool has_store_product = !store_product_.empty();
  bool has_transaction = !transaction_.empty();
  BEGIN_STORE_FLAGS();
  STORE_FLAG(has_months);
  STORE_FLAG(has_currency);
  STORE_FLAG(has_amount);
  STORE_FLAG(has_bot_url);
  STORE_FLAG(has_store_product);
  STORE_FLAG(is_current_);
  STORE_FLAG(is_upgrade_);
  STORE_FLAG(has_transaction);
  END_STORE_FLAGS();
  if (has_months) {
    td::store(months_, storer);
  }
  if (has_currency) {
    td::store(currency_, storer);
  }
  if (has_amount) {
    td::store(amount_, storer);
  }
  if (has_bot_url) {
    td::store(bot_url_, storer);
  }
  if (has_store_product) {
    td::store(store_product_, storer);
  }
  if (has_transaction) {
    td::store(transaction_, storer);
  }
}

template <class ParserT>
void PremiumGiftOption::parse(ParserT &parser) {
  bool has_months;
  bool has_currency;
  bool has_amount;
  bool has_bot_url;
  bool has_store_product;
  bool has_transaction;
  BEGIN_PARSE_FLAGS();
  PARSE_FLAG(has_months);
  PARSE_FLAG(has_currency);
  PARSE_FLAG(has_amount);
  PARSE_FLAG(has_bot_url);
  PARSE_FLAG(has_store_product);
  PARSE_FLAG(is_current_);
  PARSE_FLAG(is_upgrade_);
  PARSE_FLAG(has_transaction);
  END_PARSE_FLAGS();
  if (has_months) {
    td::parse(months_, parser);
  }
  if (has_currency) {
    td::parse(currency_, parser);
  }
  if (has_amount) {
    td::parse(amount_, parser);
  }
  if (has_bot_url) {
    td::parse(bot_url_, parser);
  }
  if (has_store_product) {
    td::parse(store_product_, parser);
  }
  if (has_transaction) {
    td::parse(transaction_, parser);
  }
}

}  // namespace td