blob: 0fa1e397c296824a5d4e213914f77e141d6c4c34 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#include "user.h"
#include <json.hpp>
using nlohmann::json;
namespace twitter {
user::user() : _valid(false)
{
}
user::user(std::string data) : _valid(true)
{
auto _data = json::parse(data);
_id = _data.at("id");
_screen_name = _data.at("screen_name");
_name = _data.at("name");
}
user_id user::getID() const
{
return _id;
}
std::string user::getScreenName() const
{
return _screen_name;
}
std::string user::getName() const
{
return _name;
}
user::operator bool() const
{
return _valid;
}
bool user::operator==(const user& other) const
{
return _id == other._id;
}
bool user::operator!=(const user& other) const
{
return _id != other._id;
}
};
|