Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use AvailableFlag within SleepyDiscord::Server and fix typo #176

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions include/sleepy_discord/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ namespace SleepyDiscord {
JSONStructEnd
};

enum class AvailableFlag : char {
NotSet = -2,
Unavaiable = true,
Available = false,
};

struct Server : public IdentifiableDiscordObject<Server> {
//~Server();
Server() = default;
Expand All @@ -72,7 +78,7 @@ namespace SleepyDiscord {
//voice_states
//emojis
//features
bool unavailable;
AvailableFlag unavailable = AvailableFlag::NotSet;

//presences
int MFALevel;
Expand Down Expand Up @@ -105,7 +111,7 @@ namespace SleepyDiscord {
json::pair (&Server::verificationLevel , "verification_level" , json::OPTIONAL_FIELD ),
json::pair (&Server::defaultMessageNotifications, "default_message_notifications", json::OPTIONAL_FIELD ),
json::pair<json::ContainerTypeHelper>(&Server::roles , "roles" , json::OPTIONAL_FIELD ),
json::pair (&Server::unavailable , "unavailable" , json::OPTIONAL_FIELD ),
json::pair<json::EnumTypeHelper >(&Server::unavailable , "unavailable" , json::OPTIONAL_FIELD ),
json::pair (&Server::MFALevel , "mfa_level" , json::OPTIONAL_FIELD ),
json::pair (&Server::joinedAt , "joined_at" , json::OPTIONAL_FIELD ),
json::pair (&Server::large , "large" , json::OPTIONAL_FIELD ),
Expand All @@ -122,11 +128,6 @@ namespace SleepyDiscord {
UnavailableServer(const json::Value& json);
//UnavailableServer(const json::Values values);

enum class AvailableFlag : char {
NotSet = -2,
Unavaiable = true,
avaiable = false,
};
AvailableFlag unavailable = AvailableFlag::NotSet;

JSONStructStart
Expand All @@ -139,14 +140,14 @@ namespace SleepyDiscord {
};

template<>
struct GetDefault<UnavailableServer::AvailableFlag> {
static inline const UnavailableServer::AvailableFlag get() {
return UnavailableServer::AvailableFlag::NotSet;
struct GetDefault<AvailableFlag> {
static inline const AvailableFlag get() {
return AvailableFlag::NotSet;
}
};

template<>
struct GetEnumBaseType<UnavailableServer::AvailableFlag> {
struct GetEnumBaseType<AvailableFlag> {
//this makes the json wrapper know to use getBool instead of getInt
using Value = bool;
};
Expand Down Expand Up @@ -200,4 +201,4 @@ namespace SleepyDiscord {
);
JSONStructEnd
};
}
}