From 7c44fd17bb6be54a2ea4b60761e91053ca988977 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 29 Nov 2016 16:18:25 -0500 Subject: Made tweets, users, and notifications into copyable objects Notifications are now also mutable. Users and tweets no longer have helper methods for interacting with the client. Fixed a bug (possibly introduced by a change to the Twitter API) that caused non-reply tweets to be marked as unknown notifications. --- src/notification.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) (limited to 'src/notification.h') diff --git a/src/notification.h b/src/notification.h index b5ecd49..a6dd6f4 100644 --- a/src/notification.h +++ b/src/notification.h @@ -88,25 +88,69 @@ namespace twitter { type getType() const; + notification() {} notification(const client& tclient, std::string data); + + notification(const notification& other); notification(notification&& other); - notification& operator=(notification&& other); + notification& operator=(notification other); ~notification(); - notification(const notification& other) = delete; - notification& operator=(const notification& other) = delete; + friend void swap(notification& first, notification& second); const tweet& getTweet() const; + tweet& getTweet() + { + return const_cast(static_cast(*this).getTweet()); + } + const user& getUser() const; + user& getUser() + { + return const_cast(static_cast(*this).getUser()); + } + const list& getList() const; + list& getList() + { + return const_cast(static_cast(*this).getList()); + } + tweet_id getTweetID() const; + void setTweetID(tweet_id _arg); + user_id getUserID() const; + void setUserID(user_id _arg); + const std::vector& getCountries() const; + std::vector& getCountries() + { + return const_cast&>(static_cast(*this).getCountries()); + } + disconnect_code getDisconnectCode() const; + void setDisconnectCode(disconnect_code _arg); + const std::set& getFriends() const; + std::set& getFriends() + { + return const_cast&>(static_cast(*this).getFriends()); + } + const direct_message& getDirectMessage() const; + direct_message& getDirectMessage() + { + return const_cast(static_cast(*this).getDirectMessage()); + } + int getLimit() const; + void setLimit(int _arg); + const std::string& getWarning() const; + std::string& getWarning() + { + return const_cast(static_cast(*this).getWarning()); + } private: union { @@ -140,7 +184,7 @@ namespace twitter { std::set _friends; direct_message _direct_message; }; - type _type; + type _type = type::invalid; }; }; -- cgit 1.4.1