Cppgram  1.0.0
Easy and modern C++14 Telegram Bot API wrapper
photo_size.hpp
1 #ifndef CPPGRAM_PHOTO_SIZE_HPP
2 #define CPPGRAM_PHOTO_SIZE_HPP
3 
4 #include <experimental/optional>
5 #include <string>
6 
7 #include <json/json.h>
8 
9 namespace cppgram
10 {
11 namespace types
12 {
20 class PhotoSize
21 {
24  public:
26  std::string file_id;
27 
29  uint_fast32_t width,
30 
32  height;
33 
35  std::experimental::optional<uint32_t> file_size;
36 
37  PhotoSize( Json::Value &json_photo_size )
38  : file_id( json_photo_size["file_id"].asString() )
39  , width( json_photo_size["width"].asUInt() )
40  , height( json_photo_size["height"].asUInt() )
41  {
42  if ( !json_photo_size["file_size"].isNull() )
43  {
44  file_size.emplace( json_photo_size["file_size"].asUInt() );
45  }
46  };
47 };
48 }
49 }
50 
51 #endif
std::experimental::optional< uint32_t > file_size
Optional. File size
Definition: photo_size.hpp:35
A photo or thumbnail.
Definition: photo_size.hpp:20
std::string file_id
Unique identifier for this file.
Definition: photo_size.hpp:26
uint_fast32_t width
Photo width.
Definition: photo_size.hpp:29
main namespace for Cppgram
uint_fast32_t height
Photo height.
Definition: photo_size.hpp:29