diff options
| author | levlam <levlam@telegram.org> | 2025-07-10 12:17:58 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2025-07-10 12:17:58 +0300 |
| commit | 2e3399d178cfe90ae1afaeb5d52c58ea7cfb37fc (patch) | |
| tree | 130aa19b1a8a6894a6f23d4ea170c8999327646b /td/telegram/SuggestedPost.hpp | |
| parent | b298f59b6b5c5413aac21a8c7471b984b053bdf7 (diff) | |
Add class SuggestedPost.
Diffstat (limited to 'td/telegram/SuggestedPost.hpp')
| -rw-r--r-- | td/telegram/SuggestedPost.hpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/td/telegram/SuggestedPost.hpp b/td/telegram/SuggestedPost.hpp new file mode 100644 index 000000000..215f286cf --- /dev/null +++ b/td/telegram/SuggestedPost.hpp @@ -0,0 +1,53 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2025 +// +// 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 |
