From 8584857578c3a2946a03de98ff3803431143297a Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 30 Aug 2018 20:43:23 -0400 Subject: Refactored tweet and user classes The only API-visible change is that these classes are no longer default constructible. Other than that, tweet now uses hatkirby::recptr to wrap its retweeted_status (tweet) and author (user) member objects, removing the need to implement the Rule of Five. --- src/user.h | 94 ++++++++++++++++++++++++++------------------------------------ 1 file changed, 40 insertions(+), 54 deletions(-) (limited to 'src/user.h') diff --git a/src/user.h b/src/user.h index acd62d0..b743074 100644 --- a/src/user.h +++ b/src/user.h @@ -2,66 +2,52 @@ #define USER_H_BF3AB38C #include -#include -#include namespace twitter { - class client; - typedef unsigned long long user_id; class user { - public: - - user() {} - user(std::string data); - - user_id getID() const - { - assert(_valid); - - return _id; - } - - std::string getScreenName() const - { - assert(_valid); - - return _screen_name; - } - - std::string getName() const - { - assert(_valid); - - return _name; - } - - bool isProtected() const - { - assert(_valid); - - return _protected; - } - - bool operator==(const user& other) const - { - return _id == other._id; - } - - bool operator!=(const user& other) const - { - return _id != other._id; - } - - private: - - bool _valid = false; - user_id _id; - std::string _screen_name; - std::string _name; - bool _protected = false; + public: + + user(std::string data); + + user_id getID() const + { + return _id; + } + + std::string getScreenName() const + { + return _screen_name; + } + + std::string getName() const + { + return _name; + } + + bool isProtected() const + { + return _protected; + } + + bool operator==(const user& other) const + { + return _id == other._id; + } + + bool operator!=(const user& other) const + { + return _id != other._id; + } + + private: + + user_id _id; + std::string _screen_name; + std::string _name; + bool _protected = false; }; }; -- cgit 1.4.1