diff options
Diffstat (limited to 'src/user.h')
| -rw-r--r-- | src/user.h | 94 | 
1 files changed, 40 insertions, 54 deletions
| diff --git a/src/user.h b/src/user.h index acd62d0..b743074 100644 --- a/src/user.h +++ b/src/user.h | |||
| @@ -2,66 +2,52 @@ | |||
| 2 | #define USER_H_BF3AB38C | 2 | #define USER_H_BF3AB38C | 
| 3 | 3 | ||
| 4 | #include <string> | 4 | #include <string> | 
| 5 | #include <set> | ||
| 6 | #include <cassert> | ||
| 7 | 5 | ||
| 8 | namespace twitter { | 6 | namespace twitter { | 
| 9 | 7 | ||
| 10 | class client; | ||
| 11 | |||
| 12 | typedef unsigned long long user_id; | 8 | typedef unsigned long long user_id; | 
| 13 | 9 | ||
| 14 | class user { | 10 | class user { | 
| 15 | public: | 11 | public: | 
| 16 | 12 | ||
| 17 | user() {} | 13 | user(std::string data); | 
| 18 | user(std::string data); | 14 | |
| 19 | 15 | user_id getID() const | |
| 20 | user_id getID() const | 16 | { | 
| 21 | { | 17 | return _id; | 
| 22 | assert(_valid); | 18 | } | 
| 23 | 19 | ||
| 24 | return _id; | 20 | std::string getScreenName() const | 
| 25 | } | 21 | { | 
| 26 | 22 | return _screen_name; | |
| 27 | std::string getScreenName() const | 23 | } | 
| 28 | { | 24 | |
| 29 | assert(_valid); | 25 | std::string getName() const | 
| 30 | 26 | { | |
| 31 | return _screen_name; | 27 | return _name; | 
| 32 | } | 28 | } | 
| 33 | 29 | ||
| 34 | std::string getName() const | 30 | bool isProtected() const | 
| 35 | { | 31 | { | 
| 36 | assert(_valid); | 32 | return _protected; | 
| 37 | 33 | } | |
| 38 | return _name; | 34 | |
| 39 | } | 35 | bool operator==(const user& other) const | 
| 40 | 36 | { | |
| 41 | bool isProtected() const | 37 | return _id == other._id; | 
| 42 | { | 38 | } | 
| 43 | assert(_valid); | 39 | |
| 44 | 40 | bool operator!=(const user& other) const | |
| 45 | return _protected; | 41 | { | 
| 46 | } | 42 | return _id != other._id; | 
| 47 | 43 | } | |
| 48 | bool operator==(const user& other) const | 44 | |
| 49 | { | 45 | private: | 
| 50 | return _id == other._id; | 46 | |
| 51 | } | 47 | user_id _id; | 
| 52 | 48 | std::string _screen_name; | |
| 53 | bool operator!=(const user& other) const | 49 | std::string _name; | 
| 54 | { | 50 | bool _protected = false; | 
| 55 | return _id != other._id; | ||
| 56 | } | ||
| 57 | |||
| 58 | private: | ||
| 59 | |||
| 60 | bool _valid = false; | ||
| 61 | user_id _id; | ||
| 62 | std::string _screen_name; | ||
| 63 | std::string _name; | ||
| 64 | bool _protected = false; | ||
| 65 | }; | 51 | }; | 
| 66 | 52 | ||
| 67 | }; | 53 | }; | 
