From 4bcf6d116b92f5969714602ed082ff2a7263edde Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 20 May 2016 21:33:25 -0400 Subject: Added "retweeted" field to tweet --- src/tweet.cpp | 15 +++++++++++++++ src/tweet.h | 2 ++ 2 files changed, 17 insertions(+) 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 @@ #include "tweet.h" #include +#include using nlohmann::json; @@ -16,23 +17,37 @@ namespace twitter { _id = _data.at("id"); _text = _data.at("text"); _author = user(_data.at("user").dump()); + _retweeted = _data.at("retweeted"); } tweet_id tweet::getID() const { + assert(_valid); + return _id; } std::string tweet::getText() const { + assert(_valid); + return _text; } const user& tweet::getAuthor() const { + assert(_valid); + return _author; } + bool tweet::isRetweet() const + { + assert(_valid); + + return _retweeted; + } + tweet::operator bool() const { return _valid; diff --git a/src/tweet.h b/src/tweet.h index 137776c..fba1ced 100644 --- a/src/tweet.h +++ b/src/tweet.h @@ -16,6 +16,7 @@ namespace twitter { tweet_id getID() const; std::string getText() const; const user& getAuthor() const; + bool isRetweet() const; operator bool() const; @@ -24,6 +25,7 @@ namespace twitter { tweet_id _id; std::string _text; user _author; + bool _retweeted; }; }; -- cgit 1.4.1