diff options
Diffstat (limited to 'src/notification.h')
| -rw-r--r-- | src/notification.h | 192 |
1 files changed, 0 insertions, 192 deletions
| diff --git a/src/notification.h b/src/notification.h deleted file mode 100644 index ad649c3..0000000 --- a/src/notification.h +++ /dev/null | |||
| @@ -1,192 +0,0 @@ | |||
| 1 | #ifndef NOTIFICATION_H_69AEF4CC | ||
| 2 | #define NOTIFICATION_H_69AEF4CC | ||
| 3 | |||
| 4 | #include <string> | ||
| 5 | #include <vector> | ||
| 6 | #include <set> | ||
| 7 | #include "tweet.h" | ||
| 8 | #include "user.h" | ||
| 9 | #include "list.h" | ||
| 10 | #include "direct_message.h" | ||
| 11 | |||
| 12 | namespace twitter { | ||
| 13 | |||
| 14 | class client; | ||
| 15 | |||
| 16 | enum class disconnect_code | ||
| 17 | { | ||
| 18 | shutdown, | ||
| 19 | duplicate, | ||
| 20 | stall, | ||
| 21 | normal, | ||
| 22 | token_revoked, | ||
| 23 | admin_logout, | ||
| 24 | limit, | ||
| 25 | exception, | ||
| 26 | broker, | ||
| 27 | load, | ||
| 28 | unknown | ||
| 29 | }; | ||
| 30 | |||
| 31 | class notification { | ||
| 32 | public: | ||
| 33 | enum class type { | ||
| 34 | // Tweet object | ||
| 35 | tweet, | ||
| 36 | |||
| 37 | // User object | ||
| 38 | update_user, | ||
| 39 | block, | ||
| 40 | unblock, | ||
| 41 | follow, | ||
| 42 | followed, | ||
| 43 | unfollow, | ||
| 44 | |||
| 45 | // User and tweet | ||
| 46 | favorite, | ||
| 47 | favorited, | ||
| 48 | unfavorite, | ||
| 49 | unfavorited, | ||
| 50 | quoted, | ||
| 51 | |||
| 52 | // List | ||
| 53 | list_created, | ||
| 54 | list_destroyed, | ||
| 55 | list_updated, | ||
| 56 | |||
| 57 | // User and list | ||
| 58 | list_add, | ||
| 59 | list_added, | ||
| 60 | list_remove, | ||
| 61 | list_removed, | ||
| 62 | list_subscribe, | ||
| 63 | list_subscribed, | ||
| 64 | list_unsubscribe, | ||
| 65 | list_unsubscribed, | ||
| 66 | |||
| 67 | // Warning | ||
| 68 | stall, | ||
| 69 | follow_limit, | ||
| 70 | unknown_warning, | ||
| 71 | |||
| 72 | // User ID and tweet ID | ||
| 73 | deletion, | ||
| 74 | scrub_location, | ||
| 75 | |||
| 76 | // Special | ||
| 77 | limit, | ||
| 78 | withhold_status, | ||
| 79 | withhold_user, | ||
| 80 | disconnect, | ||
| 81 | friends, | ||
| 82 | direct, | ||
| 83 | |||
| 84 | // Nothing | ||
| 85 | unknown, | ||
| 86 | invalid | ||
| 87 | }; | ||
| 88 | |||
| 89 | type getType() const; | ||
| 90 | |||
| 91 | notification() {} | ||
| 92 | notification(const user& currentUser, std::string data); | ||
| 93 | |||
| 94 | notification(const notification& other); | ||
| 95 | notification(notification&& other); | ||
| 96 | notification& operator=(notification other); | ||
| 97 | ~notification(); | ||
| 98 | |||
| 99 | friend void swap(notification& first, notification& second); | ||
| 100 | |||
| 101 | const tweet& getTweet() const; | ||
| 102 | tweet& getTweet() | ||
| 103 | { | ||
| 104 | return const_cast<tweet&>(static_cast<const notification&>(*this).getTweet()); | ||
| 105 | } | ||
| 106 | |||
| 107 | const user& getUser() const; | ||
| 108 | user& getUser() | ||
| 109 | { | ||
| 110 | return const_cast<user&>(static_cast<const notification&>(*this).getUser()); | ||
| 111 | } | ||
| 112 | |||
| 113 | const list& getList() const; | ||
| 114 | list& getList() | ||
| 115 | { | ||
| 116 | return const_cast<list&>(static_cast<const notification&>(*this).getList()); | ||
| 117 | } | ||
| 118 | |||
| 119 | tweet_id getTweetID() const; | ||
| 120 | void setTweetID(tweet_id _arg); | ||
| 121 | |||
| 122 | user_id getUserID() const; | ||
| 123 | void setUserID(user_id _arg); | ||
| 124 | |||
| 125 | const std::vector<std::string>& getCountries() const; | ||
| 126 | std::vector<std::string>& getCountries() | ||
| 127 | { | ||
| 128 | return const_cast<std::vector<std::string>&>(static_cast<const notification&>(*this).getCountries()); | ||
| 129 | } | ||
| 130 | |||
| 131 | disconnect_code getDisconnectCode() const; | ||
| 132 | void setDisconnectCode(disconnect_code _arg); | ||
| 133 | |||
| 134 | const std::set<user_id>& getFriends() const; | ||
| 135 | std::set<user_id>& getFriends() | ||
| 136 | { | ||
| 137 | return const_cast<std::set<user_id>&>(static_cast<const notification&>(*this).getFriends()); | ||
| 138 | } | ||
| 139 | |||
| 140 | const direct_message& getDirectMessage() const; | ||
| 141 | direct_message& getDirectMessage() | ||
| 142 | { | ||
| 143 | return const_cast<direct_message&>(static_cast<const notification&>(*this).getDirectMessage()); | ||
| 144 | } | ||
| 145 | |||
| 146 | int getLimit() const; | ||
| 147 | void setLimit(int _arg); | ||
| 148 | |||
| 149 | const std::string& getWarning() const; | ||
| 150 | std::string& getWarning() | ||
| 151 | { | ||
| 152 | return const_cast<std::string&>(static_cast<const notification&>(*this).getWarning()); | ||
| 153 | } | ||
| 154 | |||
| 155 | private: | ||
| 156 | union { | ||
| 157 | tweet _tweet; | ||
| 158 | user _user; | ||
| 159 | list _list; | ||
| 160 | struct { | ||
| 161 | user _user; | ||
| 162 | tweet _tweet; | ||
| 163 | } _user_and_tweet; | ||
| 164 | struct { | ||
| 165 | user _user; | ||
| 166 | list _list; | ||
| 167 | } _user_and_list; | ||
| 168 | std::string _warning; | ||
| 169 | struct { | ||
| 170 | user_id _user_id; | ||
| 171 | tweet_id _tweet_id; | ||
| 172 | } _user_id_and_tweet_id; | ||
| 173 | int _limit; | ||
| 174 | struct { | ||
| 175 | user_id _user_id; | ||
| 176 | tweet_id _tweet_id; | ||
| 177 | std::vector<std::string> _countries; | ||
| 178 | } _withhold_status; | ||
| 179 | struct { | ||
| 180 | user_id _user_id; | ||
| 181 | std::vector<std::string> _countries; | ||
| 182 | } _withhold_user; | ||
| 183 | disconnect_code _disconnect; | ||
| 184 | std::set<user_id> _friends; | ||
| 185 | direct_message _direct_message; | ||
| 186 | }; | ||
| 187 | type _type = type::invalid; | ||
| 188 | }; | ||
| 189 | |||
| 190 | }; | ||
| 191 | |||
| 192 | #endif /* end of include guard: NOTIFICATION_H_69AEF4CC */ | ||
