about summary refs log tree commit diff stats
path: root/src/user.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2016-11-29 16:18:25 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2016-11-29 16:18:25 -0500
commit7c44fd17bb6be54a2ea4b60761e91053ca988977 (patch)
tree42f08e0db610617fd0629b117610bfa1a365acaf /src/user.h
parentd90a1e74c77ba67f25a812609fd49d479bc464dd (diff)
downloadlibtwittercpp-7c44fd17bb6be54a2ea4b60761e91053ca988977.tar.gz
libtwittercpp-7c44fd17bb6be54a2ea4b60761e91053ca988977.tar.bz2
libtwittercpp-7c44fd17bb6be54a2ea4b60761e91053ca988977.zip
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.
Diffstat (limited to 'src/user.h')
-rw-r--r--src/user.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/user.h b/src/user.h index f08840b..ef7d72e 100644 --- a/src/user.h +++ b/src/user.h
@@ -3,6 +3,7 @@
3 3
4#include <string> 4#include <string>
5#include <set> 5#include <set>
6#include <cassert>
6 7
7namespace twitter { 8namespace twitter {
8 9
@@ -13,20 +14,27 @@ namespace twitter {
13 class user { 14 class user {
14 public: 15 public:
15 16
16 user(const client& tclient, std::string data); 17 user() {}
18 user(std::string data);
17 19
18 user_id getID() const 20 user_id getID() const
19 { 21 {
22 assert(_valid);
23
20 return _id; 24 return _id;
21 } 25 }
22 26
23 std::string getScreenName() const 27 std::string getScreenName() const
24 { 28 {
29 assert(_valid);
30
25 return _screen_name; 31 return _screen_name;
26 } 32 }
27 33
28 std::string getName() const 34 std::string getName() const
29 { 35 {
36 assert(_valid);
37
30 return _name; 38 return _name;
31 } 39 }
32 40
@@ -40,14 +48,9 @@ namespace twitter {
40 return _id != other._id; 48 return _id != other._id;
41 } 49 }
42 50
43 std::set<user_id> getFriends() const;
44 std::set<user_id> getFollowers() const;
45 void follow() const;
46 void unfollow() const;
47
48 private: 51 private:
49 52
50 const client& _client; 53 bool _valid = false;
51 user_id _id; 54 user_id _id;
52 std::string _screen_name; 55 std::string _screen_name;
53 std::string _name; 56 std::string _name;