Cppgram  1.0.0
Easy and modern C++14 Telegram Bot API wrapper
keyboard.hpp
1 #ifndef CPPGRAM_INLINE_KEYBOARD_HPP
2 #define CPPGRAM_INLINE_KEYBOARD_HPP
3 
4 #include <string>
5 #include <vector>
6 
7 #include <json/json.h>
8 
9 namespace cppgram
10 {
11 namespace types
12 {
13 class KeyboardButton;
14 }
15 
16 enum EButton : short;
17 
33 class Keyboard
34 {
35  public:
40  Keyboard();
41 
49  bool addButton( const std::string &text, const std::string &data, const EButton &button_type );
50 
56  bool addButton( const types::KeyboardButton &new_button );
57 
63  bool addButton( const std::vector<types::KeyboardButton> &new_buttons );
64 
69  unsigned short changeRow();
70 
74  inline void clearKeyboard() { inline_keyboard.clear(); };
81  void get( std::string &reply_markup, const bool &clear_keyboard = true );
82 
89  // inline Json::Value get() const { return inline_keyboard; };
90  private:
91  Json::FastWriter writer;
92  Json::Value inline_keyboard;
93  unsigned short column;
94  unsigned short row;
95 };
96 
98 }
99 
100 #endif
Json::FastWriter writer
Get keyboard as Json.
Definition: keyboard.hpp:91
An helper class to create inline keyboard.
Definition: keyboard.hpp:33
EButton
Type of the inlineKeyboardButton to add in the reply markup.
Definition: enums.hpp:80
main namespace for Cppgram
Class for creating Inline keyboard json_button.
Definition: keyboard_button.hpp:21
void clearKeyboard()
Clear the inline keyboard of the object.
Definition: keyboard.hpp:74