tgbot-cpp
Loading...
Searching...
No Matches
TgTypeParser.h
Go to the documentation of this file.
1#ifndef TGBOT_TGTYPEPARSER_H
2#define TGBOT_TGTYPEPARSER_H
3
4#include "tgbot/export.h"
7#include "tgbot/types/User.h"
8#include "tgbot/types/Chat.h"
23#include "tgbot/types/Audio.h"
25#include "tgbot/types/Story.h"
26#include "tgbot/types/Video.h"
28#include "tgbot/types/Voice.h"
29#include "tgbot/types/Contact.h"
30#include "tgbot/types/Dice.h"
33#include "tgbot/types/Poll.h"
35#include "tgbot/types/Venue.h"
60#include "tgbot/types/File.h"
109#include "tgbot/types/BotName.h"
133#include "tgbot/types/Sticker.h"
169#include "tgbot/types/Invoice.h"
190#include "tgbot/types/Game.h"
194
195#include <boost/property_tree/json_parser.hpp>
196#include <boost/property_tree/ptree.hpp>
197
198#include <memory>
199#include <sstream>
200#include <string>
201#include <utility>
202#include <vector>
203
204namespace TgBot {
205
206class TGBOT_API TgTypeParser {
207
208public:
209 template<typename T>
210 using JsonToTgTypeFunc = std::shared_ptr<T> (TgTypeParser::*)(const boost::property_tree::ptree&) const;
211
212 template<typename T>
213 using TgTypeToJsonFunc = std::string (TgTypeParser::*)(const std::shared_ptr<T>&) const;
214
215 Update::Ptr parseJsonAndGetUpdate(const boost::property_tree::ptree& data) const;
216 std::string parseUpdate(const Update::Ptr& object) const;
217
218 WebhookInfo::Ptr parseJsonAndGetWebhookInfo(const boost::property_tree::ptree& data) const;
219 std::string parseWebhookInfo(const WebhookInfo::Ptr& object) const;
220
221 User::Ptr parseJsonAndGetUser(const boost::property_tree::ptree& data) const;
222 std::string parseUser(const User::Ptr& object) const;
223
224 Chat::Ptr parseJsonAndGetChat(const boost::property_tree::ptree& data) const;
225 std::string parseChat(const Chat::Ptr& object) const;
226
227 Message::Ptr parseJsonAndGetMessage(const boost::property_tree::ptree& data) const;
228 std::string parseMessage(const Message::Ptr& object) const;
229
230 MessageId::Ptr parseJsonAndGetMessageId(const boost::property_tree::ptree& data) const;
231 std::string parseMessageId(const MessageId::Ptr& object) const;
232
233 InaccessibleMessage::Ptr parseJsonAndGetInaccessibleMessage(const boost::property_tree::ptree& data) const;
234 std::string parseInaccessibleMessage(const InaccessibleMessage::Ptr& object) const;
235
236 MessageEntity::Ptr parseJsonAndGetMessageEntity(const boost::property_tree::ptree& data) const;
237 std::string parseMessageEntity(const MessageEntity::Ptr& object) const;
238
239 TextQuote::Ptr parseJsonAndGetTextQuote(const boost::property_tree::ptree& data) const;
240 std::string parseTextQuote(const TextQuote::Ptr& object) const;
241
242 ExternalReplyInfo::Ptr parseJsonAndGetExternalReplyInfo(const boost::property_tree::ptree& data) const;
243 std::string parseExternalReplyInfo(const ExternalReplyInfo::Ptr& object) const;
244
245 ReplyParameters::Ptr parseJsonAndGetReplyParameters(const boost::property_tree::ptree& data) const;
246 std::string parseReplyParameters(const ReplyParameters::Ptr& object) const;
247
248 MessageOrigin::Ptr parseJsonAndGetMessageOrigin(const boost::property_tree::ptree& data) const;
249 std::string parseMessageOrigin(const MessageOrigin::Ptr& object) const;
250
251 MessageOriginUser::Ptr parseJsonAndGetMessageOriginUser(const boost::property_tree::ptree& data) const;
252 std::string parseMessageOriginUser(const MessageOriginUser::Ptr& object) const;
253
254 MessageOriginHiddenUser::Ptr parseJsonAndGetMessageOriginHiddenUser(const boost::property_tree::ptree& data) const;
255 std::string parseMessageOriginHiddenUser(const MessageOriginHiddenUser::Ptr& object) const;
256
257 MessageOriginChat::Ptr parseJsonAndGetMessageOriginChat(const boost::property_tree::ptree& data) const;
258 std::string parseMessageOriginChat(const MessageOriginChat::Ptr& object) const;
259
260 MessageOriginChannel::Ptr parseJsonAndGetMessageOriginChannel(const boost::property_tree::ptree& data) const;
261 std::string parseMessageOriginChannel(const MessageOriginChannel::Ptr& object) const;
262
263 PhotoSize::Ptr parseJsonAndGetPhotoSize(const boost::property_tree::ptree& data) const;
264 std::string parsePhotoSize(const PhotoSize::Ptr& object) const;
265
266 Animation::Ptr parseJsonAndGetAnimation(const boost::property_tree::ptree& data) const;
267 std::string parseAnimation(const Animation::Ptr& object) const;
268
269 Audio::Ptr parseJsonAndGetAudio(const boost::property_tree::ptree& data) const;
270 std::string parseAudio(const Audio::Ptr& object) const;
271
272 Document::Ptr parseJsonAndGetDocument(const boost::property_tree::ptree& data) const;
273 std::string parseDocument(const Document::Ptr& object) const;
274
275 Story::Ptr parseJsonAndGetStory(const boost::property_tree::ptree& data) const;
276 std::string parseStory(const Story::Ptr& object) const;
277
278 Video::Ptr parseJsonAndGetVideo(const boost::property_tree::ptree& data) const;
279 std::string parseVideo(const Video::Ptr& object) const;
280
281 VideoNote::Ptr parseJsonAndGetVideoNote(const boost::property_tree::ptree& data) const;
282 std::string parseVideoNote(const VideoNote::Ptr& object) const;
283
284 Voice::Ptr parseJsonAndGetVoice(const boost::property_tree::ptree& data) const;
285 std::string parseVoice(const Voice::Ptr& object) const;
286
287 Contact::Ptr parseJsonAndGetContact(const boost::property_tree::ptree& data) const;
288 std::string parseContact(const Contact::Ptr& object) const;
289
290 Dice::Ptr parseJsonAndGetDice(const boost::property_tree::ptree& data) const;
291 std::string parseDice(const Dice::Ptr& object) const;
292
293 PollOption::Ptr parseJsonAndGetPollOption(const boost::property_tree::ptree& data) const;
294 std::string parsePollOption(const PollOption::Ptr& object) const;
295
296 PollAnswer::Ptr parseJsonAndGetPollAnswer(const boost::property_tree::ptree& data) const;
297 std::string parsePollAnswer(const PollAnswer::Ptr& object) const;
298
299 Poll::Ptr parseJsonAndGetPoll(const boost::property_tree::ptree& data) const;
300 std::string parsePoll(const Poll::Ptr& object) const;
301
302 Location::Ptr parseJsonAndGetLocation(const boost::property_tree::ptree& data) const;
303 std::string parseLocation(const Location::Ptr& object) const;
304
305 Venue::Ptr parseJsonAndGetVenue(const boost::property_tree::ptree& data) const;
306 std::string parseVenue(const Venue::Ptr& object) const;
307
308 WebAppData::Ptr parseJsonAndGetWebAppData(const boost::property_tree::ptree& data) const;
309 std::string parseWebAppData(const WebAppData::Ptr& object) const;
310
311 ProximityAlertTriggered::Ptr parseJsonAndGetProximityAlertTriggered(const boost::property_tree::ptree& data) const;
312 std::string parseProximityAlertTriggered(const ProximityAlertTriggered::Ptr& object) const;
313
314 MessageAutoDeleteTimerChanged::Ptr parseJsonAndGetMessageAutoDeleteTimerChanged(const boost::property_tree::ptree& data) const;
315 std::string parseMessageAutoDeleteTimerChanged(const MessageAutoDeleteTimerChanged::Ptr& object) const;
316
317 ChatBoostAdded::Ptr parseJsonAndGetChatBoostAdded(const boost::property_tree::ptree& data) const;
318 std::string parseChatBoostAdded(const ChatBoostAdded::Ptr& object) const;
319
320 ForumTopicCreated::Ptr parseJsonAndGetForumTopicCreated(const boost::property_tree::ptree& data) const;
321 std::string parseForumTopicCreated(const ForumTopicCreated::Ptr& object) const;
322
323 ForumTopicClosed::Ptr parseJsonAndGetForumTopicClosed(const boost::property_tree::ptree& data) const;
324 std::string parseForumTopicClosed(const ForumTopicClosed::Ptr& object) const;
325
326 ForumTopicEdited::Ptr parseJsonAndGetForumTopicEdited(const boost::property_tree::ptree& data) const;
327 std::string parseForumTopicEdited(const ForumTopicEdited::Ptr& object) const;
328
329 ForumTopicReopened::Ptr parseJsonAndGetForumTopicReopened(const boost::property_tree::ptree& data) const;
330 std::string parseForumTopicReopened(const ForumTopicReopened::Ptr& object) const;
331
332 GeneralForumTopicHidden::Ptr parseJsonAndGetGeneralForumTopicHidden(const boost::property_tree::ptree& data) const;
333 std::string parseGeneralForumTopicHidden(const GeneralForumTopicHidden::Ptr& object) const;
334
335 GeneralForumTopicUnhidden::Ptr parseJsonAndGetGeneralForumTopicUnhidden(const boost::property_tree::ptree& data) const;
336 std::string parseGeneralForumTopicUnhidden(const GeneralForumTopicUnhidden::Ptr& object) const;
337
338 SharedUser::Ptr parseJsonAndGetSharedUser(const boost::property_tree::ptree& data) const;
339 std::string parseSharedUser(const SharedUser::Ptr& object) const;
340
341 UsersShared::Ptr parseJsonAndGetUsersShared(const boost::property_tree::ptree& data) const;
342 std::string parseUsersShared(const UsersShared::Ptr& object) const;
343
344 ChatShared::Ptr parseJsonAndGetChatShared(const boost::property_tree::ptree& data) const;
345 std::string parseChatShared(const ChatShared::Ptr& object) const;
346
347 WriteAccessAllowed::Ptr parseJsonAndGetWriteAccessAllowed(const boost::property_tree::ptree& data) const;
348 std::string parseWriteAccessAllowed(const WriteAccessAllowed::Ptr& object) const;
349
350 VideoChatScheduled::Ptr parseJsonAndGetVideoChatScheduled(const boost::property_tree::ptree& data) const;
351 std::string parseVideoChatScheduled(const VideoChatScheduled::Ptr& object) const;
352
353 VideoChatStarted::Ptr parseJsonAndGetVideoChatStarted(const boost::property_tree::ptree& data) const;
354 std::string parseVideoChatStarted(const VideoChatStarted::Ptr& object) const;
355
356 VideoChatEnded::Ptr parseJsonAndGetVideoChatEnded(const boost::property_tree::ptree& data) const;
357 std::string parseVideoChatEnded(const VideoChatEnded::Ptr& object) const;
358
359 VideoChatParticipantsInvited::Ptr parseJsonAndGetVideoChatParticipantsInvited(const boost::property_tree::ptree& data) const;
360 std::string parseVideoChatParticipantsInvited(const VideoChatParticipantsInvited::Ptr& object) const;
361
362 GiveawayCreated::Ptr parseJsonAndGetGiveawayCreated(const boost::property_tree::ptree& data) const;
363 std::string parseGiveawayCreated(const GiveawayCreated::Ptr& object) const;
364
365 Giveaway::Ptr parseJsonAndGetGiveaway(const boost::property_tree::ptree& data) const;
366 std::string parseGiveaway(const Giveaway::Ptr& object) const;
367
368 GiveawayWinners::Ptr parseJsonAndGetGiveawayWinners(const boost::property_tree::ptree& data) const;
369 std::string parseGiveawayWinners(const GiveawayWinners::Ptr& object) const;
370
371 GiveawayCompleted::Ptr parseJsonAndGetGiveawayCompleted(const boost::property_tree::ptree& data) const;
372 std::string parseGiveawayCompleted(const GiveawayCompleted::Ptr& object) const;
373
374 LinkPreviewOptions::Ptr parseJsonAndGetLinkPreviewOptions(const boost::property_tree::ptree& data) const;
375 std::string parseLinkPreviewOptions(const LinkPreviewOptions::Ptr& object) const;
376
377 UserProfilePhotos::Ptr parseJsonAndGetUserProfilePhotos(const boost::property_tree::ptree& data) const;
378 std::string parseUserProfilePhotos(const UserProfilePhotos::Ptr& object) const;
379
380 File::Ptr parseJsonAndGetFile(const boost::property_tree::ptree& data) const;
381 std::string parseFile(const File::Ptr& object) const;
382
383 WebAppInfo::Ptr parseJsonAndGetWebAppInfo(const boost::property_tree::ptree& data) const;
384 std::string parseWebAppInfo(const WebAppInfo::Ptr& object) const;
385
386 ReplyKeyboardMarkup::Ptr parseJsonAndGetReplyKeyboardMarkup(const boost::property_tree::ptree& data) const;
387 std::string parseReplyKeyboardMarkup(const ReplyKeyboardMarkup::Ptr& object) const;
388
389 KeyboardButton::Ptr parseJsonAndGetKeyboardButton(const boost::property_tree::ptree& data) const;
390 std::string parseKeyboardButton(const KeyboardButton::Ptr& object) const;
391
392 KeyboardButtonRequestUsers::Ptr parseJsonAndGetKeyboardButtonRequestUsers(const boost::property_tree::ptree& data) const;
393 std::string parseKeyboardButtonRequestUsers(const KeyboardButtonRequestUsers::Ptr& object) const;
394
395 KeyboardButtonRequestChat::Ptr parseJsonAndGetKeyboardButtonRequestChat(const boost::property_tree::ptree& data) const;
396 std::string parseKeyboardButtonRequestChat(const KeyboardButtonRequestChat::Ptr& object) const;
397
398 KeyboardButtonPollType::Ptr parseJsonAndGetKeyboardButtonPollType(const boost::property_tree::ptree& data) const;
399 std::string parseKeyboardButtonPollType(const KeyboardButtonPollType::Ptr& object) const;
400
401 ReplyKeyboardRemove::Ptr parseJsonAndGetReplyKeyboardRemove(const boost::property_tree::ptree& data) const;
402 std::string parseReplyKeyboardRemove(const ReplyKeyboardRemove::Ptr& object) const;
403
404 InlineKeyboardMarkup::Ptr parseJsonAndGetInlineKeyboardMarkup(const boost::property_tree::ptree& data) const;
405 std::string parseInlineKeyboardMarkup(const InlineKeyboardMarkup::Ptr& object) const;
406
407 InlineKeyboardButton::Ptr parseJsonAndGetInlineKeyboardButton(const boost::property_tree::ptree& data) const;
408 std::string parseInlineKeyboardButton(const InlineKeyboardButton::Ptr& object) const;
409
410 LoginUrl::Ptr parseJsonAndGetLoginUrl(const boost::property_tree::ptree& data) const;
411 std::string parseLoginUrl(const LoginUrl::Ptr& object) const;
412
413 SwitchInlineQueryChosenChat::Ptr parseJsonAndGetSwitchInlineQueryChosenChat(const boost::property_tree::ptree& data) const;
414 std::string parseSwitchInlineQueryChosenChat(const SwitchInlineQueryChosenChat::Ptr& object) const;
415
416 CallbackQuery::Ptr parseJsonAndGetCallbackQuery(const boost::property_tree::ptree& data) const;
417 std::string parseCallbackQuery(const CallbackQuery::Ptr& object) const;
418
419 ForceReply::Ptr parseJsonAndGetForceReply(const boost::property_tree::ptree& data) const;
420 std::string parseForceReply(const ForceReply::Ptr& object) const;
421
422 ChatPhoto::Ptr parseJsonAndGetChatPhoto(const boost::property_tree::ptree& data) const;
423 std::string parseChatPhoto(const ChatPhoto::Ptr& object) const;
424
425 ChatInviteLink::Ptr parseJsonAndGetChatInviteLink(const boost::property_tree::ptree& data) const;
426 std::string parseChatInviteLink(const ChatInviteLink::Ptr& object) const;
427
428 ChatAdministratorRights::Ptr parseJsonAndGetChatAdministratorRights(const boost::property_tree::ptree& data) const;
429 std::string parseChatAdministratorRights(const ChatAdministratorRights::Ptr& object) const;
430
431 ChatMemberUpdated::Ptr parseJsonAndGetChatMemberUpdated(const boost::property_tree::ptree& data) const;
432 std::string parseChatMemberUpdated(const ChatMemberUpdated::Ptr& object) const;
433
434 ChatMember::Ptr parseJsonAndGetChatMember(const boost::property_tree::ptree& data) const;
435 std::string parseChatMember(const ChatMember::Ptr& object) const;
436
437 ChatMemberOwner::Ptr parseJsonAndGetChatMemberOwner(const boost::property_tree::ptree& data) const;
438 std::string parseChatMemberOwner(const ChatMemberOwner::Ptr& object) const;
439
440 ChatMemberAdministrator::Ptr parseJsonAndGetChatMemberAdministrator(const boost::property_tree::ptree& data) const;
441 std::string parseChatMemberAdministrator(const ChatMemberAdministrator::Ptr& object) const;
442
443 ChatMemberMember::Ptr parseJsonAndGetChatMemberMember(const boost::property_tree::ptree& data) const;
444 std::string parseChatMemberMember(const ChatMemberMember::Ptr& object) const;
445
446 ChatMemberRestricted::Ptr parseJsonAndGetChatMemberRestricted(const boost::property_tree::ptree& data) const;
447 std::string parseChatMemberRestricted(const ChatMemberRestricted::Ptr& object) const;
448
449 ChatMemberLeft::Ptr parseJsonAndGetChatMemberLeft(const boost::property_tree::ptree& data) const;
450 std::string parseChatMemberLeft(const ChatMemberLeft::Ptr& object) const;
451
452 ChatMemberBanned::Ptr parseJsonAndGetChatMemberBanned(const boost::property_tree::ptree& data) const;
453 std::string parseChatMemberBanned(const ChatMemberBanned::Ptr& object) const;
454
455 ChatJoinRequest::Ptr parseJsonAndGetChatJoinRequest(const boost::property_tree::ptree& data) const;
456 std::string parseChatJoinRequest(const ChatJoinRequest::Ptr& object) const;
457
458 ChatPermissions::Ptr parseJsonAndGetChatPermissions(const boost::property_tree::ptree& data) const;
459 std::string parseChatPermissions(const ChatPermissions::Ptr& object) const;
460
461 Birthdate::Ptr parseJsonAndGetBirthdate(const boost::property_tree::ptree& data) const;
462 std::string parseBirthdate(const Birthdate::Ptr& object) const;
463
464 BusinessIntro::Ptr parseJsonAndGetBusinessIntro(const boost::property_tree::ptree& data) const;
465 std::string parseBusinessIntro(const BusinessIntro::Ptr& object) const;
466
467 BusinessLocation::Ptr parseJsonAndGetBusinessLocation(const boost::property_tree::ptree& data) const;
468 std::string parseBusinessLocation(const BusinessLocation::Ptr& object) const;
469
470 BusinessOpeningHoursInterval::Ptr parseJsonAndGetBusinessOpeningHoursInterval(const boost::property_tree::ptree& data) const;
471 std::string parseBusinessOpeningHoursInterval(const BusinessOpeningHoursInterval::Ptr& object) const;
472
473 BusinessOpeningHours::Ptr parseJsonAndGetBusinessOpeningHours(const boost::property_tree::ptree& data) const;
474 std::string parseBusinessOpeningHours(const BusinessOpeningHours::Ptr& object) const;
475
476 ChatLocation::Ptr parseJsonAndGetChatLocation(const boost::property_tree::ptree& data) const;
477 std::string parseChatLocation(const ChatLocation::Ptr& object) const;
478
479 ReactionType::Ptr parseJsonAndGetReactionType(const boost::property_tree::ptree& data) const;
480 std::string parseReactionType(const ReactionType::Ptr& object) const;
481
482 ReactionTypeEmoji::Ptr parseJsonAndGetReactionTypeEmoji(const boost::property_tree::ptree& data) const;
483 std::string parseReactionTypeEmoji(const ReactionTypeEmoji::Ptr& object) const;
484
485 ReactionTypeCustomEmoji::Ptr parseJsonAndGetReactionTypeCustomEmoji(const boost::property_tree::ptree& data) const;
486 std::string parseReactionTypeCustomEmoji(const ReactionTypeCustomEmoji::Ptr& object) const;
487
488 ReactionCount::Ptr parseJsonAndGetReactionCount(const boost::property_tree::ptree& data) const;
489 std::string parseReactionCount(const ReactionCount::Ptr& object) const;
490
491 MessageReactionUpdated::Ptr parseJsonAndGetMessageReactionUpdated(const boost::property_tree::ptree& data) const;
492 std::string parseMessageReactionUpdated(const MessageReactionUpdated::Ptr& object) const;
493
494 MessageReactionCountUpdated::Ptr parseJsonAndGetMessageReactionCountUpdated(const boost::property_tree::ptree& data) const;
495 std::string parseMessageReactionCountUpdated(const MessageReactionCountUpdated::Ptr& object) const;
496
497 ForumTopic::Ptr parseJsonAndGetForumTopic(const boost::property_tree::ptree& data) const;
498 std::string parseForumTopic(const ForumTopic::Ptr& object) const;
499
500 BotCommand::Ptr parseJsonAndGetBotCommand(const boost::property_tree::ptree& data) const;
501 std::string parseBotCommand(const BotCommand::Ptr& object) const;
502
503 BotCommandScope::Ptr parseJsonAndGetBotCommandScope(const boost::property_tree::ptree& data) const;
504 std::string parseBotCommandScope(const BotCommandScope::Ptr& object) const;
505
506 BotCommandScopeDefault::Ptr parseJsonAndGetBotCommandScopeDefault(const boost::property_tree::ptree& data) const;
507 std::string parseBotCommandScopeDefault(const BotCommandScopeDefault::Ptr& object) const;
508
509 BotCommandScopeAllPrivateChats::Ptr parseJsonAndGetBotCommandScopeAllPrivateChats(const boost::property_tree::ptree& data) const;
510 std::string parseBotCommandScopeAllPrivateChats(const BotCommandScopeAllPrivateChats::Ptr& object) const;
511
512 BotCommandScopeAllGroupChats::Ptr parseJsonAndGetBotCommandScopeAllGroupChats(const boost::property_tree::ptree& data) const;
513 std::string parseBotCommandScopeAllGroupChats(const BotCommandScopeAllGroupChats::Ptr& object) const;
514
515 BotCommandScopeAllChatAdministrators::Ptr parseJsonAndGetBotCommandScopeAllChatAdministrators(const boost::property_tree::ptree& data) const;
516 std::string parseBotCommandScopeAllChatAdministrators(const BotCommandScopeAllChatAdministrators::Ptr& object) const;
517
518 BotCommandScopeChat::Ptr parseJsonAndGetBotCommandScopeChat(const boost::property_tree::ptree& data) const;
519 std::string parseBotCommandScopeChat(const BotCommandScopeChat::Ptr& object) const;
520
521 BotCommandScopeChatAdministrators::Ptr parseJsonAndGetBotCommandScopeChatAdministrators(const boost::property_tree::ptree& data) const;
522 std::string parseBotCommandScopeChatAdministrators(const BotCommandScopeChatAdministrators::Ptr& object) const;
523
524 BotCommandScopeChatMember::Ptr parseJsonAndGetBotCommandScopeChatMember(const boost::property_tree::ptree& data) const;
525 std::string parseBotCommandScopeChatMember(const BotCommandScopeChatMember::Ptr& object) const;
526
527 BotName::Ptr parseJsonAndGetBotName(const boost::property_tree::ptree& data) const;
528 std::string parseBotName(const BotName::Ptr& object) const;
529
530 BotDescription::Ptr parseJsonAndGetBotDescription(const boost::property_tree::ptree& data) const;
531 std::string parseBotDescription(const BotDescription::Ptr& object) const;
532
533 BotShortDescription::Ptr parseJsonAndGetBotShortDescription(const boost::property_tree::ptree& data) const;
534 std::string parseBotShortDescription(const BotShortDescription::Ptr& object) const;
535
536 MenuButton::Ptr parseJsonAndGetMenuButton(const boost::property_tree::ptree& data) const;
537 std::string parseMenuButton(const MenuButton::Ptr& object) const;
538
539 MenuButtonCommands::Ptr parseJsonAndGetMenuButtonCommands(const boost::property_tree::ptree& data) const;
540 std::string parseMenuButtonCommands(const MenuButtonCommands::Ptr& object) const;
541
542 MenuButtonWebApp::Ptr parseJsonAndGetMenuButtonWebApp(const boost::property_tree::ptree& data) const;
543 std::string parseMenuButtonWebApp(const MenuButtonWebApp::Ptr& object) const;
544
545 MenuButtonDefault::Ptr parseJsonAndGetMenuButtonDefault(const boost::property_tree::ptree& data) const;
546 std::string parseMenuButtonDefault(const MenuButtonDefault::Ptr& object) const;
547
548 ChatBoostSource::Ptr parseJsonAndGetChatBoostSource(const boost::property_tree::ptree& data) const;
549 std::string parseChatBoostSource(const ChatBoostSource::Ptr& object) const;
550
551 ChatBoostSourcePremium::Ptr parseJsonAndGetChatBoostSourcePremium(const boost::property_tree::ptree& data) const;
552 std::string parseChatBoostSourcePremium(const ChatBoostSourcePremium::Ptr& object) const;
553
554 ChatBoostSourceGiftCode::Ptr parseJsonAndGetChatBoostSourceGiftCode(const boost::property_tree::ptree& data) const;
555 std::string parseChatBoostSourceGiftCode(const ChatBoostSourceGiftCode::Ptr& object) const;
556
557 ChatBoostSourceGiveaway::Ptr parseJsonAndGetChatBoostSourceGiveaway(const boost::property_tree::ptree& data) const;
558 std::string parseChatBoostSourceGiveaway(const ChatBoostSourceGiveaway::Ptr& object) const;
559
560 ChatBoost::Ptr parseJsonAndGetChatBoost(const boost::property_tree::ptree& data) const;
561 std::string parseChatBoost(const ChatBoost::Ptr& object) const;
562
563 ChatBoostUpdated::Ptr parseJsonAndGetChatBoostUpdated(const boost::property_tree::ptree& data) const;
564 std::string parseChatBoostUpdated(const ChatBoostUpdated::Ptr& object) const;
565
566 ChatBoostRemoved::Ptr parseJsonAndGetChatBoostRemoved(const boost::property_tree::ptree& data) const;
567 std::string parseChatBoostRemoved(const ChatBoostRemoved::Ptr& object) const;
568
569 UserChatBoosts::Ptr parseJsonAndGetUserChatBoosts(const boost::property_tree::ptree& data) const;
570 std::string parseUserChatBoosts(const UserChatBoosts::Ptr& object) const;
571
572 BusinessConnection::Ptr parseJsonAndGetBusinessConnection(const boost::property_tree::ptree& data) const;
573 std::string parseBusinessConnection(const BusinessConnection::Ptr& object) const;
574
575 BusinessMessagesDeleted::Ptr parseJsonAndGetBusinessMessagesDeleted(const boost::property_tree::ptree& data) const;
576 std::string parseBusinessMessagesDeleted(const BusinessMessagesDeleted::Ptr& object) const;
577
578 ResponseParameters::Ptr parseJsonAndGetResponseParameters(const boost::property_tree::ptree& data) const;
579 std::string parseResponseParameters(const ResponseParameters::Ptr& object) const;
580
581 InputMedia::Ptr parseJsonAndGetInputMedia(const boost::property_tree::ptree& data) const;
582 std::string parseInputMedia(const InputMedia::Ptr& object) const;
583
584 InputMediaPhoto::Ptr parseJsonAndGetInputMediaPhoto(const boost::property_tree::ptree& data) const;
585 std::string parseInputMediaPhoto(const InputMediaPhoto::Ptr& object) const;
586
587 InputMediaVideo::Ptr parseJsonAndGetInputMediaVideo(const boost::property_tree::ptree& data) const;
588 std::string parseInputMediaVideo(const InputMediaVideo::Ptr& object) const;
589
590 InputMediaAnimation::Ptr parseJsonAndGetInputMediaAnimation(const boost::property_tree::ptree& data) const;
591 std::string parseInputMediaAnimation(const InputMediaAnimation::Ptr& object) const;
592
593 InputMediaAudio::Ptr parseJsonAndGetInputMediaAudio(const boost::property_tree::ptree& data) const;
594 std::string parseInputMediaAudio(const InputMediaAudio::Ptr& object) const;
595
596 InputMediaDocument::Ptr parseJsonAndGetInputMediaDocument(const boost::property_tree::ptree& data) const;
597 std::string parseInputMediaDocument(const InputMediaDocument::Ptr& object) const;
598
599 Sticker::Ptr parseJsonAndGetSticker(const boost::property_tree::ptree& data) const;
600 std::string parseSticker(const Sticker::Ptr& object) const;
601
602 StickerSet::Ptr parseJsonAndGetStickerSet(const boost::property_tree::ptree& data) const;
603 std::string parseStickerSet(const StickerSet::Ptr& object) const;
604
605 MaskPosition::Ptr parseJsonAndGetMaskPosition(const boost::property_tree::ptree& data) const;
606 std::string parseMaskPosition(const MaskPosition::Ptr& object) const;
607
608 InputSticker::Ptr parseJsonAndGetInputSticker(const boost::property_tree::ptree& data) const;
609 std::string parseInputSticker(const InputSticker::Ptr& object) const;
610
611 InlineQuery::Ptr parseJsonAndGetInlineQuery(const boost::property_tree::ptree& data) const;
612 std::string parseInlineQuery(const InlineQuery::Ptr& object) const;
613
614 InlineQueryResultsButton::Ptr parseJsonAndGetInlineQueryResultsButton(const boost::property_tree::ptree& data) const;
615 std::string parseInlineQueryResultsButton(const InlineQueryResultsButton::Ptr& object) const;
616
617 InlineQueryResult::Ptr parseJsonAndGetInlineQueryResult(const boost::property_tree::ptree& data) const;
618 std::string parseInlineQueryResult(const InlineQueryResult::Ptr& object) const;
619
620 InlineQueryResultArticle::Ptr parseJsonAndGetInlineQueryResultArticle(const boost::property_tree::ptree& data) const;
621 std::string parseInlineQueryResultArticle(const InlineQueryResultArticle::Ptr& object) const;
622
623 InlineQueryResultPhoto::Ptr parseJsonAndGetInlineQueryResultPhoto(const boost::property_tree::ptree& data) const;
624 std::string parseInlineQueryResultPhoto(const InlineQueryResultPhoto::Ptr& object) const;
625
626 InlineQueryResultGif::Ptr parseJsonAndGetInlineQueryResultGif(const boost::property_tree::ptree& data) const;
627 std::string parseInlineQueryResultGif(const InlineQueryResultGif::Ptr& object) const;
628
629 InlineQueryResultMpeg4Gif::Ptr parseJsonAndGetInlineQueryResultMpeg4Gif(const boost::property_tree::ptree& data) const;
630 std::string parseInlineQueryResultMpeg4Gif(const InlineQueryResultMpeg4Gif::Ptr& object) const;
631
632 InlineQueryResultVideo::Ptr parseJsonAndGetInlineQueryResultVideo(const boost::property_tree::ptree& data) const;
633 std::string parseInlineQueryResultVideo(const InlineQueryResultVideo::Ptr& object) const;
634
635 InlineQueryResultAudio::Ptr parseJsonAndGetInlineQueryResultAudio(const boost::property_tree::ptree& data) const;
636 std::string parseInlineQueryResultAudio(const InlineQueryResultAudio::Ptr& object) const;
637
638 InlineQueryResultVoice::Ptr parseJsonAndGetInlineQueryResultVoice(const boost::property_tree::ptree& data) const;
639 std::string parseInlineQueryResultVoice(const InlineQueryResultVoice::Ptr& object) const;
640
641 InlineQueryResultDocument::Ptr parseJsonAndGetInlineQueryResultDocument(const boost::property_tree::ptree& data) const;
642 std::string parseInlineQueryResultDocument(const InlineQueryResultDocument::Ptr& object) const;
643
644 InlineQueryResultLocation::Ptr parseJsonAndGetInlineQueryResultLocation(const boost::property_tree::ptree& data) const;
645 std::string parseInlineQueryResultLocation(const InlineQueryResultLocation::Ptr& object) const;
646
647 InlineQueryResultVenue::Ptr parseJsonAndGetInlineQueryResultVenue(const boost::property_tree::ptree& data) const;
648 std::string parseInlineQueryResultVenue(const InlineQueryResultVenue::Ptr& object) const;
649
650 InlineQueryResultContact::Ptr parseJsonAndGetInlineQueryResultContact(const boost::property_tree::ptree& data) const;
651 std::string parseInlineQueryResultContact(const InlineQueryResultContact::Ptr& object) const;
652
653 InlineQueryResultGame::Ptr parseJsonAndGetInlineQueryResultGame(const boost::property_tree::ptree& data) const;
654 std::string parseInlineQueryResultGame(const InlineQueryResultGame::Ptr& object) const;
655
656 InlineQueryResultCachedPhoto::Ptr parseJsonAndGetInlineQueryResultCachedPhoto(const boost::property_tree::ptree& data) const;
657 std::string parseInlineQueryResultCachedPhoto(const InlineQueryResultCachedPhoto::Ptr& object) const;
658
659 InlineQueryResultCachedGif::Ptr parseJsonAndGetInlineQueryResultCachedGif(const boost::property_tree::ptree& data) const;
660 std::string parseInlineQueryResultCachedGif(const InlineQueryResultCachedGif::Ptr& object) const;
661
662 InlineQueryResultCachedMpeg4Gif::Ptr parseJsonAndGetInlineQueryResultCachedMpeg4Gif(const boost::property_tree::ptree& data) const;
663 std::string parseInlineQueryResultCachedMpeg4Gif(const InlineQueryResultCachedMpeg4Gif::Ptr& object) const;
664
665 InlineQueryResultCachedSticker::Ptr parseJsonAndGetInlineQueryResultCachedSticker(const boost::property_tree::ptree& data) const;
666 std::string parseInlineQueryResultCachedSticker(const InlineQueryResultCachedSticker::Ptr& object) const;
667
668 InlineQueryResultCachedDocument::Ptr parseJsonAndGetInlineQueryResultCachedDocument(const boost::property_tree::ptree& data) const;
669 std::string parseInlineQueryResultCachedDocument(const InlineQueryResultCachedDocument::Ptr& object) const;
670
671 InlineQueryResultCachedVideo::Ptr parseJsonAndGetInlineQueryResultCachedVideo(const boost::property_tree::ptree& data) const;
672 std::string parseInlineQueryResultCachedVideo(const InlineQueryResultCachedVideo::Ptr& object) const;
673
674 InlineQueryResultCachedVoice::Ptr parseJsonAndGetInlineQueryResultCachedVoice(const boost::property_tree::ptree& data) const;
675 std::string parseInlineQueryResultCachedVoice(const InlineQueryResultCachedVoice::Ptr& object) const;
676
677 InlineQueryResultCachedAudio::Ptr parseJsonAndGetInlineQueryResultCachedAudio(const boost::property_tree::ptree& data) const;
678 std::string parseInlineQueryResultCachedAudio(const InlineQueryResultCachedAudio::Ptr& object) const;
679
680 InputMessageContent::Ptr parseJsonAndGetInputMessageContent(const boost::property_tree::ptree& data) const;
681 std::string parseInputMessageContent(const InputMessageContent::Ptr& object) const;
682
683 InputTextMessageContent::Ptr parseJsonAndGetInputTextMessageContent(const boost::property_tree::ptree& data) const;
684 std::string parseInputTextMessageContent(const InputTextMessageContent::Ptr& object) const;
685
686 InputLocationMessageContent::Ptr parseJsonAndGetInputLocationMessageContent(const boost::property_tree::ptree& data) const;
687 std::string parseInputLocationMessageContent(const InputLocationMessageContent::Ptr& object) const;
688
689 InputVenueMessageContent::Ptr parseJsonAndGetInputVenueMessageContent(const boost::property_tree::ptree& data) const;
690 std::string parseInputVenueMessageContent(const InputVenueMessageContent::Ptr& object) const;
691
692 InputContactMessageContent::Ptr parseJsonAndGetInputContactMessageContent(const boost::property_tree::ptree& data) const;
693 std::string parseInputContactMessageContent(const InputContactMessageContent::Ptr& object) const;
694
695 InputInvoiceMessageContent::Ptr parseJsonAndGetInputInvoiceMessageContent(const boost::property_tree::ptree& data) const;
696 std::string parseInputInvoiceMessageContent(const InputInvoiceMessageContent::Ptr& object) const;
697
698 ChosenInlineResult::Ptr parseJsonAndGetChosenInlineResult(const boost::property_tree::ptree& data) const;
699 std::string parseChosenInlineResult(const ChosenInlineResult::Ptr& object) const;
700
701 SentWebAppMessage::Ptr parseJsonAndGetSentWebAppMessage(const boost::property_tree::ptree& data) const;
702 std::string parseSentWebAppMessage(const SentWebAppMessage::Ptr& object) const;
703
704 LabeledPrice::Ptr parseJsonAndGetLabeledPrice(const boost::property_tree::ptree& data) const;
705 std::string parseLabeledPrice(const LabeledPrice::Ptr& object) const;
706
707 Invoice::Ptr parseJsonAndGetInvoice(const boost::property_tree::ptree& data) const;
708 std::string parseInvoice(const Invoice::Ptr& object) const;
709
710 ShippingAddress::Ptr parseJsonAndGetShippingAddress(const boost::property_tree::ptree& data) const;
711 std::string parseShippingAddress(const ShippingAddress::Ptr& object) const;
712
713 OrderInfo::Ptr parseJsonAndGetOrderInfo(const boost::property_tree::ptree& data) const;
714 std::string parseOrderInfo(const OrderInfo::Ptr& object) const;
715
716 ShippingOption::Ptr parseJsonAndGetShippingOption(const boost::property_tree::ptree& data) const;
717 std::string parseShippingOption(const ShippingOption::Ptr& object) const;
718
719 SuccessfulPayment::Ptr parseJsonAndGetSuccessfulPayment(const boost::property_tree::ptree& data) const;
720 std::string parseSuccessfulPayment(const SuccessfulPayment::Ptr& object) const;
721
722 ShippingQuery::Ptr parseJsonAndGetShippingQuery(const boost::property_tree::ptree& data) const;
723 std::string parseShippingQuery(const ShippingQuery::Ptr& object) const;
724
725 PreCheckoutQuery::Ptr parseJsonAndGetPreCheckoutQuery(const boost::property_tree::ptree& data) const;
726 std::string parsePreCheckoutQuery(const PreCheckoutQuery::Ptr& object) const;
727
728 PassportData::Ptr parseJsonAndGetPassportData(const boost::property_tree::ptree& data) const;
729 std::string parsePassportData(const PassportData::Ptr& object) const;
730
731 PassportFile::Ptr parseJsonAndGetPassportFile(const boost::property_tree::ptree& data) const;
732 std::string parsePassportFile(const PassportFile::Ptr& object) const;
733
734 EncryptedPassportElement::Ptr parseJsonAndGetEncryptedPassportElement(const boost::property_tree::ptree& data) const;
735 std::string parseEncryptedPassportElement(const EncryptedPassportElement::Ptr& object) const;
736
737 EncryptedCredentials::Ptr parseJsonAndGetEncryptedCredentials(const boost::property_tree::ptree& data) const;
738 std::string parseEncryptedCredentials(const EncryptedCredentials::Ptr& object) const;
739
740 PassportElementError::Ptr parseJsonAndGetPassportElementError(const boost::property_tree::ptree& data) const;
741 std::string parsePassportElementError(const PassportElementError::Ptr& object) const;
742
743 PassportElementErrorDataField::Ptr parseJsonAndGetPassportElementErrorDataField(const boost::property_tree::ptree& data) const;
744 std::string parsePassportElementErrorDataField(const PassportElementErrorDataField::Ptr& object) const;
745
746 PassportElementErrorFrontSide::Ptr parseJsonAndGetPassportElementErrorFrontSide(const boost::property_tree::ptree& data) const;
747 std::string parsePassportElementErrorFrontSide(const PassportElementErrorFrontSide::Ptr& object) const;
748
749 PassportElementErrorReverseSide::Ptr parseJsonAndGetPassportElementErrorReverseSide(const boost::property_tree::ptree& data) const;
750 std::string parsePassportElementErrorReverseSide(const PassportElementErrorReverseSide::Ptr& object) const;
751
752 PassportElementErrorSelfie::Ptr parseJsonAndGetPassportElementErrorSelfie(const boost::property_tree::ptree& data) const;
753 std::string parsePassportElementErrorSelfie(const PassportElementErrorSelfie::Ptr& object) const;
754
755 PassportElementErrorFile::Ptr parseJsonAndGetPassportElementErrorFile(const boost::property_tree::ptree& data) const;
756 std::string parsePassportElementErrorFile(const PassportElementErrorFile::Ptr& object) const;
757
758 PassportElementErrorFiles::Ptr parseJsonAndGetPassportElementErrorFiles(const boost::property_tree::ptree& data) const;
759 std::string parsePassportElementErrorFiles(const PassportElementErrorFiles::Ptr& object) const;
760
761 PassportElementErrorTranslationFile::Ptr parseJsonAndGetPassportElementErrorTranslationFile(const boost::property_tree::ptree& data) const;
762 std::string parsePassportElementErrorTranslationFile(const PassportElementErrorTranslationFile::Ptr& object) const;
763
764 PassportElementErrorTranslationFiles::Ptr parseJsonAndGetPassportElementErrorTranslationFiles(const boost::property_tree::ptree& data) const;
765 std::string parsePassportElementErrorTranslationFiles(const PassportElementErrorTranslationFiles::Ptr& object) const;
766
767 PassportElementErrorUnspecified::Ptr parseJsonAndGetPassportElementErrorUnspecified(const boost::property_tree::ptree& data) const;
768 std::string parsePassportElementErrorUnspecified(const PassportElementErrorUnspecified::Ptr& object) const;
769
770 Game::Ptr parseJsonAndGetGame(const boost::property_tree::ptree& data) const;
771 std::string parseGame(const Game::Ptr& object) const;
772
773 CallbackGame::Ptr parseJsonAndGetCallbackGame(const boost::property_tree::ptree& data) const;
774 std::string parseCallbackGame(const CallbackGame::Ptr& object) const;
775
776 GameHighScore::Ptr parseJsonAndGetGameHighScore(const boost::property_tree::ptree& data) const;
777 std::string parseGameHighScore(const GameHighScore::Ptr& object) const;
778
779 GenericReply::Ptr parseJsonAndGetGenericReply(const boost::property_tree::ptree& data) const;
780 std::string parseGenericReply(const GenericReply::Ptr& object) const;
781
782 inline boost::property_tree::ptree parseJson(const std::string& json) const {
783 boost::property_tree::ptree tree;
784 std::istringstream input(json);
785 boost::property_tree::read_json(input, tree);
786 return tree;
787 }
788
789 template<typename T>
790 std::shared_ptr<T> tryParseJson(JsonToTgTypeFunc<T> parseFunc, const boost::property_tree::ptree& data, const std::string& keyName) const {
791 auto treeItem = data.find(keyName);
792 if (treeItem == data.not_found()) {
793 return std::shared_ptr<T>();
794 }
795 return (this->*parseFunc)(treeItem->second);
796 }
797
798 template<typename T>
799 std::vector<std::shared_ptr<T>> parseJsonAndGetArray(JsonToTgTypeFunc<T> parseFunc, const boost::property_tree::ptree& data) const {
800 std::vector<std::shared_ptr<T>> result;
801 result.reserve(data.size());
802 for (const std::pair<const std::string, boost::property_tree::ptree>& innerTreeItem : data) {
803 result.push_back((this->*parseFunc)(innerTreeItem.second));
804 }
805 return result;
806 }
807
808 template<typename T>
809 std::vector<T> parseJsonAndGetArray(std::function<T(const boost::property_tree::ptree&)> parseFunc, const boost::property_tree::ptree& data, const std::string& keyName) const {
810 std::vector<T> result;
811 auto treeItem = data.find(keyName);
812 if (treeItem == data.not_found()) {
813 return result;
814 }
815 result.reserve(treeItem->second.size());
816 for (const std::pair<const std::string, boost::property_tree::ptree>& innerTreeItem : treeItem->second) {
817 result.push_back(parseFunc(innerTreeItem.second));
818 }
819 return result;
820 }
821
822 template<typename T>
823 std::vector<std::shared_ptr<T>> parseJsonAndGetArray(JsonToTgTypeFunc<T> parseFunc, const boost::property_tree::ptree& data, const std::string& keyName) const {
824 std::vector<std::shared_ptr<T>> result;
825 auto treeItem = data.find(keyName);
826 if (treeItem == data.not_found()) {
827 return result;
828 }
829 result.reserve(treeItem->second.size());
830 for (const std::pair<const std::string, boost::property_tree::ptree>& innerTreeItem : treeItem->second) {
831 result.push_back((this->*parseFunc)(innerTreeItem.second));
832 }
833 return result;
834 }
835
836 template<typename T>
837 std::vector<std::vector<std::shared_ptr<T>>> parseJsonAndGet2DArray(JsonToTgTypeFunc<T> parseFunc, const boost::property_tree::ptree& data, const std::string& keyName) const {
838 std::vector<std::vector<std::shared_ptr<T>>> result;
839 auto treeItem = data.find(keyName);
840 if (treeItem == data.not_found()) {
841 return result;
842 }
843 result.reserve(treeItem->second.size());
844 for (const std::pair<const std::string, boost::property_tree::ptree>& innerTreeItem : treeItem->second) {
845 std::vector<std::shared_ptr<T>> innerResult;
846 for (const std::pair<const std::string, boost::property_tree::ptree>& innerInnerTreeItem : innerTreeItem.second) {
847 innerResult.push_back((this->*parseFunc)(innerInnerTreeItem.second));
848 }
849 result.push_back(innerResult);
850 }
851 return result;
852 }
853
854 template<typename T>
855 std::string parseArray(TgTypeToJsonFunc<T> parseFunc, const std::vector<std::shared_ptr<T>>& objects) const {
856 if (objects.empty())
857 return "";
858 std::string result;
859 result += '[';
860 for (const std::shared_ptr<T>& item : objects) {
861 result += (this->*parseFunc)(item);
862 result += ',';
863 }
864 result.erase(result.length() - 1);
865 result += ']';
866 return result;
867 }
868
869 template<typename T>
870 std::string parseArray(std::function<T(const T&)> parseFunc, const std::vector<T>& objects) const {
871 if (objects.empty())
872 return "";
873 std::string result;
874 result += '[';
875 for (const T& item : objects) {
876 result += parseFunc(item);
877 result += ',';
878 }
879 result.erase(result.length() - 1);
880 result += ']';
881 return result;
882 }
883
884 template<typename T>
885 std::string parse2DArray(TgTypeToJsonFunc<T> parseFunc, const std::vector<std::vector<std::shared_ptr<T>>>& objects) const {
886 if (objects.empty())
887 return "";
888 std::string result;
889 result += '[';
890 for (const std::vector<std::shared_ptr<T>>& item : objects) {
891 result += parseArray(parseFunc, item);
892 result += ',';
893 }
894 result.erase(result.length() - 1);
895 result += ']';
896 return result;
897 }
898
899private:
900 inline void removeLastComma(std::string& input) const {
901 input.erase(input.length() - 1);
902 }
903
904 template<typename T>
905 inline void appendToJson(std::string& json, const std::string& varName, const std::shared_ptr<T>& value) const {
906 if (value == nullptr) {
907 return;
908 }
909 json += '"';
910 json += varName;
911 json += R"(":)";
912 json += value;
913 json += ',';
914 }
915
916 template<typename T>
917 inline void appendToJson(std::string& json, const std::string& varName, const T& value) const {
918 json += '"';
919 json += varName;
920 json += R"(":)";
921 json += value;
922 json += ',';
923 }
924
925 template<typename T>
926 inline void appendToJsonNumber(std::string& json, const std::string& varName, const T& value) const {
927 json += '"';
928 json += varName;
929 json += R"(":)";
930 json += std::to_string(value);
931 json += ',';
932 }
933
934 inline void appendToJson(std::string &json, const std::string &varName, const int &value) const { appendToJsonNumber(json, varName, value); }
935 inline void appendToJson(std::string &json, const std::string &varName, const long &value) const { appendToJsonNumber(json, varName, value); }
936 inline void appendToJson(std::string &json, const std::string &varName, const long long &value) const { appendToJsonNumber(json, varName, value); }
937 inline void appendToJson(std::string &json, const std::string &varName, const unsigned &value) const { appendToJsonNumber(json, varName, value); }
938 inline void appendToJson(std::string &json, const std::string &varName, const unsigned long &value) const { appendToJsonNumber(json, varName, value); }
939 inline void appendToJson(std::string &json, const std::string &varName, const unsigned long long &value) const { appendToJsonNumber(json, varName, value); }
940 inline void appendToJson(std::string &json, const std::string &varName, const float &value) const { appendToJsonNumber(json, varName, value); }
941 inline void appendToJson(std::string &json, const std::string &varName, const double &value) const { appendToJsonNumber(json, varName, value); }
942 inline void appendToJson(std::string &json, const std::string &varName, const long double &value) const { appendToJsonNumber(json, varName, value); }
943
944 inline void appendToJson(std::string& json, const std::string& varName, const bool& value) const {
945 json += '"';
946 json += varName;
947 json += R"(":)";
948 json += (value ? "true" : "false");
949 json += ',';
950 }
951
952 inline void appendToJson(std::string& json, const std::string& varName, const char* value) const {
953 if (value != nullptr){
954 std::string strValue(value);
955 appendToJson(json, varName, strValue);
956 }
957 }
958
959 void appendToJson(std::string& json, const std::string& varName, const std::string& value) const;
960};
961}
962
963#endif //TGBOT_TGTYPEPARSER_H
Definition Api.h:40