Remove exception specifications

This commit is contained in:
Konstantinos Sideris 2017-04-09 18:09:09 +03:00
parent 7dde3a15d4
commit b301a2828e
12 changed files with 45 additions and 45 deletions

View file

@ -28,7 +28,7 @@ class DeserializationException : public std::exception
{ {
public: public:
explicit DeserializationException(const std::string &msg); explicit DeserializationException(const std::string &msg);
virtual const char *what() const throw(); virtual const char *what() const noexcept;
private: private:
std::string msg_; std::string msg_;
@ -38,13 +38,13 @@ private:
class Deserializable class Deserializable
{ {
public: 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 &)
{ {
} }
}; };

View file

@ -28,7 +28,7 @@ public:
LoginRequest(); LoginRequest();
LoginRequest(QString username, QString password); LoginRequest(QString username, QString password);
QByteArray serialize(); QByteArray serialize() noexcept;
inline void setPassword(QString password); inline void setPassword(QString password);
inline void setUser(QString username); inline void setUser(QString username);
@ -51,7 +51,7 @@ inline void LoginRequest::setUser(QString username)
class LoginResponse : public Deserializable class LoginResponse : public Deserializable
{ {
public: public:
void deserialize(const QJsonDocument &data) throw(DeserializationException) override; void deserialize(const QJsonDocument &data) override;
inline QString getAccessToken(); inline QString getAccessToken();
inline QString getHomeServer(); inline QString getHomeServer();

View file

@ -34,21 +34,21 @@ public:
MatrixClient(QString server, QObject *parent = 0); MatrixClient(QString server, QObject *parent = 0);
// Client API. // Client API.
void initialSync(); void initialSync() noexcept;
void sync(); void sync() noexcept;
void sendTextMessage(const QString &roomid, const QString &msg); void sendTextMessage(const QString &roomid, const QString &msg) noexcept;
void login(const QString &username, const QString &password); void login(const QString &username, const QString &password) noexcept;
void registerUser(const QString &username, const QString &password, const QString &server); void registerUser(const QString &username, const QString &password, const QString &server) noexcept;
void versions(); void versions() noexcept;
inline QString getHomeServer(); inline QString getHomeServer();
inline void incrementTransactionId(); inline void incrementTransactionId();
void reset(); void reset() noexcept;
public slots: public slots:
void getOwnProfile(); void getOwnProfile() noexcept;
void logout(); void logout() noexcept;
inline void setServer(const QString &server); inline void setServer(const QString &server);
inline void setAccessToken(const QString &token); inline void setAccessToken(const QString &token);

View file

@ -26,7 +26,7 @@
class ProfileResponse : public Deserializable class ProfileResponse : public Deserializable
{ {
public: public:
void deserialize(const QJsonDocument &data) throw(DeserializationException) override; void deserialize(const QJsonDocument &data) override;
inline QUrl getAvatarUrl(); inline QUrl getAvatarUrl();
inline QString getDisplayName(); inline QString getDisplayName();

View file

@ -28,7 +28,7 @@ public:
RegisterRequest(); RegisterRequest();
RegisterRequest(const QString &username, const QString &password); RegisterRequest(const QString &username, const QString &password);
QByteArray serialize(); QByteArray serialize() noexcept;
inline void setPassword(QString password); inline void setPassword(QString password);
inline void setUser(QString username); inline void setUser(QString username);
@ -51,7 +51,7 @@ inline void RegisterRequest::setUser(QString username)
class RegisterResponse : public Deserializable class RegisterResponse : public Deserializable
{ {
public: public:
void deserialize(const QJsonDocument &data) throw(DeserializationException) override; void deserialize(const QJsonDocument &data) override;
inline QString getAccessToken(); inline QString getAccessToken();
inline QString getHomeServer(); inline QString getHomeServer();

View file

@ -37,7 +37,7 @@ public:
inline uint64_t timestamp() const; inline uint64_t timestamp() const;
void deserialize(const QJsonValue &data) throw(DeserializationException) override; void deserialize(const QJsonValue &data) override;
private: private:
QJsonObject content_; QJsonObject content_;
@ -89,7 +89,7 @@ inline uint64_t Event::timestamp() const
class State : public Deserializable class State : public Deserializable
{ {
public: public:
void deserialize(const QJsonValue &data) throw(DeserializationException) override; void deserialize(const QJsonValue &data) override;
inline QList<Event> events() const; inline QList<Event> events() const;
private: private:
@ -108,7 +108,7 @@ public:
inline QString previousBatch() const; inline QString previousBatch() const;
inline bool limited() const; inline bool limited() const;
void deserialize(const QJsonValue &data) throw(DeserializationException) override; void deserialize(const QJsonValue &data) override;
private: private:
QList<Event> events_; QList<Event> events_;
@ -138,7 +138,7 @@ public:
inline State state() const; inline State state() const;
inline Timeline timeline() const; inline Timeline timeline() const;
void deserialize(const QJsonValue &data) throw(DeserializationException) override; void deserialize(const QJsonValue &data) override;
private: private:
State state_; State state_;
@ -163,7 +163,7 @@ class Rooms : public Deserializable
{ {
public: public:
inline QMap<QString, JoinedRoom> join() const; inline QMap<QString, JoinedRoom> join() const;
void deserialize(const QJsonValue &data) throw(DeserializationException) override; void deserialize(const QJsonValue &data) override;
private: private:
QMap<QString, JoinedRoom> join_; QMap<QString, JoinedRoom> join_;
@ -177,7 +177,7 @@ inline QMap<QString, JoinedRoom> Rooms::join() const
class SyncResponse : public Deserializable class SyncResponse : public Deserializable
{ {
public: public:
void deserialize(const QJsonDocument &data) throw(DeserializationException) override; void deserialize(const QJsonDocument &data) override;
inline QString nextBatch() const; inline QString nextBatch() const;
inline Rooms rooms() const; inline Rooms rooms() const;

View file

@ -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(); return msg_.c_str();
} }

View file

@ -32,7 +32,7 @@ LoginRequest::LoginRequest(QString username, QString password)
{ {
} }
QByteArray LoginRequest::serialize() QByteArray LoginRequest::serialize() noexcept
{ {
QJsonObject body{ QJsonObject body{
{"type", "m.login.password"}, {"type", "m.login.password"},
@ -42,7 +42,7 @@ QByteArray LoginRequest::serialize()
return QJsonDocument(body).toJson(QJsonDocument::Compact); return QJsonDocument(body).toJson(QJsonDocument::Compact);
} }
void LoginResponse::deserialize(const QJsonDocument &data) throw(DeserializationException) void LoginResponse::deserialize(const QJsonDocument &data)
{ {
if (!data.isObject()) if (!data.isObject())
throw DeserializationException("Login response is not a JSON object"); throw DeserializationException("Login response is not a JSON object");

View file

@ -43,7 +43,7 @@ MatrixClient::MatrixClient(QString server, QObject *parent)
connect(this, SIGNAL(finished(QNetworkReply *)), this, SLOT(onResponse(QNetworkReply *))); connect(this, SIGNAL(finished(QNetworkReply *)), this, SLOT(onResponse(QNetworkReply *)));
} }
void MatrixClient::reset() void MatrixClient::reset() noexcept
{ {
next_batch_ = ""; next_batch_ = "";
server_ = ""; 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_); QUrl endpoint(server_);
endpoint.setPath(api_url_ + "/login"); endpoint.setPath(api_url_ + "/login");
@ -309,7 +309,7 @@ void MatrixClient::login(const QString &username, const QString &password)
reply->setProperty("endpoint", Endpoint::Login); reply->setProperty("endpoint", Endpoint::Login);
} }
void MatrixClient::logout() void MatrixClient::logout() noexcept
{ {
QUrlQuery query; QUrlQuery query;
query.addQueryItem("access_token", token_); query.addQueryItem("access_token", token_);
@ -326,7 +326,7 @@ void MatrixClient::logout()
reply->setProperty("endpoint", Endpoint::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); setServer(server);
@ -346,7 +346,7 @@ void MatrixClient::registerUser(const QString &user, const QString &pass, const
reply->setProperty("endpoint", Endpoint::Register); reply->setProperty("endpoint", Endpoint::Register);
} }
void MatrixClient::sync() void MatrixClient::sync() noexcept
{ {
QJsonObject filter{{"room", QJsonObject filter{{"room",
QJsonObject{{"ephemeral", QJsonObject{{"limit", 0}}}}}, QJsonObject{{"ephemeral", QJsonObject{{"limit", 0}}}}},
@ -374,7 +374,7 @@ void MatrixClient::sync()
reply->setProperty("endpoint", Endpoint::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; QUrlQuery query;
query.addQueryItem("access_token", token_); query.addQueryItem("access_token", token_);
@ -396,7 +396,7 @@ void MatrixClient::sendTextMessage(const QString &roomid, const QString &msg)
reply->setProperty("txn_id", txn_id_); reply->setProperty("txn_id", txn_id_);
} }
void MatrixClient::initialSync() void MatrixClient::initialSync() noexcept
{ {
QJsonObject filter{{"room", QJsonObject filter{{"room",
QJsonObject{{"timeline", QJsonObject{{"limit", 70}}}, QJsonObject{{"timeline", QJsonObject{{"limit", 70}}},
@ -419,7 +419,7 @@ void MatrixClient::initialSync()
reply->setProperty("endpoint", Endpoint::InitialSync); reply->setProperty("endpoint", Endpoint::InitialSync);
} }
void MatrixClient::versions() void MatrixClient::versions() noexcept
{ {
QUrl endpoint(server_); QUrl endpoint(server_);
endpoint.setPath("/_matrix/client/versions"); endpoint.setPath("/_matrix/client/versions");
@ -430,7 +430,7 @@ void MatrixClient::versions()
reply->setProperty("endpoint", Endpoint::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. // FIXME: Remove settings from the matrix client. The class should store the user's matrix ID.
QSettings settings; QSettings settings;

View file

@ -22,7 +22,7 @@
#include "Deserializable.h" #include "Deserializable.h"
#include "Profile.h" #include "Profile.h"
void ProfileResponse::deserialize(const QJsonDocument &data) throw(DeserializationException) void ProfileResponse::deserialize(const QJsonDocument &data)
{ {
if (!data.isObject()) if (!data.isObject())
throw DeserializationException("Response is not a JSON object"); throw DeserializationException("Response is not a JSON object");

View file

@ -32,7 +32,7 @@ RegisterRequest::RegisterRequest(const QString &username, const QString &passwor
{ {
} }
QByteArray RegisterRequest::serialize() QByteArray RegisterRequest::serialize() noexcept
{ {
QJsonObject body{ QJsonObject body{
{"username", user_}, {"username", user_},
@ -41,7 +41,7 @@ QByteArray RegisterRequest::serialize()
return QJsonDocument(body).toJson(QJsonDocument::Compact); return QJsonDocument(body).toJson(QJsonDocument::Compact);
} }
void RegisterResponse::deserialize(const QJsonDocument &data) throw(DeserializationException) void RegisterResponse::deserialize(const QJsonDocument &data)
{ {
if (!data.isObject()) if (!data.isObject())
throw DeserializationException("Response is not a JSON object"); throw DeserializationException("Response is not a JSON object");

View file

@ -24,7 +24,7 @@
#include "Deserializable.h" #include "Deserializable.h"
#include "Sync.h" #include "Sync.h"
void SyncResponse::deserialize(const QJsonDocument &data) throw(DeserializationException) void SyncResponse::deserialize(const QJsonDocument &data)
{ {
if (!data.isObject()) if (!data.isObject())
throw DeserializationException("Sync response is not a JSON object"); 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(); next_batch_ = object.value("next_batch").toString();
} }
void Rooms::deserialize(const QJsonValue &data) throw(DeserializationException) void Rooms::deserialize(const QJsonValue &data)
{ {
if (!data.isObject()) if (!data.isObject())
throw DeserializationException("Rooms value is not a JSON object"); 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()) if (!data.isObject())
throw DeserializationException("JoinedRoom is not a JSON object"); 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")); timeline_.deserialize(object.value("timeline"));
} }
void Event::deserialize(const QJsonValue &data) throw(DeserializationException) void Event::deserialize(const QJsonValue &data)
{ {
if (!data.isObject()) if (!data.isObject())
throw DeserializationException("Event is not a JSON object"); 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(); 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()) if (!data.isArray())
throw DeserializationException("State is not a JSON array"); 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()) if (!data.isObject())
throw DeserializationException("Timeline is not a JSON object"); throw DeserializationException("Timeline is not a JSON object");