Update to latest settings library version
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <rapidjson/document.h>
|
||||
#include <QString>
|
||||
#include <pajlada/settings/serialize.hpp>
|
||||
#include <pajlada/serialize.hpp>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
@@ -32,49 +32,42 @@ struct TwitchUser {
|
||||
} // namespace chatterino
|
||||
|
||||
namespace pajlada {
|
||||
namespace Settings {
|
||||
|
||||
template <>
|
||||
struct Deserialize<chatterino::TwitchUser> {
|
||||
static chatterino::TwitchUser get(const rapidjson::Value &value,
|
||||
bool *error = nullptr)
|
||||
template <>
|
||||
struct Deserialize<chatterino::TwitchUser> {
|
||||
static chatterino::TwitchUser get(const rapidjson::Value &value,
|
||||
bool *error = nullptr)
|
||||
{
|
||||
using namespace chatterino;
|
||||
|
||||
TwitchUser user;
|
||||
|
||||
if (!value.IsObject())
|
||||
{
|
||||
using namespace chatterino;
|
||||
|
||||
TwitchUser user;
|
||||
|
||||
if (!value.IsObject())
|
||||
{
|
||||
PAJLADA_REPORT_ERROR(error)
|
||||
PAJLADA_THROW_EXCEPTION(
|
||||
"Deserialized rapidjson::Value is wrong type");
|
||||
return user;
|
||||
}
|
||||
|
||||
if (!rj::getSafe(value, "_id", user.id))
|
||||
{
|
||||
PAJLADA_REPORT_ERROR(error)
|
||||
PAJLADA_THROW_EXCEPTION("Missing ID key");
|
||||
return user;
|
||||
}
|
||||
|
||||
if (!rj::getSafe(value, "name", user.name))
|
||||
{
|
||||
PAJLADA_REPORT_ERROR(error)
|
||||
PAJLADA_THROW_EXCEPTION("Missing name key");
|
||||
return user;
|
||||
}
|
||||
|
||||
if (!rj::getSafe(value, "display_name", user.displayName))
|
||||
{
|
||||
PAJLADA_REPORT_ERROR(error)
|
||||
PAJLADA_THROW_EXCEPTION("Missing display name key");
|
||||
return user;
|
||||
}
|
||||
|
||||
PAJLADA_REPORT_ERROR(error)
|
||||
return user;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Settings
|
||||
if (!rj::getSafe(value, "_id", user.id))
|
||||
{
|
||||
PAJLADA_REPORT_ERROR(error)
|
||||
return user;
|
||||
}
|
||||
|
||||
if (!rj::getSafe(value, "name", user.name))
|
||||
{
|
||||
PAJLADA_REPORT_ERROR(error)
|
||||
return user;
|
||||
}
|
||||
|
||||
if (!rj::getSafe(value, "display_name", user.displayName))
|
||||
{
|
||||
PAJLADA_REPORT_ERROR(error)
|
||||
return user;
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace pajlada
|
||||
|
||||
Reference in New Issue
Block a user