Rewrote enums for consistency

This commit is contained in:
tastytea 2018-04-01 05:14:02 +02:00
parent 3acd8536d8
commit f298de7cff
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
5 changed files with 31 additions and 33 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.7) cmake_minimum_required (VERSION 3.7)
project (mastodon-cpp project (mastodon-cpp
VERSION 0.7.21 VERSION 0.7.22
LANGUAGES CXX LANGUAGES CXX
) )

View File

@ -135,16 +135,16 @@ const Easy::attachment_type Attachment::type() const
{ {
const string strtype = get_string("type"); const string strtype = get_string("type");
if (strtype.compare("image") == 0) if (strtype.compare("image") == 0)
return attachment_type::image; return attachment_type::Image;
else if (strtype.compare("video") == 0) else if (strtype.compare("video") == 0)
return attachment_type::video; return attachment_type::Video;
else if (strtype.compare("gifv") == 0) else if (strtype.compare("gifv") == 0)
return attachment_type::gifv; return attachment_type::Gifv;
else if (strtype.compare("unknown") == 0) else if (strtype.compare("unknown") == 0)
return attachment_type::unknown; return attachment_type::Unknown;
ttdebug << "Could not get data: type\n"; ttdebug << "Could not get data: type\n";
return attachment_type::unknown; return attachment_type::Undefined;
} }
const string Attachment::url() const const string Attachment::url() const

View File

@ -77,16 +77,16 @@ const Easy::card_type Card::type() const
{ {
const string strtype = get_string("type"); const string strtype = get_string("type");
if (strtype.compare("link") == 0) if (strtype.compare("link") == 0)
return card_type::link; return card_type::Link;
else if (strtype.compare("photo") == 0) else if (strtype.compare("photo") == 0)
return card_type::photo; return card_type::Photo;
else if (strtype.compare("video") == 0) else if (strtype.compare("video") == 0)
return card_type::video; return card_type::Video;
else if (strtype.compare("rich") == 0) else if (strtype.compare("rich") == 0)
return card_type::rich; return card_type::Rich;
ttdebug << "Could not get data: type\n"; ttdebug << "Could not get data: type\n";
return card_type::unknown; return card_type::Undefined;
} }
const string Card::url() const const string Card::url() const

View File

@ -56,9 +56,6 @@ public:
/*! /*!
* @brief Describes visibility of toots. * @brief Describes visibility of toots.
*
* The names begin with a capital letter because some of them
* are reserved keywords when written in all-lowercase.
*/ */
enum class visibility_type enum class visibility_type
{ {
@ -74,10 +71,11 @@ public:
*/ */
enum class attachment_type enum class attachment_type
{ {
image, Image,
video, Video,
gifv, Gifv,
unknown Unknown,
Undefined
}; };
/*! /*!
@ -85,11 +83,11 @@ public:
*/ */
enum class card_type enum class card_type
{ {
link, Link,
photo, Photo,
video, Video,
rich, Rich,
unknown Undefined
}; };
/*! /*!
@ -97,11 +95,11 @@ public:
*/ */
enum class notification_type enum class notification_type
{ {
mention, Mention,
reblog, Reblog,
favourite, Favourite,
follow, Follow,
unknown Undefined
}; };
typedef std::pair<event_type, string> stream_event; typedef std::pair<event_type, string> stream_event;

View File

@ -66,13 +66,13 @@ const Easy::notification_type Notification::type() const
{ {
const string strtype = get_string("type"); const string strtype = get_string("type");
if (strtype.compare("mention") == 0) if (strtype.compare("mention") == 0)
return notification_type::mention; return notification_type::Mention;
else if (strtype.compare("reblog") == 0) else if (strtype.compare("reblog") == 0)
return notification_type::reblog; return notification_type::Reblog;
else if (strtype.compare("favourite") == 0) else if (strtype.compare("favourite") == 0)
return notification_type::favourite; return notification_type::Favourite;
else if (strtype.compare("follow") == 0) else if (strtype.compare("follow") == 0)
return notification_type::follow; return notification_type::Follow;
return notification_type::unknown; return notification_type::Undefined;
} }