Better MessageContentType output to StringBuilder.

GitOrigin-RevId: f755a36dc462db448a7ca584f8e061b161d3defd
This commit is contained in:
levlam 2018-09-22 02:29:33 +03:00
parent a4d5cc9419
commit a23d62905b
2 changed files with 91 additions and 4 deletions

View File

@ -3602,6 +3602,96 @@ class MessagesManager::UploadDialogPhotoCallback : public FileManager::UploadCal
}
};
StringBuilder &operator<<(StringBuilder &string_builder, MessageContentType content_type) {
switch (content_type) {
case MessageContentType::None:
return string_builder << "None";
case MessageContentType::Animation:
return string_builder << "Animation";
case MessageContentType::Audio:
return string_builder << "Audio";
case MessageContentType::Document:
return string_builder << "Document";
case MessageContentType::ExpiredPhoto:
return string_builder << "ExpiredPhoto";
case MessageContentType::Photo:
return string_builder << "Photo";
case MessageContentType::ExpiredVideo:
return string_builder << "ExpiredVideo";
case MessageContentType::Video:
return string_builder << "Video";
case MessageContentType::VideoNote:
return string_builder << "VideoNote";
case MessageContentType::VoiceNote:
return string_builder << "VoiceNote";
case MessageContentType::Contact:
return string_builder << "Contact";
case MessageContentType::LiveLocation:
return string_builder << "LiveLocation";
case MessageContentType::Location:
return string_builder << "Location";
case MessageContentType::Venue:
return string_builder << "Venue";
case MessageContentType::Game:
return string_builder << "Game";
case MessageContentType::Invoice:
return string_builder << "Invoice";
case MessageContentType::Sticker:
return string_builder << "Sticker";
case MessageContentType::Text:
return string_builder << "Text";
case MessageContentType::Unsupported:
return string_builder << "Unsupported";
case MessageContentType::ChatCreate:
return string_builder << "ChatCreate";
case MessageContentType::ChatChangeTitle:
return string_builder << "ChatChangeTitle";
case MessageContentType::ChatChangePhoto:
return string_builder << "ChatChangePhoto";
case MessageContentType::ChatDeletePhoto:
return string_builder << "ChatDeletePhoto";
case MessageContentType::ChatDeleteHistory:
return string_builder << "ChatDeleteHistory";
case MessageContentType::ChatAddUsers:
return string_builder << "ChatAddUsers";
case MessageContentType::ChatJoinedByLink:
return string_builder << "ChatJoinedByLink";
case MessageContentType::ChatDeleteUser:
return string_builder << "ChatDeleteUser";
case MessageContentType::ChatMigrateTo:
return string_builder << "ChatMigrateTo";
case MessageContentType::ChannelCreate:
return string_builder << "ChannelCreate";
case MessageContentType::ChannelMigrateFrom:
return string_builder << "ChannelMigrateFrom";
case MessageContentType::PinMessage:
return string_builder << "PinMessage";
case MessageContentType::GameScore:
return string_builder << "GameScore";
case MessageContentType::ScreenshotTaken:
return string_builder << "ScreenshotTaken";
case MessageContentType::ChatSetTtl:
return string_builder << "ChatSetTtl";
case MessageContentType::Call:
return string_builder << "Call";
case MessageContentType::PaymentSuccessful:
return string_builder << "PaymentSuccessful";
case MessageContentType::ContactRegistered:
return string_builder << "ContactRegistered";
case MessageContentType::CustomServiceAction:
return string_builder << "CustomServiceAction";
case MessageContentType::WebsiteConnected:
return string_builder << "WebsiteConnected";
case MessageContentType::PassportDataSent:
return string_builder << "PassportDataSent";
case MessageContentType::PassportDataReceived:
return string_builder << "PassportDataReceived";
default:
UNREACHABLE();
return string_builder;
}
}
template <class StorerT>
static void store(const MessageContent *content, StorerT &storer) {
CHECK(content != nullptr);

View File

@ -113,10 +113,7 @@ enum class MessageContentType : int32 {
PassportDataReceived
};
inline StringBuilder &operator<<(StringBuilder &string_builder, MessageContentType content_type) {
// TODO
return string_builder << static_cast<int32>(content_type);
}
StringBuilder &operator<<(StringBuilder &string_builder, MessageContentType content_type);
// Do not forget to update MessagesManager::update_message_content when one of the inheritors of this class changes
class MessageContent {