yatbcpp
0.0.1
Yet another Telegram Bot CPP Library
src
types_fromJson
Venue_fromJson.cc
Go to the documentation of this file.
1
// From JSON Specialication //
4
#include <jsoncpp/json/json.h>
5
#include "
types/telegram_type.h
"
6
#include "
exceptions/essential_key_missing.h
"
7
#include "
types/Venue.h
"
8
9
using namespace
std
;
10
11
namespace
yatbcpp
{
17
template
<>
Venue
fromJson
(Json::Value Data) {
18
if
(!Data.isMember(
"location"
)) {
19
throw
essential_key_missing
(
"Venue::location is missing"
);
20
}
21
if
(!Data.isMember(
"title"
)) {
22
throw
essential_key_missing
(
"Venue::title is missing"
);
23
}
24
if
(!Data.isMember(
"address"
)) {
25
throw
essential_key_missing
(
"Venue::address is missing"
);
26
}
27
28
Location
location = fromJson<Location>(Data[
"location"
]);
29
string
title = Data[
"title"
].asString();
30
string
address = Data[
"address"
].asString();
31
32
Venue
ret(location, title, address);
33
34
if
(Data.isMember(
"foursquare_id"
)) {
35
ret.
setFoursquare_id
(Data[
"foursquare_id"
].asString());
36
}
37
38
return
ret;
39
}
40
41
}
yatbcpp::essential_key_missing
Definition:
essential_key_missing.h:12
yatbcpp::fromJson
Venue fromJson(Json::Value Data)
Definition:
Venue_fromJson.cc:17
yatbcpp::Venue::setFoursquare_id
void setFoursquare_id(const std::optional< std::string > &foursquare_id)
Definition:
Venue.cc:29
std
Venue.h
yatbcpp
Definition:
Bot.h:27
yatbcpp::Location
Definition:
Location.h:6
telegram_type.h
essential_key_missing.h
yatbcpp::Venue
Definition:
Venue.h:14
Generated by
1.8.13