about summary refs log tree commit diff stats
path: root/src/user.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-08-06 16:06:12 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-08-06 16:06:12 -0400
commitbc893794c5e7ec1a968c00a8538241278e8c8d34 (patch)
tree0dbf0f46880c7c0ae093707ef7ec8a7b04ebd016 /src/user.h
parentb7bb942cadfe3d657895af1557b78acc2559947e (diff)
downloadlibtwittercpp-bc893794c5e7ec1a968c00a8538241278e8c8d34.tar.gz
libtwittercpp-bc893794c5e7ec1a968c00a8538241278e8c8d34.tar.bz2
libtwittercpp-bc893794c5e7ec1a968c00a8538241278e8c8d34.zip
User objects now contain whether the user is protected
Diffstat (limited to 'src/user.h')
-rw-r--r--src/user.h38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/user.h b/src/user.h index ef7d72e..acd62d0 100644 --- a/src/user.h +++ b/src/user.h
@@ -6,56 +6,64 @@
6#include <cassert> 6#include <cassert>
7 7
8namespace twitter { 8namespace twitter {
9 9
10 class client; 10 class client;
11 11
12 typedef unsigned long long user_id; 12 typedef unsigned long long user_id;
13 13
14 class user { 14 class user {
15 public: 15 public:
16 16
17 user() {} 17 user() {}
18 user(std::string data); 18 user(std::string data);
19 19
20 user_id getID() const 20 user_id getID() const
21 { 21 {
22 assert(_valid); 22 assert(_valid);
23 23
24 return _id; 24 return _id;
25 } 25 }
26 26
27 std::string getScreenName() const 27 std::string getScreenName() const
28 { 28 {
29 assert(_valid); 29 assert(_valid);
30 30
31 return _screen_name; 31 return _screen_name;
32 } 32 }
33 33
34 std::string getName() const 34 std::string getName() const
35 { 35 {
36 assert(_valid); 36 assert(_valid);
37 37
38 return _name; 38 return _name;
39 } 39 }
40 40
41 bool isProtected() const
42 {
43 assert(_valid);
44
45 return _protected;
46 }
47
41 bool operator==(const user& other) const 48 bool operator==(const user& other) const
42 { 49 {
43 return _id == other._id; 50 return _id == other._id;
44 } 51 }
45 52
46 bool operator!=(const user& other) const 53 bool operator!=(const user& other) const
47 { 54 {
48 return _id != other._id; 55 return _id != other._id;
49 } 56 }
50 57
51 private: 58 private:
52 59
53 bool _valid = false; 60 bool _valid = false;
54 user_id _id; 61 user_id _id;
55 std::string _screen_name; 62 std::string _screen_name;
56 std::string _name; 63 std::string _name;
64 bool _protected = false;
57 }; 65 };
58 66
59}; 67};
60 68
61#endif /* end of include guard: USER_H_BF3AB38C */ 69#endif /* end of include guard: USER_H_BF3AB38C */