aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2026-06-09 10:37:25 +0300
committerlevlam <levlam@telegram.org>2026-06-09 10:37:25 +0300
commit0c6763b34e3492732b44d27a4632bedcd5dc9f66 (patch)
treebc82a47ba256be359c12ba8af6a2206e988cc303
parent42d310237df5fa49b5d95337b3b9599c5ca934b6 (diff)
Add JsonBlockTableCell.
-rw-r--r--telegram-bot-api/Client.cpp51
-rw-r--r--telegram-bot-api/Client.h1
2 files changed, 52 insertions, 0 deletions
diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp
index 866f5ba..3569009 100644
--- a/telegram-bot-api/Client.cpp
+++ b/telegram-bot-api/Client.cpp
@@ -845,6 +845,57 @@ class Client::JsonRichText final : public td::Jsonable {
const Client *client_;
};
+class Client::JsonRichTableCell final : public td::Jsonable {
+ public:
+ JsonRichTableCell(const td_api::pageBlockTableCell *cell, const Client *client) : cell_(cell), client_(client) {
+ }
+ void store(td::JsonValueScope *scope) const {
+ auto object = scope->enter_object();
+ if (cell_->text_ != nullptr) {
+ object("text", JsonRichText(cell_->text_.get(), client_));
+ }
+ if (cell_->is_header_) {
+ object("is_header", td::JsonTrue());
+ }
+ if (cell_->colspan_ > 1) {
+ object("colspan", cell_->colspan_);
+ }
+ if (cell_->rowspan_ > 1) {
+ object("rowspan", cell_->rowspan_);
+ }
+ switch (cell_->align_->get_id()) {
+ case td_api::pageBlockHorizontalAlignmentLeft::ID:
+ object("align", "left");
+ break;
+ case td_api::pageBlockHorizontalAlignmentCenter::ID:
+ object("align", "center");
+ break;
+ case td_api::pageBlockHorizontalAlignmentRight::ID:
+ object("align", "right");
+ break;
+ default:
+ UNREACHABLE();
+ }
+ switch (cell_->valign_->get_id()) {
+ case td_api::pageBlockVerticalAlignmentTop::ID:
+ object("valign", "top");
+ break;
+ case td_api::pageBlockVerticalAlignmentMiddle::ID:
+ object("valign", "middle");
+ break;
+ case td_api::pageBlockVerticalAlignmentBottom::ID:
+ object("valign", "bottom");
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+
+ private:
+ const td_api::pageBlockTableCell *cell_;
+ const Client *client_;
+};
+
class Client::JsonRichBlockCaption final : public td::Jsonable {
public:
JsonRichBlockCaption(const td_api::pageBlockCaption *caption, const Client *client)
diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h
index bb80140..19abd33 100644
--- a/telegram-bot-api/Client.h
+++ b/telegram-bot-api/Client.h
@@ -155,6 +155,7 @@ class Client final : public WebhookActor::Callback {
class JsonEntity;
class JsonVectorEntities;
class JsonRichText;
+ class JsonRichTableCell;
class JsonRichBlockCaption;
class JsonWebAppInfo;
class JsonCopyTextButton;