tdlight/td/telegram/BackgroundInfo.h

61 lines
1.7 KiB
C
Raw Normal View History

2023-04-10 15:32:59 +02:00
//
2024-01-01 01:07:21 +01:00
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
2023-04-10 15:32:59 +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/BackgroundId.h"
#include "td/telegram/BackgroundType.h"
2023-04-19 09:38:55 +02:00
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
2023-04-10 15:32:59 +02:00
#include "td/utils/common.h"
#include "td/utils/StringBuilder.h"
namespace td {
class Td;
class BackgroundInfo {
BackgroundId background_id_;
BackgroundType background_type_;
friend StringBuilder &operator<<(StringBuilder &string_builder, const BackgroundInfo &background_info);
public:
BackgroundInfo() : background_id_(), background_type_() {
}
BackgroundInfo(Td *td, telegram_api::object_ptr<telegram_api::WallPaper> &&wallpaper_ptr);
td_api::object_ptr<td_api::background> get_background_object(const Td *td) const;
td_api::object_ptr<td_api::chatBackground> get_chat_background_object(const Td *td) const;
2023-04-10 15:32:59 +02:00
bool is_valid() const {
return background_id_.is_valid();
}
bool operator==(const BackgroundInfo &other) const {
return background_id_ == other.background_id_ && background_type_ == other.background_type_;
}
bool operator!=(const BackgroundInfo &other) const {
return !(*this == other);
}
template <class StorerT>
void store(StorerT &storer) const;
template <class ParserT>
void parse(ParserT &parser);
};
inline StringBuilder &operator<<(StringBuilder &string_builder, const BackgroundInfo &background_info) {
return string_builder << background_info.background_id_ << " with type " << background_info.background_type_;
}
} // namespace td