diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-08-20 13:56:23 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-08-20 13:56:23 -0400 |
commit | 69fc8d805396b889b5e8c1c88e8129d93db77d29 (patch) | |
tree | 6b807bd9332c65b65066e247d4d00fd5e4118d2e /src/user.h | |
parent | 442f1ee071152be04c4184473ddfee5040795b76 (diff) | |
download | libtwittercpp-69fc8d805396b889b5e8c1c88e8129d93db77d29.tar.gz libtwittercpp-69fc8d805396b889b5e8c1c88e8129d93db77d29.tar.bz2 libtwittercpp-69fc8d805396b889b5e8c1c88e8129d93db77d29.zip |
Updated API to use exceptions and make tweet/user objects more helpful
Diffstat (limited to 'src/user.h')
-rw-r--r-- | src/user.h | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/src/user.h b/src/user.h index 1d8be99..f08840b 100644 --- a/src/user.h +++ b/src/user.h | |||
@@ -2,26 +2,52 @@ | |||
2 | #define USER_H_BF3AB38C | 2 | #define USER_H_BF3AB38C |
3 | 3 | ||
4 | #include <string> | 4 | #include <string> |
5 | #include <set> | ||
5 | 6 | ||
6 | namespace twitter { | 7 | namespace twitter { |
7 | 8 | ||
9 | class client; | ||
10 | |||
8 | typedef unsigned long long user_id; | 11 | typedef unsigned long long user_id; |
9 | 12 | ||
10 | class user { | 13 | class user { |
11 | public: | 14 | public: |
12 | user(); | ||
13 | user(std::string data); | ||
14 | 15 | ||
15 | user_id getID() const; | 16 | user(const client& tclient, std::string data); |
16 | std::string getScreenName() const; | 17 | |
17 | std::string getName() const; | 18 | user_id getID() const |
19 | { | ||
20 | return _id; | ||
21 | } | ||
22 | |||
23 | std::string getScreenName() const | ||
24 | { | ||
25 | return _screen_name; | ||
26 | } | ||
27 | |||
28 | std::string getName() const | ||
29 | { | ||
30 | return _name; | ||
31 | } | ||
18 | 32 | ||
19 | operator bool() const; | 33 | bool operator==(const user& other) const |
20 | bool operator==(const user& other) const; | 34 | { |
21 | bool operator!=(const user& other) const; | 35 | return _id == other._id; |
36 | } | ||
37 | |||
38 | bool operator!=(const user& other) const | ||
39 | { | ||
40 | return _id != other._id; | ||
41 | } | ||
42 | |||
43 | std::set<user_id> getFriends() const; | ||
44 | std::set<user_id> getFollowers() const; | ||
45 | void follow() const; | ||
46 | void unfollow() const; | ||
22 | 47 | ||
23 | private: | 48 | private: |
24 | bool _valid = false; | 49 | |
50 | const client& _client; | ||
25 | user_id _id; | 51 | user_id _id; |
26 | std::string _screen_name; | 52 | std::string _screen_name; |
27 | std::string _name; | 53 | std::string _name; |