From b301a2828e71f50d65c796ce988c9b3c332d7156 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Sun, 9 Apr 2017 18:09:09 +0300 Subject: [PATCH] Remove exception specifications --- include/Deserializable.h | 8 ++++---- include/Login.h | 4 ++-- include/MatrixClient.h | 18 +++++++++--------- include/Profile.h | 2 +- include/Register.h | 4 ++-- include/Sync.h | 12 ++++++------ src/Deserializable.cc | 2 +- src/Login.cc | 4 ++-- src/MatrixClient.cc | 18 +++++++++--------- src/Profile.cc | 2 +- src/Register.cc | 4 ++-- src/Sync.cc | 12 ++++++------ 12 files changed, 45 insertions(+), 45 deletions(-) diff --git a/include/Deserializable.h b/include/Deserializable.h index f51abc73..e4e07884 100644 --- a/include/Deserializable.h +++ b/include/Deserializable.h @@ -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 &) { } }; diff --git a/include/Login.h b/include/Login.h index 5ea8bc68..98752083 100644 --- a/include/Login.h +++ b/include/Login.h @@ -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(); diff --git a/include/MatrixClient.h b/include/MatrixClient.h index dd7f92f9..ae67af3a 100644 --- a/include/MatrixClient.h +++ b/include/MatrixClient.h @@ -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); diff --git a/include/Profile.h b/include/Profile.h index acf81fda..6dffa007 100644 --- a/include/Profile.h +++ b/include/Profile.h @@ -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(); diff --git a/include/Register.h b/include/Register.h index 2233ab6a..fb9438cb 100644 --- a/include/Register.h +++ b/include/Register.h @@ -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(); diff --git a/include/Sync.h b/include/Sync.h index 699c3ee8..1db52209 100644 --- a/include/Sync.h +++ b/include/Sync.h @@ -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 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 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 join() const; - void deserialize(const QJsonValue &data) throw(DeserializationException) override; + void deserialize(const QJsonValue &data) override; private: QMap join_; @@ -177,7 +177,7 @@ inline QMap 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; diff --git a/src/Deserializable.cc b/src/Deserializable.cc index 967f5ef4..d9cdaf0d 100644 --- a/src/Deserializable.cc +++ b/src/Deserializable.cc @@ -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(); } diff --git a/src/Login.cc b/src/Login.cc index 0ce05a80..1f1fb572 100644 --- a/src/Login.cc +++ b/src/Login.cc @@ -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"); diff --git a/src/MatrixClient.cc b/src/MatrixClient.cc index f7c1b0d4..86aeb179 100644 --- a/src/MatrixClient.cc +++ b/src/MatrixClient.cc @@ -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; diff --git a/src/Profile.cc b/src/Profile.cc index 40b1b074..86089bee 100644 --- a/src/Profile.cc +++ b/src/Profile.cc @@ -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"); diff --git a/src/Register.cc b/src/Register.cc index 4c14b400..4f4e4ded 100644 --- a/src/Register.cc +++ b/src/Register.cc @@ -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"); diff --git a/src/Sync.cc b/src/Sync.cc index b51ecff7..50b49fc6 100644 --- a/src/Sync.cc +++ b/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");