mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-24 20:18:53 +03:00
Remove exception specifications
This commit is contained in:
parent
7dde3a15d4
commit
b301a2828e
12 changed files with 45 additions and 45 deletions
|
@ -28,7 +28,7 @@ class DeserializationException : public std::exception
|
|||
{
|
||||
public:
|
||||
explicit DeserializationException(const std::string &msg);
|
||||
virtual const char *what() const throw();
|
||||
virtual const char *what() const noexcept;
|
||||
|
||||
private:
|
||||
std::string msg_;
|
||||
|
@ -38,13 +38,13 @@ private:
|
|||
class Deserializable
|
||||
{
|
||||
public:
|
||||
virtual void deserialize(const QJsonValue &) throw(DeserializationException)
|
||||
virtual void deserialize(const QJsonValue &)
|
||||
{
|
||||
}
|
||||
virtual void deserialize(const QJsonObject &) throw(DeserializationException)
|
||||
virtual void deserialize(const QJsonObject &)
|
||||
{
|
||||
}
|
||||
virtual void deserialize(const QJsonDocument &) throw(DeserializationException)
|
||||
virtual void deserialize(const QJsonDocument &)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
LoginRequest();
|
||||
LoginRequest(QString username, QString password);
|
||||
|
||||
QByteArray serialize();
|
||||
QByteArray serialize() noexcept;
|
||||
|
||||
inline void setPassword(QString password);
|
||||
inline void setUser(QString username);
|
||||
|
@ -51,7 +51,7 @@ inline void LoginRequest::setUser(QString username)
|
|||
class LoginResponse : public Deserializable
|
||||
{
|
||||
public:
|
||||
void deserialize(const QJsonDocument &data) throw(DeserializationException) override;
|
||||
void deserialize(const QJsonDocument &data) override;
|
||||
|
||||
inline QString getAccessToken();
|
||||
inline QString getHomeServer();
|
||||
|
|
|
@ -34,21 +34,21 @@ public:
|
|||
MatrixClient(QString server, QObject *parent = 0);
|
||||
|
||||
// Client API.
|
||||
void initialSync();
|
||||
void sync();
|
||||
void sendTextMessage(const QString &roomid, const QString &msg);
|
||||
void login(const QString &username, const QString &password);
|
||||
void registerUser(const QString &username, const QString &password, const QString &server);
|
||||
void versions();
|
||||
void initialSync() noexcept;
|
||||
void sync() noexcept;
|
||||
void sendTextMessage(const QString &roomid, const QString &msg) noexcept;
|
||||
void login(const QString &username, const QString &password) noexcept;
|
||||
void registerUser(const QString &username, const QString &password, const QString &server) noexcept;
|
||||
void versions() noexcept;
|
||||
|
||||
inline QString getHomeServer();
|
||||
inline void incrementTransactionId();
|
||||
|
||||
void reset();
|
||||
void reset() noexcept;
|
||||
|
||||
public slots:
|
||||
void getOwnProfile();
|
||||
void logout();
|
||||
void getOwnProfile() noexcept;
|
||||
void logout() noexcept;
|
||||
|
||||
inline void setServer(const QString &server);
|
||||
inline void setAccessToken(const QString &token);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
class ProfileResponse : public Deserializable
|
||||
{
|
||||
public:
|
||||
void deserialize(const QJsonDocument &data) throw(DeserializationException) override;
|
||||
void deserialize(const QJsonDocument &data) override;
|
||||
|
||||
inline QUrl getAvatarUrl();
|
||||
inline QString getDisplayName();
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
RegisterRequest();
|
||||
RegisterRequest(const QString &username, const QString &password);
|
||||
|
||||
QByteArray serialize();
|
||||
QByteArray serialize() noexcept;
|
||||
|
||||
inline void setPassword(QString password);
|
||||
inline void setUser(QString username);
|
||||
|
@ -51,7 +51,7 @@ inline void RegisterRequest::setUser(QString username)
|
|||
class RegisterResponse : public Deserializable
|
||||
{
|
||||
public:
|
||||
void deserialize(const QJsonDocument &data) throw(DeserializationException) override;
|
||||
void deserialize(const QJsonDocument &data) override;
|
||||
|
||||
inline QString getAccessToken();
|
||||
inline QString getHomeServer();
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
|
||||
inline uint64_t timestamp() const;
|
||||
|
||||
void deserialize(const QJsonValue &data) throw(DeserializationException) override;
|
||||
void deserialize(const QJsonValue &data) override;
|
||||
|
||||
private:
|
||||
QJsonObject content_;
|
||||
|
@ -89,7 +89,7 @@ inline uint64_t Event::timestamp() const
|
|||
class State : public Deserializable
|
||||
{
|
||||
public:
|
||||
void deserialize(const QJsonValue &data) throw(DeserializationException) override;
|
||||
void deserialize(const QJsonValue &data) override;
|
||||
inline QList<Event> events() const;
|
||||
|
||||
private:
|
||||
|
@ -108,7 +108,7 @@ public:
|
|||
inline QString previousBatch() const;
|
||||
inline bool limited() const;
|
||||
|
||||
void deserialize(const QJsonValue &data) throw(DeserializationException) override;
|
||||
void deserialize(const QJsonValue &data) override;
|
||||
|
||||
private:
|
||||
QList<Event> events_;
|
||||
|
@ -138,7 +138,7 @@ public:
|
|||
inline State state() const;
|
||||
inline Timeline timeline() const;
|
||||
|
||||
void deserialize(const QJsonValue &data) throw(DeserializationException) override;
|
||||
void deserialize(const QJsonValue &data) override;
|
||||
|
||||
private:
|
||||
State state_;
|
||||
|
@ -163,7 +163,7 @@ class Rooms : public Deserializable
|
|||
{
|
||||
public:
|
||||
inline QMap<QString, JoinedRoom> join() const;
|
||||
void deserialize(const QJsonValue &data) throw(DeserializationException) override;
|
||||
void deserialize(const QJsonValue &data) override;
|
||||
|
||||
private:
|
||||
QMap<QString, JoinedRoom> join_;
|
||||
|
@ -177,7 +177,7 @@ inline QMap<QString, JoinedRoom> Rooms::join() const
|
|||
class SyncResponse : public Deserializable
|
||||
{
|
||||
public:
|
||||
void deserialize(const QJsonDocument &data) throw(DeserializationException) override;
|
||||
void deserialize(const QJsonDocument &data) override;
|
||||
inline QString nextBatch() const;
|
||||
inline Rooms rooms() const;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ DeserializationException::DeserializationException(const std::string &msg) : msg
|
|||
{
|
||||
}
|
||||
|
||||
const char *DeserializationException::what() const throw()
|
||||
const char *DeserializationException::what() const noexcept
|
||||
{
|
||||
return msg_.c_str();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ LoginRequest::LoginRequest(QString username, QString password)
|
|||
{
|
||||
}
|
||||
|
||||
QByteArray LoginRequest::serialize()
|
||||
QByteArray LoginRequest::serialize() noexcept
|
||||
{
|
||||
QJsonObject body{
|
||||
{"type", "m.login.password"},
|
||||
|
@ -42,7 +42,7 @@ QByteArray LoginRequest::serialize()
|
|||
return QJsonDocument(body).toJson(QJsonDocument::Compact);
|
||||
}
|
||||
|
||||
void LoginResponse::deserialize(const QJsonDocument &data) throw(DeserializationException)
|
||||
void LoginResponse::deserialize(const QJsonDocument &data)
|
||||
{
|
||||
if (!data.isObject())
|
||||
throw DeserializationException("Login response is not a JSON object");
|
||||
|
|
|
@ -43,7 +43,7 @@ MatrixClient::MatrixClient(QString server, QObject *parent)
|
|||
connect(this, SIGNAL(finished(QNetworkReply *)), this, SLOT(onResponse(QNetworkReply *)));
|
||||
}
|
||||
|
||||
void MatrixClient::reset()
|
||||
void MatrixClient::reset() noexcept
|
||||
{
|
||||
next_batch_ = "";
|
||||
server_ = "";
|
||||
|
@ -295,7 +295,7 @@ void MatrixClient::onResponse(QNetworkReply *reply)
|
|||
}
|
||||
}
|
||||
|
||||
void MatrixClient::login(const QString &username, const QString &password)
|
||||
void MatrixClient::login(const QString &username, const QString &password) noexcept
|
||||
{
|
||||
QUrl endpoint(server_);
|
||||
endpoint.setPath(api_url_ + "/login");
|
||||
|
@ -309,7 +309,7 @@ void MatrixClient::login(const QString &username, const QString &password)
|
|||
reply->setProperty("endpoint", Endpoint::Login);
|
||||
}
|
||||
|
||||
void MatrixClient::logout()
|
||||
void MatrixClient::logout() noexcept
|
||||
{
|
||||
QUrlQuery query;
|
||||
query.addQueryItem("access_token", token_);
|
||||
|
@ -326,7 +326,7 @@ void MatrixClient::logout()
|
|||
reply->setProperty("endpoint", Endpoint::Logout);
|
||||
}
|
||||
|
||||
void MatrixClient::registerUser(const QString &user, const QString &pass, const QString &server)
|
||||
void MatrixClient::registerUser(const QString &user, const QString &pass, const QString &server) noexcept
|
||||
{
|
||||
setServer(server);
|
||||
|
||||
|
@ -346,7 +346,7 @@ void MatrixClient::registerUser(const QString &user, const QString &pass, const
|
|||
reply->setProperty("endpoint", Endpoint::Register);
|
||||
}
|
||||
|
||||
void MatrixClient::sync()
|
||||
void MatrixClient::sync() noexcept
|
||||
{
|
||||
QJsonObject filter{{"room",
|
||||
QJsonObject{{"ephemeral", QJsonObject{{"limit", 0}}}}},
|
||||
|
@ -374,7 +374,7 @@ void MatrixClient::sync()
|
|||
reply->setProperty("endpoint", Endpoint::Sync);
|
||||
}
|
||||
|
||||
void MatrixClient::sendTextMessage(const QString &roomid, const QString &msg)
|
||||
void MatrixClient::sendTextMessage(const QString &roomid, const QString &msg) noexcept
|
||||
{
|
||||
QUrlQuery query;
|
||||
query.addQueryItem("access_token", token_);
|
||||
|
@ -396,7 +396,7 @@ void MatrixClient::sendTextMessage(const QString &roomid, const QString &msg)
|
|||
reply->setProperty("txn_id", txn_id_);
|
||||
}
|
||||
|
||||
void MatrixClient::initialSync()
|
||||
void MatrixClient::initialSync() noexcept
|
||||
{
|
||||
QJsonObject filter{{"room",
|
||||
QJsonObject{{"timeline", QJsonObject{{"limit", 70}}},
|
||||
|
@ -419,7 +419,7 @@ void MatrixClient::initialSync()
|
|||
reply->setProperty("endpoint", Endpoint::InitialSync);
|
||||
}
|
||||
|
||||
void MatrixClient::versions()
|
||||
void MatrixClient::versions() noexcept
|
||||
{
|
||||
QUrl endpoint(server_);
|
||||
endpoint.setPath("/_matrix/client/versions");
|
||||
|
@ -430,7 +430,7 @@ void MatrixClient::versions()
|
|||
reply->setProperty("endpoint", Endpoint::Versions);
|
||||
}
|
||||
|
||||
void MatrixClient::getOwnProfile()
|
||||
void MatrixClient::getOwnProfile() noexcept
|
||||
{
|
||||
// FIXME: Remove settings from the matrix client. The class should store the user's matrix ID.
|
||||
QSettings settings;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "Deserializable.h"
|
||||
#include "Profile.h"
|
||||
|
||||
void ProfileResponse::deserialize(const QJsonDocument &data) throw(DeserializationException)
|
||||
void ProfileResponse::deserialize(const QJsonDocument &data)
|
||||
{
|
||||
if (!data.isObject())
|
||||
throw DeserializationException("Response is not a JSON object");
|
||||
|
|
|
@ -32,7 +32,7 @@ RegisterRequest::RegisterRequest(const QString &username, const QString &passwor
|
|||
{
|
||||
}
|
||||
|
||||
QByteArray RegisterRequest::serialize()
|
||||
QByteArray RegisterRequest::serialize() noexcept
|
||||
{
|
||||
QJsonObject body{
|
||||
{"username", user_},
|
||||
|
@ -41,7 +41,7 @@ QByteArray RegisterRequest::serialize()
|
|||
return QJsonDocument(body).toJson(QJsonDocument::Compact);
|
||||
}
|
||||
|
||||
void RegisterResponse::deserialize(const QJsonDocument &data) throw(DeserializationException)
|
||||
void RegisterResponse::deserialize(const QJsonDocument &data)
|
||||
{
|
||||
if (!data.isObject())
|
||||
throw DeserializationException("Response is not a JSON object");
|
||||
|
|
12
src/Sync.cc
12
src/Sync.cc
|
@ -24,7 +24,7 @@
|
|||
#include "Deserializable.h"
|
||||
#include "Sync.h"
|
||||
|
||||
void SyncResponse::deserialize(const QJsonDocument &data) throw(DeserializationException)
|
||||
void SyncResponse::deserialize(const QJsonDocument &data)
|
||||
{
|
||||
if (!data.isObject())
|
||||
throw DeserializationException("Sync response is not a JSON object");
|
||||
|
@ -41,7 +41,7 @@ void SyncResponse::deserialize(const QJsonDocument &data) throw(DeserializationE
|
|||
next_batch_ = object.value("next_batch").toString();
|
||||
}
|
||||
|
||||
void Rooms::deserialize(const QJsonValue &data) throw(DeserializationException)
|
||||
void Rooms::deserialize(const QJsonValue &data)
|
||||
{
|
||||
if (!data.isObject())
|
||||
throw DeserializationException("Rooms value is not a JSON object");
|
||||
|
@ -81,7 +81,7 @@ void Rooms::deserialize(const QJsonValue &data) throw(DeserializationException)
|
|||
}
|
||||
}
|
||||
|
||||
void JoinedRoom::deserialize(const QJsonValue &data) throw(DeserializationException)
|
||||
void JoinedRoom::deserialize(const QJsonValue &data)
|
||||
{
|
||||
if (!data.isObject())
|
||||
throw DeserializationException("JoinedRoom is not a JSON object");
|
||||
|
@ -112,7 +112,7 @@ void JoinedRoom::deserialize(const QJsonValue &data) throw(DeserializationExcept
|
|||
timeline_.deserialize(object.value("timeline"));
|
||||
}
|
||||
|
||||
void Event::deserialize(const QJsonValue &data) throw(DeserializationException)
|
||||
void Event::deserialize(const QJsonValue &data)
|
||||
{
|
||||
if (!data.isObject())
|
||||
throw DeserializationException("Event is not a JSON object");
|
||||
|
@ -152,7 +152,7 @@ void Event::deserialize(const QJsonValue &data) throw(DeserializationException)
|
|||
origin_server_ts_ = object.value("origin_server_ts").toDouble();
|
||||
}
|
||||
|
||||
void State::deserialize(const QJsonValue &data) throw(DeserializationException)
|
||||
void State::deserialize(const QJsonValue &data)
|
||||
{
|
||||
if (!data.isArray())
|
||||
throw DeserializationException("State is not a JSON array");
|
||||
|
@ -172,7 +172,7 @@ void State::deserialize(const QJsonValue &data) throw(DeserializationException)
|
|||
}
|
||||
}
|
||||
|
||||
void Timeline::deserialize(const QJsonValue &data) throw(DeserializationException)
|
||||
void Timeline::deserialize(const QJsonValue &data)
|
||||
{
|
||||
if (!data.isObject())
|
||||
throw DeserializationException("Timeline is not a JSON object");
|
||||
|
|
Loading…
Reference in a new issue