1 #pragma once 2 3 #include "simdjson.h" 4 #include "twitter_user.h" 5 6 namespace partial_tweets { 7 8 // { 9 // "statuses": [ 10 // { 11 // "created_at": "Sun Aug 31 00:29:15 +0000 2014", 12 // "id": 505874924095815700, 13 // "text": "@aym0566x \n\n名前:前田あゆみ\n第一印象:なんか怖っ!\n今の印象:とりあえずキモい。噛み合わない\n好きなところ:ぶすでキモいとこ✨✨\n思い出:んーーー、ありすぎ❤️\nLINE交換できる?:あぁ……ごめん✋\nトプ画をみて:照れますがな✨\n一言:お前は一生もんのダチ", 14 // "in_reply_to_status_id": null, 15 // "user": { 16 // "id": 1186275104, 17 // "screen_name": "ayuu0123" 18 // }, 19 // "retweet_count": 0, 20 // "favorite_count": 0 21 // } 22 // ] 23 // } 24 25 template<typename StringType=std::string_view> 26 struct tweet { 27 StringType created_at{}; 28 uint64_t id{}; 29 StringType result{}; 30 uint64_t in_reply_to_status_id{}; 31 twitter_user<StringType> user{}; 32 uint64_t retweet_count{}; 33 uint64_t favorite_count{}; 34 template<typename OtherStringType> 35 simdjson_really_inline bool operator==(const tweet<OtherStringType> &other) const { 36 return created_at == other.created_at && 37 id == other.id && 38 result == other.result && 39 in_reply_to_status_id == other.in_reply_to_status_id && 40 user == other.user && 41 retweet_count == other.retweet_count && 42 favorite_count == other.favorite_count; 43 } 44 template<typename OtherStringType> 45 simdjson_really_inline bool operator!=(const tweet<OtherStringType> &other) const { return !(*this == other); } 46 }; 47 48 template<typename StringType> 49 simdjson_unused static std::ostream &operator<<(std::ostream &o, const tweet<StringType> &t) { 50 o << "created_at: " << t.created_at << std::endl; 51 o << "id: " << t.id << std::endl; 52 o << "result: " << t.result << std::endl; 53 o << "in_reply_to_status_id: " << t.in_reply_to_status_id << std::endl; 54 o << "user.id: " << t.user.id << std::endl; 55 o << "user.screen_name: " << t.user.screen_name << std::endl; 56 o << "retweet_count: " << t.retweet_count << std::endl; 57 o << "favorite_count: " << t.favorite_count << std::endl; 58 return o; 59 } 60 61 } // namespace partial_tweets 62