diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-05-22 21:25:29 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-05-22 21:25:29 -0400 |
commit | ac260cef3c8c035e3975a8c412553b25cb2b6c06 (patch) | |
tree | ef4b7ab7f981d4c31b36b8146cc66d7ad2f723bf /src/tweet.h | |
parent | 62f6aae6c313b2a2a493c5147ec831a66eba01ff (diff) | |
download | libtwittercpp-ac260cef3c8c035e3975a8c412553b25cb2b6c06.tar.gz libtwittercpp-ac260cef3c8c035e3975a8c412553b25cb2b6c06.tar.bz2 libtwittercpp-ac260cef3c8c035e3975a8c412553b25cb2b6c06.zip |
Fixed retweet detection
Because a retweet is a tweet referenced from another tweet, the current implementation dynamically allocates memory for the retweeted status and has to manually copy the pointed to data around. It's not a very pretty implementation and may get tweaked at some point soon. I don't like having to implement the big five.
Diffstat (limited to 'src/tweet.h')
-rw-r--r-- | src/tweet.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/tweet.h b/src/tweet.h index 34a9cd7..387f73a 100644 --- a/src/tweet.h +++ b/src/tweet.h | |||
@@ -14,11 +14,18 @@ namespace twitter { | |||
14 | public: | 14 | public: |
15 | tweet(); | 15 | tweet(); |
16 | tweet(std::string data); | 16 | tweet(std::string data); |
17 | tweet(const tweet& other); | ||
18 | tweet(tweet&& other); | ||
19 | ~tweet(); | ||
20 | |||
21 | tweet& operator=(tweet other); | ||
22 | friend void swap(tweet& first, tweet& second); | ||
17 | 23 | ||
18 | tweet_id getID() const; | 24 | tweet_id getID() const; |
19 | std::string getText() const; | 25 | std::string getText() const; |
20 | const user& getAuthor() const; | 26 | const user& getAuthor() const; |
21 | bool isRetweet() const; | 27 | bool isRetweet() const; |
28 | tweet getRetweet() const; | ||
22 | std::vector<std::pair<user_id, std::string>> getMentions() const; | 29 | std::vector<std::pair<user_id, std::string>> getMentions() const; |
23 | 30 | ||
24 | operator bool() const; | 31 | operator bool() const; |
@@ -28,7 +35,8 @@ namespace twitter { | |||
28 | tweet_id _id; | 35 | tweet_id _id; |
29 | std::string _text; | 36 | std::string _text; |
30 | user _author; | 37 | user _author; |
31 | bool _retweeted; | 38 | bool _is_retweet = false; |
39 | tweet* _retweeted_status = nullptr; | ||
32 | std::vector<std::pair<user_id, std::string>> _mentions; | 40 | std::vector<std::pair<user_id, std::string>> _mentions; |
33 | }; | 41 | }; |
34 | 42 | ||