diff options
Diffstat (limited to 'src/tweet.cpp')
-rw-r--r-- | src/tweet.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/tweet.cpp b/src/tweet.cpp index e515595..5885b51 100644 --- a/src/tweet.cpp +++ b/src/tweet.cpp | |||
@@ -1,5 +1,6 @@ | |||
1 | #include "tweet.h" | 1 | #include "tweet.h" |
2 | #include <json.hpp> | 2 | #include <json.hpp> |
3 | #include <cassert> | ||
3 | 4 | ||
4 | using nlohmann::json; | 5 | using nlohmann::json; |
5 | 6 | ||
@@ -16,23 +17,37 @@ namespace twitter { | |||
16 | _id = _data.at("id"); | 17 | _id = _data.at("id"); |
17 | _text = _data.at("text"); | 18 | _text = _data.at("text"); |
18 | _author = user(_data.at("user").dump()); | 19 | _author = user(_data.at("user").dump()); |
20 | _retweeted = _data.at("retweeted"); | ||
19 | } | 21 | } |
20 | 22 | ||
21 | tweet_id tweet::getID() const | 23 | tweet_id tweet::getID() const |
22 | { | 24 | { |
25 | assert(_valid); | ||
26 | |||
23 | return _id; | 27 | return _id; |
24 | } | 28 | } |
25 | 29 | ||
26 | std::string tweet::getText() const | 30 | std::string tweet::getText() const |
27 | { | 31 | { |
32 | assert(_valid); | ||
33 | |||
28 | return _text; | 34 | return _text; |
29 | } | 35 | } |
30 | 36 | ||
31 | const user& tweet::getAuthor() const | 37 | const user& tweet::getAuthor() const |
32 | { | 38 | { |
39 | assert(_valid); | ||
40 | |||
33 | return _author; | 41 | return _author; |
34 | } | 42 | } |
35 | 43 | ||
44 | bool tweet::isRetweet() const | ||
45 | { | ||
46 | assert(_valid); | ||
47 | |||
48 | return _retweeted; | ||
49 | } | ||
50 | |||
36 | tweet::operator bool() const | 51 | tweet::operator bool() const |
37 | { | 52 | { |
38 | return _valid; | 53 | return _valid; |