Add TermsOfService.hpp.

This commit is contained in:
levlam 2024-08-01 13:33:24 +03:00
parent 3589cee782
commit 2adad66847
4 changed files with 43 additions and 19 deletions

View File

@ -1020,6 +1020,7 @@ set(TDLIB_SOURCE_PART2
td/telegram/StoryInteractionInfo.hpp td/telegram/StoryInteractionInfo.hpp
td/telegram/StoryStealthMode.hpp td/telegram/StoryStealthMode.hpp
td/telegram/SuggestedAction.hpp td/telegram/SuggestedAction.hpp
td/telegram/TermsOfService.hpp
td/telegram/ThemeSettings.hpp td/telegram/ThemeSettings.hpp
td/telegram/TranscriptionInfo.hpp td/telegram/TranscriptionInfo.hpp
td/telegram/VideoNotesManager.hpp td/telegram/VideoNotesManager.hpp

View File

@ -28,6 +28,7 @@
#include "td/telegram/Td.h" #include "td/telegram/Td.h"
#include "td/telegram/TdDb.h" #include "td/telegram/TdDb.h"
#include "td/telegram/telegram_api.h" #include "td/telegram/telegram_api.h"
#include "td/telegram/TermsOfService.hpp"
#include "td/telegram/TermsOfServiceManager.h" #include "td/telegram/TermsOfServiceManager.h"
#include "td/telegram/ThemeManager.h" #include "td/telegram/ThemeManager.h"
#include "td/telegram/TopDialogManager.h" #include "td/telegram/TopDialogManager.h"

View File

@ -7,7 +7,6 @@
#pragma once #pragma once
#include "td/telegram/MessageEntity.h" #include "td/telegram/MessageEntity.h"
#include "td/telegram/MessageEntity.hpp"
#include "td/telegram/td_api.h" #include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h" #include "td/telegram/telegram_api.h"
@ -33,26 +32,10 @@ class TermsOfService {
td_api::object_ptr<td_api::termsOfService> get_terms_of_service_object() const; td_api::object_ptr<td_api::termsOfService> get_terms_of_service_object() const;
template <class StorerT> template <class StorerT>
void store(StorerT &storer) const { void store(StorerT &storer) const;
using td::store;
BEGIN_STORE_FLAGS();
STORE_FLAG(show_popup_);
END_STORE_FLAGS();
store(id_, storer);
store(text_, storer);
store(min_user_age_, storer);
}
template <class ParserT> template <class ParserT>
void parse(ParserT &parser) { void parse(ParserT &parser);
using td::parse;
BEGIN_PARSE_FLAGS();
PARSE_FLAG(show_popup_);
END_PARSE_FLAGS();
parse(id_, parser);
parse(text_, parser);
parse(min_user_age_, parser);
}
}; };
} // namespace td } // namespace td

View File

@ -0,0 +1,39 @@
//
// 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/TermsOfService.h"
#include "td/telegram/MessageEntity.hpp"
#include "td/utils/common.h"
namespace td {
template <class StorerT>
void TermsOfService::store(StorerT &storer) const {
using td::store;
BEGIN_STORE_FLAGS();
STORE_FLAG(show_popup_);
END_STORE_FLAGS();
store(id_, storer);
store(text_, storer);
store(min_user_age_, storer);
}
template <class ParserT>
void TermsOfService::parse(ParserT &parser) {
using td::parse;
BEGIN_PARSE_FLAGS();
PARSE_FLAG(show_popup_);
END_PARSE_FLAGS();
parse(id_, parser);
parse(text_, parser);
parse(min_user_age_, parser);
}
} // namespace td