55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
#include "replymarkup.h"
|
|
|
|
const std::string InlineButton::ButtonTypeTypes[] = {"Callback", "CallbackPassword", "LoginURL", "SwitchInline", "URL"};
|
|
|
|
const std::string& InlineButton::getButtonTypeString(ButtonType t) {
|
|
if(t <= ButtonType::URL)
|
|
return ButtonTypeTypes[(uint32_t) t];
|
|
return ButtonTypeTypes[0];
|
|
}
|
|
|
|
InlineButton::ButtonType InlineCallbackButton::getButtonType() const {
|
|
return ButtonType::CALLBACK;
|
|
}
|
|
|
|
void InlineCallbackButton::write(std::ostream& os) const {
|
|
os << data;
|
|
}
|
|
|
|
InlineButton::ButtonType InlineCallbackPasswordButton::getButtonType() const {
|
|
return ButtonType::CALLBACKPASSWORD;
|
|
}
|
|
|
|
void InlineCallbackPasswordButton::write(std::ostream& os) const {
|
|
os << data;
|
|
}
|
|
|
|
InlineButton::ButtonType InlineLoginURLButton::getButtonType() const {
|
|
return ButtonType::LOGINURL;
|
|
}
|
|
|
|
void InlineLoginURLButton::write(std::ostream& os) const {
|
|
os << "url: " << url << " id: " << id << " fwdText: " << forwardText;
|
|
}
|
|
|
|
InlineButton::ButtonType InlineSwitchInlineButton::getButtonType() const {
|
|
return ButtonType::SWITCHINLINE;
|
|
}
|
|
|
|
void InlineSwitchInlineButton::write(std::ostream& os) const {
|
|
os << "query: " << query << " inCurrentChat: " << inCurrentChat;
|
|
}
|
|
|
|
InlineButton::ButtonType InlineURLButton::getButtonType() const {
|
|
return ButtonType::URL;
|
|
}
|
|
|
|
void InlineURLButton::write(std::ostream& os) const {
|
|
os << url;
|
|
}
|
|
|
|
InlineReplyMarkup::~InlineReplyMarkup() {
|
|
for(InlineButton* btn : buttons) {
|
|
delete btn;
|
|
}
|
|
} |