diff --git a/src/api/delete.cpp b/src/api/delete.cpp index 4752dd8..71f7a94 100644 --- a/src/api/delete.cpp +++ b/src/api/delete.cpp @@ -20,8 +20,8 @@ using namespace Mastodon; -const uint_fast16_t API::del(const Mastodon::API::v1 &call, - const parametermap ¶meters) +uint_fast16_t API::del(const Mastodon::API::v1 &call, + const parametermap ¶meters) { string strcall = ""; string strid = ""; @@ -60,8 +60,8 @@ const uint_fast16_t API::del(const Mastodon::API::v1 &call, return del(strcall, parameters, answer); } -const uint_fast16_t API::del(const std::string &call, - const parametermap ¶meters, string &answer) +uint_fast16_t API::del(const std::string &call, + const parametermap ¶meters, string &answer) { return _http.request(http::method::DELETE, call, @@ -71,16 +71,16 @@ const uint_fast16_t API::del(const std::string &call, // ↓↓ DEPRECATED ↓↓ -const uint_fast16_t API::del(const Mastodon::API::v1 &call, - const string &argument) +uint_fast16_t API::del(const Mastodon::API::v1 &call, + const string &argument) { const parametermap p = {}; return del(call, argument, p); } -const uint_fast16_t API::del(const Mastodon::API::v1 &call, - const string &argument, - const parametermap ¶meters) +uint_fast16_t API::del(const Mastodon::API::v1 &call, + const string &argument, + const parametermap ¶meters) { parametermap newparameters = parameters; diff --git a/src/api/get.cpp b/src/api/get.cpp index 7b24c78..32a3dc5 100644 --- a/src/api/get.cpp +++ b/src/api/get.cpp @@ -21,8 +21,8 @@ using namespace Mastodon; using std::cerr; -const uint_fast16_t API::get(const Mastodon::API::v1 &call, - const parametermap ¶meters, string &answer) +uint_fast16_t API::get(const Mastodon::API::v1 &call, + const parametermap ¶meters, string &answer) { string strcall = ""; string strid = ""; @@ -168,8 +168,8 @@ const uint_fast16_t API::get(const Mastodon::API::v1 &call, return get(strcall, answer); } -const uint_fast16_t API::get(const Mastodon::API::v2 &call, - const parametermap ¶meters, string &answer) +uint_fast16_t API::get(const Mastodon::API::v2 &call, + const parametermap ¶meters, string &answer) { string strcall = ""; string strid = ""; @@ -204,13 +204,13 @@ const uint_fast16_t API::get(const Mastodon::API::v2 &call, return get(strcall, answer); } -const uint_fast16_t API::get(const Mastodon::API::v1 &call, string &answer) +uint_fast16_t API::get(const Mastodon::API::v1 &call, string &answer) { const parametermap p; return get(call, p, answer); } -const uint_fast16_t API::get(const std::string &call, string &answer) +uint_fast16_t API::get(const std::string &call, string &answer) { return _http.request(http::method::GET, call, answer); } @@ -219,9 +219,9 @@ const uint_fast16_t API::get(const std::string &call, string &answer) // ↓↓ DEPRECATED ↓↓ -const uint_fast16_t API::get(const Mastodon::API::v1 &call, - const string &argument, - const parametermap ¶meters, string &answer) +uint_fast16_t API::get(const Mastodon::API::v1 &call, + const string &argument, + const parametermap ¶meters, string &answer) { parametermap newparameters = parameters; @@ -243,8 +243,8 @@ const uint_fast16_t API::get(const Mastodon::API::v1 &call, return get(call, newparameters, answer); } -const uint_fast16_t API::get(const Mastodon::API::v1 &call, - const string &argument, string &answer) +uint_fast16_t API::get(const Mastodon::API::v1 &call, + const string &argument, string &answer) { const parametermap p; return get(call, argument, p, answer); diff --git a/src/api/get_stream.cpp b/src/api/get_stream.cpp index 2c01d37..9e6e4a6 100644 --- a/src/api/get_stream.cpp +++ b/src/api/get_stream.cpp @@ -21,10 +21,10 @@ using namespace Mastodon; using std::cerr; -const uint_fast16_t API::get_stream(const Mastodon::API::v1 &call, - const parametermap ¶meters, - string &answer, - std::unique_ptr &ptr) +uint_fast16_t API::get_stream(const Mastodon::API::v1 &call, + const parametermap ¶meters, + string &answer, + std::unique_ptr &ptr) { string strcall = ""; @@ -59,16 +59,16 @@ const uint_fast16_t API::get_stream(const Mastodon::API::v1 &call, return get_stream(strcall, answer, ptr); } -const uint_fast16_t API::get_stream(const Mastodon::API::v1 &call, - string &answer, - std::unique_ptr &ptr) +uint_fast16_t API::get_stream(const Mastodon::API::v1 &call, + string &answer, + std::unique_ptr &ptr) { parametermap p = {}; return get_stream(call, p, answer, ptr); } -const uint_fast16_t API::get_stream(const std::string &call, string &answer, - std::unique_ptr &ptr) +uint_fast16_t API::get_stream(const std::string &call, string &answer, + std::unique_ptr &ptr) { ptr = std::make_unique(*this, _instance, _access_token); return ptr->request(http::method::GET_STREAM, call, answer); @@ -77,10 +77,10 @@ const uint_fast16_t API::get_stream(const std::string &call, string &answer, // ↓↓ DEPRECATED ↓↓ -const uint_fast16_t API::get_stream(const Mastodon::API::v1 &call, - const string &argument, - string &answer, - std::unique_ptr &ptr) +uint_fast16_t API::get_stream(const Mastodon::API::v1 &call, + const string &argument, + string &answer, + std::unique_ptr &ptr) { parametermap parameters; diff --git a/src/api/patch.cpp b/src/api/patch.cpp index 1de93dc..5abf93f 100644 --- a/src/api/patch.cpp +++ b/src/api/patch.cpp @@ -21,9 +21,9 @@ using namespace Mastodon; using std::cerr; -const uint_fast16_t API::patch(const Mastodon::API::v1 &call, - const parametermap ¶meters, - string &answer) +uint_fast16_t API::patch(const Mastodon::API::v1 &call, + const parametermap ¶meters, + string &answer) { string strcall = ""; switch (call) diff --git a/src/api/post.cpp b/src/api/post.cpp index 2489d64..3f71d12 100644 --- a/src/api/post.cpp +++ b/src/api/post.cpp @@ -20,8 +20,8 @@ using namespace Mastodon; -const uint_fast16_t API::post(const Mastodon::API::v1 &call, - const parametermap ¶meters, string &answer) +uint_fast16_t API::post(const Mastodon::API::v1 &call, + const parametermap ¶meters, string &answer) { string strcall = ""; string strid = ""; @@ -137,14 +137,14 @@ const uint_fast16_t API::post(const Mastodon::API::v1 &call, return post(strcall, parameters, answer); } -const uint_fast16_t API::post(const Mastodon::API::v1 &call, string &answer) +uint_fast16_t API::post(const Mastodon::API::v1 &call, string &answer) { const parametermap p; return post(call, p, answer); } -const uint_fast16_t API::post(const string &call, - const parametermap ¶meters, string &answer) +uint_fast16_t API::post(const string &call, + const parametermap ¶meters, string &answer) { return _http.request(http::method::POST, call, @@ -154,9 +154,9 @@ const uint_fast16_t API::post(const string &call, // ↓↓ DEPRECATED ↓↓ -const uint_fast16_t API::post(const Mastodon::API::v1 &call, - const string &argument, - const parametermap ¶meters, string &answer) +uint_fast16_t API::post(const Mastodon::API::v1 &call, + const string &argument, + const parametermap ¶meters, string &answer) { parametermap newparameters = parameters; @@ -166,8 +166,8 @@ const uint_fast16_t API::post(const Mastodon::API::v1 &call, return post(call, newparameters, answer); } -const uint_fast16_t API::post(const Mastodon::API::v1 &call, - const string &argument, string &answer) +uint_fast16_t API::post(const Mastodon::API::v1 &call, + const string &argument, string &answer) { const parametermap p; return post(call, argument, p, answer); diff --git a/src/api/put.cpp b/src/api/put.cpp index cfdece0..86f9312 100644 --- a/src/api/put.cpp +++ b/src/api/put.cpp @@ -20,8 +20,8 @@ using namespace Mastodon; -const uint_fast16_t API::put(const Mastodon::API::v1 &call, - const parametermap ¶meters, string &answer) +uint_fast16_t API::put(const Mastodon::API::v1 &call, + const parametermap ¶meters, string &answer) { string strcall = ""; string strid = ""; @@ -53,8 +53,8 @@ const uint_fast16_t API::put(const Mastodon::API::v1 &call, return put(strcall, parameters, answer); } -const uint_fast16_t API::put(const string &call, - const parametermap ¶meters, string &answer) +uint_fast16_t API::put(const string &call, + const parametermap ¶meters, string &answer) { return _http.request(http::method::PUT, call, @@ -63,9 +63,9 @@ const uint_fast16_t API::put(const string &call, // ↓↓ DEPRECATED ↓↓ -const uint_fast16_t API::put(const Mastodon::API::v1 &call, - const string &argument, - const parametermap ¶meters, string &answer) +uint_fast16_t API::put(const Mastodon::API::v1 &call, + const string &argument, + const parametermap ¶meters, string &answer) { parametermap newparameters = parameters; diff --git a/src/easy/easy.cpp b/src/easy/easy.cpp index 4196028..1bfc6c7 100644 --- a/src/easy/easy.cpp +++ b/src/easy/easy.cpp @@ -133,22 +133,22 @@ Easy::Link::Link(const string &link_header) } } -const uint_fast64_t Easy::Link::next() const +uint_fast64_t Easy::Link::next() const { return _next; } -const uint_fast64_t Easy::Link::max_id() const +uint_fast64_t Easy::Link::max_id() const { return _next; } -const uint_fast64_t Easy::Link::prev() const +uint_fast64_t Easy::Link::prev() const { return _prev; } -const uint_fast64_t Easy::Link::since_id() const +uint_fast64_t Easy::Link::since_id() const { return _prev; } diff --git a/src/easy/easy.hpp b/src/easy/easy.hpp index 98cf6b4..cf7c24e 100644 --- a/src/easy/easy.hpp +++ b/src/easy/easy.hpp @@ -171,28 +171,28 @@ public: * * @since before 0.11.0 */ - const uint_fast64_t next() const; + uint_fast64_t next() const; /*! * @brief Returns max_id * * @since before 0.11.0 */ - const uint_fast64_t max_id() const; + uint_fast64_t max_id() const; /*! * @brief Returns since_id * * @since before 0.11.0 */ - const uint_fast64_t prev() const; + uint_fast64_t prev() const; /*! * @brief Returns since_id * * @since before 0.11.0 */ - const uint_fast64_t since_id() const; + uint_fast64_t since_id() const; private: uint_fast64_t _next; @@ -327,7 +327,7 @@ public: * * @since before 0.11.0 */ - const void from_string(const string &json); + void from_string(const string &json); /*! * @brief Returns the JSON object of the Entity @@ -343,7 +343,7 @@ public: * * @since before 0.11.0 (virtual since 0.18.2) */ - virtual const bool valid() const = 0; + virtual bool valid() const = 0; /*! * @brief Returns error string sent by the server @@ -380,7 +380,7 @@ public: * * @since before 0.11.0 */ - const bool was_set() const; + bool was_set() const; protected: /*! @@ -403,14 +403,14 @@ public: * * Returns 0 if the value does not exist or is null. */ - const uint_fast64_t get_uint64(const string &key) const; + uint_fast64_t get_uint64(const string &key) const; /*! * @brief Returns the value of key as double * * Returns 0.0 if the value does not exist or is null. */ - const double get_double(const string &key) const; + double get_double(const string &key) const; // TODO: Maybe an enum would be better? /*! @@ -418,7 +418,7 @@ public: * * Returns false if the value does not exist or is null. */ - const bool get_bool(const string &key) const; + bool get_bool(const string &key) const; /*! * @brief Returns the value of key as time_point @@ -440,9 +440,9 @@ public: * * @since 0.17.0 */ - const void set(const string &key, const Json::Value &value); + void set(const string &key, const Json::Value &value); - const std::uint_fast64_t stouint64(const string &str) const; + std::uint_fast64_t stouint64(const string &str) const; /*! * @brief Checks if an Entity is valid @@ -453,8 +453,7 @@ public: * * @since 0.18.2 */ - const bool - check_valid(const std::vector &attributes) const; + bool check_valid(const std::vector &attributes) const; private: Json::Value _tree; diff --git a/src/easy/entities/account.cpp b/src/easy/entities/account.cpp index c451077..9f8dae7 100644 --- a/src/easy/entities/account.cpp +++ b/src/easy/entities/account.cpp @@ -29,7 +29,7 @@ Account::Account() : Entity() {} -const bool Account::valid() const +bool Account::valid() const { const std::vector attributes = {{ @@ -74,7 +74,7 @@ const string Account::avatar_static() const return get_string("avatar_static"); } -const bool Account::bot() const +bool Account::bot() const { return get_bool("bot"); } @@ -128,12 +128,12 @@ Account Account::fields(std::vector &fields) return *this; } -const std::uint_fast64_t Account::followers_count() const +std::uint_fast64_t Account::followers_count() const { return get_uint64("followers_count"); } -const std::uint_fast64_t Account::following_count() const +std::uint_fast64_t Account::following_count() const { return get_uint64("following_count"); } @@ -154,12 +154,12 @@ const string Account::header_static() const return get_string("header_static"); } -const std::uint_fast64_t Account::id() const +std::uint_fast64_t Account::id() const { return stouint64(get_string("id")); } -const bool Account::locked() const +bool Account::locked() const { return get_bool("locked"); } @@ -170,7 +170,7 @@ Account Account::locked(const bool &locked) return *this; } -const bool Account::has_moved() const +bool Account::has_moved() const { if (get("moved").isObject()) { @@ -207,7 +207,7 @@ const string Account::note_plain() const return get_string("source.note"); } -const Easy::visibility_type Account::privacy() const +Easy::visibility_type Account::privacy() const { const string strprivacy = get_string("source.privacy"); if (strprivacy.compare("public") == 0) @@ -223,7 +223,7 @@ const Easy::visibility_type Account::privacy() const return visibility_type::Undefined; } -const bool Account::sensitive() const +bool Account::sensitive() const { return get_bool("source.sensitive"); } @@ -236,7 +236,7 @@ Account::Source::Source() : Entity() {} -const bool Account::Source::valid() const +bool Account::Source::valid() const { return true; } @@ -286,7 +286,7 @@ Account::Source Account::Source::note(const string ¬e) return *this; } -const Easy::visibility_type Account::Source::privacy() const +Easy::visibility_type Account::Source::privacy() const { const string strprivacy = get_string("privacy"); if (strprivacy.compare("public") == 0) @@ -337,7 +337,7 @@ Account::Source Account::Source::privacy(const Easy::visibility_type &privacy) return *this; } -const bool Account::Source::sensitive() const +bool Account::Source::sensitive() const { return get_bool("sensitive"); } @@ -359,7 +359,7 @@ Account Account::source(const Account::Source &source) return *this; } -const std::uint_fast64_t Account::statuses_count() const +std::uint_fast64_t Account::statuses_count() const { return get_uint64("statuses_count"); } diff --git a/src/easy/entities/account.hpp b/src/easy/entities/account.hpp index bbf9707..9b946de 100644 --- a/src/easy/entities/account.hpp +++ b/src/easy/entities/account.hpp @@ -69,7 +69,7 @@ namespace Mastodon */ Account(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns username @@ -109,7 +109,7 @@ namespace Mastodon * * @since 0.16.0 */ - const bool bot() const; + bool bot() const; /*! * @brief Returns time of creation @@ -151,14 +151,14 @@ namespace Mastodon * * @since before 0.11.0 */ - const uint_fast64_t followers_count() const; + uint_fast64_t followers_count() const; /*! * @brief Returns number of people this account follows * * @since before 0.11.0 */ - const uint_fast64_t following_count() const; + uint_fast64_t following_count() const; /*! * @brief Returns URL of header image @@ -188,14 +188,14 @@ namespace Mastodon * * @since before 0.11.0 */ - const uint_fast64_t id() const; + uint_fast64_t id() const; /*! * @brief Returns true if the account is locked * * @since before 0.11.0 */ - const bool locked() const; + bool locked() const; /*! * @brief Sets locked state @@ -209,7 +209,7 @@ namespace Mastodon * * @since before 0.11.0 */ - const bool has_moved() const; + bool has_moved() const; /*! * @brief If the owner decided to switch accounts, new account is in @@ -246,14 +246,14 @@ namespace Mastodon * * @since before 0.11.0 */ - const visibility_type privacy() const; + visibility_type privacy() const; /*! * @brief Returns if media is marked as sensitive by default * * @since before 0.11.0 */ - const bool sensitive() const; + bool sensitive() const; /*! * @brief Class to hold source attribute @@ -279,7 +279,7 @@ namespace Mastodon */ Source(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns metadata fields @@ -314,7 +314,7 @@ namespace Mastodon * * @since 0.18.5 */ - const visibility_type privacy() const; + visibility_type privacy() const; /*! * @brief Sets default privacy of new toots @@ -328,7 +328,7 @@ namespace Mastodon * * @since 0.18.5 */ - const bool sensitive() const; + bool sensitive() const; /*! * @brief Sets if media is marked as sensitive by default @@ -346,7 +346,7 @@ namespace Mastodon * * @since before 0.11.0 */ - const uint_fast64_t statuses_count() const; + uint_fast64_t statuses_count() const; /*! * @brief Returns URL of the profile diff --git a/src/easy/entities/application.cpp b/src/easy/entities/application.cpp index 57fd74b..d5f3086 100644 --- a/src/easy/entities/application.cpp +++ b/src/easy/entities/application.cpp @@ -27,7 +27,7 @@ Application::Application() : Entity() {} -const bool Application::valid() const +bool Application::valid() const { return Entity::check_valid({"name"}); } diff --git a/src/easy/entities/application.hpp b/src/easy/entities/application.hpp index e88e4b2..63c23b5 100644 --- a/src/easy/entities/application.hpp +++ b/src/easy/entities/application.hpp @@ -56,7 +56,7 @@ namespace Mastodon */ Application(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns the name of the application diff --git a/src/easy/entities/attachment.cpp b/src/easy/entities/attachment.cpp index 40203e6..dcd2d4e 100644 --- a/src/easy/entities/attachment.cpp +++ b/src/easy/entities/attachment.cpp @@ -29,7 +29,7 @@ Attachment::Attachment() : Entity() {} -const bool Attachment::valid() const +bool Attachment::valid() const { const std::vector attributes = {{ @@ -42,17 +42,17 @@ const bool Attachment::valid() const return Entity::check_valid(attributes); } -const double Attachment::aspect() const +double Attachment::aspect() const { return get_double("meta.original.aspect"); } -const double Attachment::aspect_small() const +double Attachment::aspect_small() const { return get_double("meta.small.aspect"); } -const uint_fast64_t Attachment::bitrate() const +uint_fast64_t Attachment::bitrate() const { return get_uint64("meta.original.bitrate"); } @@ -110,7 +110,7 @@ Attachment Attachment::focus(const std::array &focus) return *this; } -const double Attachment::framerate() const +double Attachment::framerate() const { string strframes = get_string("meta.original.frame_rate"); @@ -129,17 +129,17 @@ const double Attachment::framerate() const return 0.0; } -const uint_fast64_t Attachment::height() const +uint_fast64_t Attachment::height() const { return get_uint64("meta.original.height"); } -const uint_fast64_t Attachment::height_small() const +uint_fast64_t Attachment::height_small() const { return get_uint64("meta.small.height"); } -const std::uint_fast64_t Attachment::id() const +std::uint_fast64_t Attachment::id() const { return stouint64(get_string("id")); } @@ -169,7 +169,7 @@ const string Attachment::text_url() const return get_string("text_url"); } -const Easy::attachment_type Attachment::type() const +Easy::attachment_type Attachment::type() const { const string strtype = get_string("type"); if (strtype.compare("image") == 0) @@ -190,12 +190,12 @@ const string Attachment::url() const return get_string("url"); } -const uint_fast64_t Attachment::width() const +uint_fast64_t Attachment::width() const { return get_uint64("meta.original.width"); } -const uint_fast64_t Attachment::width_small() const +uint_fast64_t Attachment::width_small() const { return get_uint64("meta.small.width"); } diff --git a/src/easy/entities/attachment.hpp b/src/easy/entities/attachment.hpp index ab38050..a320f68 100644 --- a/src/easy/entities/attachment.hpp +++ b/src/easy/entities/attachment.hpp @@ -60,28 +60,28 @@ namespace Mastodon */ Attachment(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Aspect of original image * * @since before 0.11.0 */ - const double aspect() const; + double aspect() const; /*! * @brief Aspect of preview image * * @since before 0.11.0 */ - const double aspect_small() const; + double aspect_small() const; /*! * @brief Returns the bitrate of a video * * @since before 0.11.0 */ - const uint_fast64_t bitrate() const; + uint_fast64_t bitrate() const; /*! * @brief Returns the image description @@ -143,28 +143,28 @@ namespace Mastodon * * @since before 0.11.0 */ - const double framerate() const; + double framerate() const; /*! * @brief Returns the height of the original image * * @since before 0.11.0 */ - const uint_fast64_t height() const; + uint_fast64_t height() const; /*! * @brief Returns the height of the preview image * * @since before 0.11.0 */ - const uint_fast64_t height_small() const; + uint_fast64_t height_small() const; /*! * @brief Returns the ID of the attachment * * @since before 0.11.0 */ - const uint_fast64_t id() const; + uint_fast64_t id() const; /*! * @brief Returns the URL of the preview image @@ -206,7 +206,7 @@ namespace Mastodon * * @since before 0.11.0 */ - const attachment_type type() const; + attachment_type type() const; /*! * @brief Returns URL of the locally hosted version of the image @@ -220,14 +220,14 @@ namespace Mastodon * * @since before 0.11.0 */ - const uint_fast64_t width() const; + uint_fast64_t width() const; /*! * @brief Returns the width of the preview image * * @since before 0.11.0 */ - const uint_fast64_t width_small() const; + uint_fast64_t width_small() const; }; diff --git a/src/easy/entities/card.cpp b/src/easy/entities/card.cpp index 129651c..d9378a4 100644 --- a/src/easy/entities/card.cpp +++ b/src/easy/entities/card.cpp @@ -28,7 +28,7 @@ Card::Card() : Entity() {} -const bool Card::valid() const +bool Card::valid() const { const std::vector attributes = {{ @@ -56,7 +56,7 @@ const string Card::description() const return get_string("description"); } -const uint_fast64_t Card::height() const +uint_fast64_t Card::height() const { return get_uint64("height"); } @@ -86,7 +86,7 @@ const string Card::title() const return get_string("title"); } -const Easy::card_type Card::type() const +Easy::card_type Card::type() const { const string strtype = get_string("type"); if (strtype.compare("link") == 0) @@ -107,7 +107,7 @@ const string Card::url() const return get_string("url"); } -const uint_fast64_t Card::width() const +uint_fast64_t Card::width() const { return get_uint64("width"); } diff --git a/src/easy/entities/card.hpp b/src/easy/entities/card.hpp index 12a4e45..a2fba4a 100644 --- a/src/easy/entities/card.hpp +++ b/src/easy/entities/card.hpp @@ -58,7 +58,7 @@ namespace Mastodon */ Card(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns the name of the author @@ -86,7 +86,7 @@ namespace Mastodon * * @since before 0.11.0 */ - const uint_fast64_t height() const; + uint_fast64_t height() const; /*! * @brief Returns the HTML @@ -128,7 +128,7 @@ namespace Mastodon * * @since before 0.11.0 */ - const Easy::card_type type() const; + Easy::card_type type() const; /*! * @brief Returns the URL associated with the card @@ -142,7 +142,7 @@ namespace Mastodon * * @since before 0.11.0 */ - const uint_fast64_t width() const; + uint_fast64_t width() const; }; } diff --git a/src/easy/entities/context.cpp b/src/easy/entities/context.cpp index 9dc84e1..6cef62b 100644 --- a/src/easy/entities/context.cpp +++ b/src/easy/entities/context.cpp @@ -28,7 +28,7 @@ Context::Context() : Entity() {} -const bool Context::valid() const +bool Context::valid() const { const std::vector attributes = {{ diff --git a/src/easy/entities/context.hpp b/src/easy/entities/context.hpp index 84d6117..2b390fd 100644 --- a/src/easy/entities/context.hpp +++ b/src/easy/entities/context.hpp @@ -59,7 +59,7 @@ namespace Mastodon */ Context(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns the ancestors of the Status as vector of Statuses diff --git a/src/easy/entities/emoji.cpp b/src/easy/entities/emoji.cpp index 49ff660..ed27b9d 100644 --- a/src/easy/entities/emoji.cpp +++ b/src/easy/entities/emoji.cpp @@ -28,7 +28,7 @@ Emoji::Emoji() : Entity() {} -const bool Emoji::valid() const +bool Emoji::valid() const { const std::vector attributes = {{ diff --git a/src/easy/entities/emoji.hpp b/src/easy/entities/emoji.hpp index 3b5e5af..d1c9dcc 100644 --- a/src/easy/entities/emoji.hpp +++ b/src/easy/entities/emoji.hpp @@ -56,7 +56,7 @@ namespace Mastodon */ Emoji(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns the shortcode of the emoji diff --git a/src/easy/entities/instance.cpp b/src/easy/entities/instance.cpp index a8b1ad1..8852d41 100644 --- a/src/easy/entities/instance.cpp +++ b/src/easy/entities/instance.cpp @@ -30,7 +30,7 @@ Instance::Instance() : Entity() {} -const bool Instance::valid() const +bool Instance::valid() const { const std::vector attributes = {{ @@ -94,7 +94,7 @@ const string Instance::streaming_api() const return get_string("urls.streaming_api"); } -const uint_fast64_t Instance::max_toot_chars() const +uint_fast64_t Instance::max_toot_chars() const { const uint_fast64_t max_chars = get_uint64("max_toot_chars"); if (was_set()) diff --git a/src/easy/entities/instance.hpp b/src/easy/entities/instance.hpp index 131b155..bfcc992 100644 --- a/src/easy/entities/instance.hpp +++ b/src/easy/entities/instance.hpp @@ -61,7 +61,7 @@ namespace Mastodon */ Instance(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns the Account of the admin or another contact person @@ -129,7 +129,7 @@ namespace Mastodon * * @since 0.20.0 */ - const uint_fast64_t max_toot_chars() const; + uint_fast64_t max_toot_chars() const; }; } diff --git a/src/easy/entities/list.cpp b/src/easy/entities/list.cpp index c0d12a9..101d86f 100644 --- a/src/easy/entities/list.cpp +++ b/src/easy/entities/list.cpp @@ -29,7 +29,7 @@ List::List() : Entity() {} -const bool List::valid() const +bool List::valid() const { const std::vector attributes = {{ @@ -40,7 +40,7 @@ const bool List::valid() const return Entity::check_valid(attributes); } -const uint_fast64_t List::id() const +uint_fast64_t List::id() const { return stouint64(get_string("id")); } diff --git a/src/easy/entities/list.hpp b/src/easy/entities/list.hpp index 2a8a324..87b73e5 100644 --- a/src/easy/entities/list.hpp +++ b/src/easy/entities/list.hpp @@ -59,14 +59,14 @@ namespace Mastodon */ List(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns list-ID * * @since before 0.11.0 */ - const uint_fast64_t id() const; + uint_fast64_t id() const; /*! * @brief Returns title diff --git a/src/easy/entities/mention.cpp b/src/easy/entities/mention.cpp index 78a369e..052dd0e 100644 --- a/src/easy/entities/mention.cpp +++ b/src/easy/entities/mention.cpp @@ -27,7 +27,7 @@ Mention::Mention() : Entity() {} -const bool Mention::valid() const +bool Mention::valid() const { const std::vector attributes = {{ @@ -45,7 +45,7 @@ const string Mention::acct() const return get_string("acct"); } -const uint_fast64_t Mention::id() const +uint_fast64_t Mention::id() const { return stouint64(get_string("id")); } diff --git a/src/easy/entities/mention.hpp b/src/easy/entities/mention.hpp index c0a7376..36d7851 100644 --- a/src/easy/entities/mention.hpp +++ b/src/easy/entities/mention.hpp @@ -59,7 +59,7 @@ namespace Mastodon */ Mention(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns acct @@ -73,7 +73,7 @@ namespace Mastodon * * @since before 0.11.0 */ - const uint_fast64_t id() const; + uint_fast64_t id() const; /*! * @brief Returns the URL of user's profile diff --git a/src/easy/entities/notification.cpp b/src/easy/entities/notification.cpp index b6d277e..60e5704 100644 --- a/src/easy/entities/notification.cpp +++ b/src/easy/entities/notification.cpp @@ -28,7 +28,7 @@ Notification::Notification() : Entity() {} -const bool Notification::valid() const +bool Notification::valid() const { const std::vector attributes = {{ @@ -58,7 +58,7 @@ const system_clock::time_point Notification::created_at() const return get_time_point("created_at"); } -const uint_fast64_t Notification::id() const +uint_fast64_t Notification::id() const { return stouint64(get_string("id")); } @@ -75,7 +75,7 @@ const Easy::Status Notification::status() const return Easy::Status(); } -const Easy::notification_type Notification::type() const +Easy::notification_type Notification::type() const { const string strtype = get_string("type"); if (strtype.compare("mention") == 0) diff --git a/src/easy/entities/notification.hpp b/src/easy/entities/notification.hpp index b7b766a..acaba32 100644 --- a/src/easy/entities/notification.hpp +++ b/src/easy/entities/notification.hpp @@ -64,7 +64,7 @@ namespace Mastodon */ Notification(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns the Account sending the notification to the user @@ -85,7 +85,7 @@ namespace Mastodon * * @since before 0.11.0 */ - const uint_fast64_t id() const; + uint_fast64_t id() const; /*! * @brief Returns the Status associated with the notification, if @@ -100,7 +100,7 @@ namespace Mastodon * * @since before 0.11.0 */ - const Easy::notification_type type() const; + Easy::notification_type type() const; }; } diff --git a/src/easy/entities/pushsubscription.cpp b/src/easy/entities/pushsubscription.cpp index 3882c89..093666b 100644 --- a/src/easy/entities/pushsubscription.cpp +++ b/src/easy/entities/pushsubscription.cpp @@ -23,7 +23,7 @@ PushSubscription::PushSubscription(const string &json) : Entity(json) {} -const uint_fast64_t PushSubscription::id() const +uint_fast64_t PushSubscription::id() const { return stouint64(get_string("id")); } @@ -32,7 +32,7 @@ PushSubscription::PushSubscription() : Entity() {} -const bool PushSubscription::valid() const +bool PushSubscription::valid() const { const std::vector attributes = {{ @@ -88,7 +88,7 @@ const Easy::alertmap PushSubscription::alerts() const return alerts; } -const bool PushSubscription::s_to_b(const string &str) const +bool PushSubscription::s_to_b(const string &str) const { if (str.compare("true") == 0) { diff --git a/src/easy/entities/pushsubscription.hpp b/src/easy/entities/pushsubscription.hpp index 1f7b50d..68fac5f 100644 --- a/src/easy/entities/pushsubscription.hpp +++ b/src/easy/entities/pushsubscription.hpp @@ -59,14 +59,14 @@ namespace Mastodon */ PushSubscription(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns push subscription ID * * @since 0.14.0 */ - const uint_fast64_t id() const; + uint_fast64_t id() const; /*! * @brief Returns the endpoint URL @@ -97,7 +97,7 @@ namespace Mastodon * * @return `true` if str is equal to "true", `false` otherwise */ - const bool s_to_b(const string &str) const; + bool s_to_b(const string &str) const; }; } diff --git a/src/easy/entities/relationship.cpp b/src/easy/entities/relationship.cpp index 3110778..41c4da7 100644 --- a/src/easy/entities/relationship.cpp +++ b/src/easy/entities/relationship.cpp @@ -27,7 +27,7 @@ Relationship::Relationship() : Entity() {} -const bool Relationship::valid() const +bool Relationship::valid() const { const std::vector attributes = {{ @@ -44,52 +44,52 @@ const bool Relationship::valid() const return Entity::check_valid(attributes); } -const bool Relationship::blocking() const +bool Relationship::blocking() const { return get_bool("blocking"); } -const bool Relationship::domain_blocking() const +bool Relationship::domain_blocking() const { return get_bool("domain_blocking"); } -const bool Relationship::endorsed() const +bool Relationship::endorsed() const { return get_bool("endorsed"); } -const bool Relationship::followed_by() const +bool Relationship::followed_by() const { return get_bool("followed_by"); } -const bool Relationship::following() const +bool Relationship::following() const { return get_bool("following"); } -const uint_fast64_t Relationship::id() const +uint_fast64_t Relationship::id() const { return stouint64(get_string("id")); } -const bool Relationship::muting() const +bool Relationship::muting() const { return get_bool("muting"); } -const bool Relationship::muting_notifications() const +bool Relationship::muting_notifications() const { return get_bool("muting_notifications"); } -const bool Relationship::requested() const +bool Relationship::requested() const { return get_bool("requested"); } -const bool Relationship::showing_notifications() const +bool Relationship::showing_notifications() const { return get_bool("showing_notifications"); } diff --git a/src/easy/entities/relationship.hpp b/src/easy/entities/relationship.hpp index 58fbf71..25343de 100644 --- a/src/easy/entities/relationship.hpp +++ b/src/easy/entities/relationship.hpp @@ -58,77 +58,77 @@ namespace Mastodon */ Relationship(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns true if the user is blocking the account * * @since before 0.11.0 */ - const bool blocking() const; + bool blocking() const; /*! * @brief Returns true if the user is blocking the account's domain * * @since before 0.11.0 */ - const bool domain_blocking() const; + bool domain_blocking() const; /*! * @brief Returns true if the account is endorsed by the user * * @since 0.19.0 */ - const bool endorsed() const; + bool endorsed() const; /*! * @brief Returns true if the user is being followed by the account * * @since before 0.11.0 */ - const bool followed_by() const; + bool followed_by() const; /*! * @brief Returns true if the user is being following the account * * @since before 0.11.0 */ - const bool following() const; + bool following() const; /*! * @brief Returns the target account ID * * @since before 0.11.0 */ - const uint_fast64_t id() const; + uint_fast64_t id() const; /*! * @brief Returns true if the user is muting the account * * @since before 0.11.0 */ - const bool muting() const; + bool muting() const; /*! * @brief Returns true if the user is also muting notifications * * @since before 0.11.0 */ - const bool muting_notifications() const; + bool muting_notifications() const; /*! * @brief Returns true if the user has requested to follow the account * * @since before 0.11.0 */ - const bool requested() const; + bool requested() const; /*! * @brief Returns true if the user is showing notifications * * @since 0.19.0 */ - const bool showing_notifications() const; + bool showing_notifications() const; }; } diff --git a/src/easy/entities/report.cpp b/src/easy/entities/report.cpp index 7a85b5e..53f6608 100644 --- a/src/easy/entities/report.cpp +++ b/src/easy/entities/report.cpp @@ -27,7 +27,7 @@ Report::Report() : Entity() {} -const bool Report::valid() const +bool Report::valid() const { const std::vector attributes = {{ @@ -38,12 +38,12 @@ const bool Report::valid() const return Entity::check_valid(attributes); } -const bool Report::action_taken() const +bool Report::action_taken() const { return get_bool("action_taken"); } -const uint_fast64_t Report::id() const +uint_fast64_t Report::id() const { return stouint64(get_string("id")); } diff --git a/src/easy/entities/report.hpp b/src/easy/entities/report.hpp index ef80a74..5b54d03 100644 --- a/src/easy/entities/report.hpp +++ b/src/easy/entities/report.hpp @@ -58,7 +58,7 @@ namespace Mastodon */ Report(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns true if an action was taken in response to the @@ -66,14 +66,14 @@ namespace Mastodon * * @since before 0.11.0 */ - const bool action_taken() const; + bool action_taken() const; /*! * @brief Returns the ID of the report * * @since before 0.11.0 */ - const uint_fast64_t id() const; + uint_fast64_t id() const; }; } diff --git a/src/easy/entities/results.cpp b/src/easy/entities/results.cpp index e571802..dbd0111 100644 --- a/src/easy/entities/results.cpp +++ b/src/easy/entities/results.cpp @@ -28,7 +28,7 @@ Results::Results() : Entity() {} -const bool Results::valid() const +bool Results::valid() const { const std::vector attributes = {{ diff --git a/src/easy/entities/results.hpp b/src/easy/entities/results.hpp index 685717d..199644b 100644 --- a/src/easy/entities/results.hpp +++ b/src/easy/entities/results.hpp @@ -63,7 +63,7 @@ namespace Mastodon */ Results(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns an array of matched Accounts diff --git a/src/easy/entities/status.cpp b/src/easy/entities/status.cpp index 7e3de1a..41e4e9a 100644 --- a/src/easy/entities/status.cpp +++ b/src/easy/entities/status.cpp @@ -29,7 +29,7 @@ Status::Status() : Entity() {} -const bool Status::valid() const +bool Status::valid() const { const std::vector attributes = {{ @@ -117,22 +117,22 @@ const std::vector Status::emojis() const return {}; } -const bool Status::favourited() const +bool Status::favourited() const { return get_bool("favourited"); } -const uint_fast64_t Status::favourites_count() const +uint_fast64_t Status::favourites_count() const { return get_uint64("favourites_count"); } -const uint_fast64_t Status::id() const +uint_fast64_t Status::id() const { return stouint64(get_string("id")); } -const uint_fast64_t Status::in_reply_to_id() const +uint_fast64_t Status::in_reply_to_id() const { return stouint64(get_string("in_reply_to_id")); } @@ -143,7 +143,7 @@ Status Status::in_reply_to_id(const uint_fast64_t &in_reply_to_id) return *this; } -const uint_fast64_t Status::in_reply_to_account_id() const +uint_fast64_t Status::in_reply_to_account_id() const { return stouint64(get_string("in_reply_to_account_id")); } @@ -205,12 +205,12 @@ const std::vector Status::mentions() const return {}; } -const bool Status::muted() const +bool Status::muted() const { return get_bool("muted"); } -const bool Status::pinned() const +bool Status::pinned() const { return get_bool("pinned"); } @@ -226,22 +226,22 @@ const Status Status::reblog() const return Easy::Status(); } -const bool Status::reblogged() const +bool Status::reblogged() const { return get_bool("reblogged"); } -const uint_fast64_t Status::reblogs_count() const +uint_fast64_t Status::reblogs_count() const { return get_uint64("reblogs_count"); } -const uint_fast64_t Status::replies_count() const +uint_fast64_t Status::replies_count() const { return get_uint64("replies_count"); } -const bool Status::sensitive() const +bool Status::sensitive() const { return get_bool("sensitive"); } @@ -289,7 +289,7 @@ const string Status::url() const return get_string("url"); } -const Easy::visibility_type Status::visibility() const +Easy::visibility_type Status::visibility() const { const string strvisibility = get_string("visibility"); if (strvisibility.compare("public") == 0) diff --git a/src/easy/entities/status.hpp b/src/easy/entities/status.hpp index bc8021d..6222a37 100644 --- a/src/easy/entities/status.hpp +++ b/src/easy/entities/status.hpp @@ -75,7 +75,7 @@ namespace Mastodon */ Status(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns an array of matched accounts. @@ -131,28 +131,28 @@ namespace Mastodon * * @since before 0.11.0 */ - const bool favourited() const; + bool favourited() const; /*! * @brief Returns the number of favourites * * @since before 0.11.0 */ - const uint_fast64_t favourites_count() const; + uint_fast64_t favourites_count() const; /*! * @brief Returns the ID of the status * * @since before 0.11.0 */ - const uint_fast64_t id() const; + uint_fast64_t id() const; /*! * @brief Returns the ID of the status it replies to * * @since before 0.11.0 */ - const uint_fast64_t in_reply_to_id() const; + uint_fast64_t in_reply_to_id() const; /*! * @brief Sets the ID of the status it replies to @@ -166,7 +166,7 @@ namespace Mastodon * * @since before 0.11.0 */ - const uint_fast64_t in_reply_to_account_id() const; + uint_fast64_t in_reply_to_account_id() const; /*! * @brief Returns the language of the status @@ -209,14 +209,14 @@ namespace Mastodon * * @since before 0.11.0 */ - const bool muted() const; + bool muted() const; /*! * @brief Returns true if the status is pinned * * @since before 0.11.0 */ - const bool pinned() const; + bool pinned() const; /*! * @brief Returns the reblogged Status @@ -230,28 +230,28 @@ namespace Mastodon * * @since before 0.11.0 */ - const bool reblogged() const; + bool reblogged() const; /*! * @brief Returns the number of reblogs for the status * * @since before 0.11.0 */ - const uint_fast64_t reblogs_count() const; + uint_fast64_t reblogs_count() const; /*! * @brief Returns the number of replies for the status * * @since 0.19.0 */ - const uint_fast64_t replies_count() const; + uint_fast64_t replies_count() const; /*! * @brief Returns true if the attachments should be hidden by default * * @since before 0.11.0 */ - const bool sensitive() const; + bool sensitive() const; /*! * @brief Sets sensitive flag for attachments @@ -300,7 +300,7 @@ namespace Mastodon * * @since before 0.11.0 */ - const visibility_type visibility() const; + visibility_type visibility() const; /*! * @brief Sets the visibility of the status diff --git a/src/easy/entities/tag.cpp b/src/easy/entities/tag.cpp index 1899483..e2d1a96 100644 --- a/src/easy/entities/tag.cpp +++ b/src/easy/entities/tag.cpp @@ -30,7 +30,7 @@ Tag::Tag() : Entity() {} -const bool Tag::valid() const +bool Tag::valid() const { const std::vector attributes = {{ @@ -77,7 +77,7 @@ Tag::History::History() : Entity() {} -const bool Tag::History::valid() const +bool Tag::History::valid() const { const std::vector attributes = {{ @@ -89,7 +89,7 @@ const bool Tag::History::valid() const return Entity::check_valid(attributes); } -const uint_fast64_t Tag::History::accounts() +uint_fast64_t Tag::History::accounts() { return stouint64(get_string("accounts")); } @@ -108,7 +108,7 @@ const system_clock::time_point Tag::History::day() return system_clock::time_point(); } -const uint_fast64_t Tag::History::uses() +uint_fast64_t Tag::History::uses() { return stouint64(get_string("uses")); } diff --git a/src/easy/entities/tag.hpp b/src/easy/entities/tag.hpp index 46b9214..8e3dec6 100644 --- a/src/easy/entities/tag.hpp +++ b/src/easy/entities/tag.hpp @@ -68,14 +68,14 @@ namespace Mastodon */ History(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns the number of accounts using that hashtag. * * @since 0.16.0 */ - const uint_fast64_t accounts(); + uint_fast64_t accounts(); /*! * @brief Returns the day. @@ -89,7 +89,7 @@ namespace Mastodon * * @since 0.16.0 */ - const uint_fast64_t uses(); + uint_fast64_t uses(); }; /*! @@ -108,7 +108,7 @@ namespace Mastodon */ Tag(); - virtual const bool valid() const; + virtual bool valid() const; /*! * @brief Returns the name of the tag diff --git a/src/easy/entity.cpp b/src/easy/entity.cpp index 79e4cba..3bd5710 100644 --- a/src/easy/entity.cpp +++ b/src/easy/entity.cpp @@ -33,7 +33,7 @@ Easy::Entity::Entity(const string &json) from_string(json); } -const void Easy::Entity::from_string(const string &json) +void Easy::Entity::from_string(const string &json) { std::stringstream ss(json); ss >> _tree; @@ -66,8 +66,7 @@ Easy::Entity::Entity() : _was_set(false) {} -const bool -Easy::Entity::check_valid(const std::vector &attributes) const +bool Easy::Entity::check_valid(const std::vector &attributes) const { for (const string &attribute: attributes) { @@ -86,7 +85,7 @@ const string Easy::Entity::error() const return get_string("error"); } -const bool Easy::Entity::was_set() const +bool Easy::Entity::was_set() const { return _was_set; } @@ -146,7 +145,7 @@ const string Easy::Entity::get_string(const string &key) const return ""; } -const uint_fast64_t Easy::Entity::get_uint64(const string &key) const +uint_fast64_t Easy::Entity::get_uint64(const string &key) const { const Json::Value node = get(key); @@ -160,7 +159,7 @@ const uint_fast64_t Easy::Entity::get_uint64(const string &key) const return 0; } -const double Easy::Entity::get_double(const string &key) const +double Easy::Entity::get_double(const string &key) const { const Json::Value node = get(key); @@ -174,7 +173,7 @@ const double Easy::Entity::get_double(const string &key) const return 0.0; } -const bool Easy::Entity::get_bool(const string &key) const +bool Easy::Entity::get_bool(const string &key) const { const Json::Value node = get(key); @@ -196,7 +195,7 @@ const system_clock::time_point if (node.isString()) { std::stringstream sstime(node.asString()); - struct std::tm tm = {0}; + struct std::tm tm; sstime >> std::get_time(&tm, "%Y-%m-%dT%T"); std::time_t time = timegm(&tm); _was_set = true; @@ -227,7 +226,7 @@ const std::vector Easy::Entity::get_vector(const string &key) const return {}; } -const void Easy::Entity::set(const string &key, const Json::Value &value) +void Easy::Entity::set(const string &key, const Json::Value &value) { if (key.find('.') == std::string::npos) { @@ -265,7 +264,7 @@ const void Easy::Entity::set(const string &key, const Json::Value &value) ttdebug << "Could not set data: " << key << '\n'; } -const std::uint_fast64_t Easy::Entity::stouint64(const string &str) const +std::uint_fast64_t Easy::Entity::stouint64(const string &str) const { if (str == "") { diff --git a/src/http.cpp b/src/http.cpp index a7593ed..1df9eaa 100644 --- a/src/http.cpp +++ b/src/http.cpp @@ -44,17 +44,17 @@ API::http::~http() curlpp::terminate(); } -const uint_fast16_t API::http::request(const method &meth, - const string &path, - string &answer) +uint_fast16_t API::http::request(const method &meth, + const string &path, + string &answer) { return request(meth, path, curlpp::Forms(), answer); } -const uint_fast16_t API::http::request(const method &meth, - const string &path, - const curlpp::Forms &formdata, - string &answer) +uint_fast16_t API::http::request(const method &meth, + const string &path, + const curlpp::Forms &formdata, + string &answer) { using namespace std::placeholders; // _1, _2, _3 @@ -119,8 +119,10 @@ const uint_fast16_t API::http::request(const method &meth, break; case http::method::PUT: request.setOpt("PUT"); + break; case http::method::DELETE: request.setOpt("DELETE"); + break; default: break; } @@ -194,25 +196,25 @@ const uint_fast16_t API::http::request(const method &meth, } } -const void API::http::get_headers(string &headers) const +void API::http::get_headers(string &headers) const { headers = _headers; } -const size_t API::http::callback_write(char* data, size_t size, size_t nmemb, - string *str) +size_t API::http::callback_write(char* data, size_t size, size_t nmemb, + string *str) { std::lock_guard lock(_mutex); str->append(data, size * nmemb); // ttdebug << "Received " << size * nmemb << " Bytes\n"; return size * nmemb; -}; +} -const size_t API::http::callback(char* data, size_t size, size_t nmemb, - string *str) +size_t API::http::callback(char* data, size_t size, size_t nmemb, + string *str) { return callback_write(data, size, nmemb, str); -}; +} double API::http::callback_progress(double /* dltotal */, double /* dlnow */, double /* ultotal */, double /* ulnow */) @@ -223,14 +225,14 @@ double API::http::callback_progress(double /* dltotal */, double /* dlnow */, return 1; } return 0; -}; +} -const void API::http::cancel_stream() +void API::http::cancel_stream() { _cancel_stream = true; } -const void API::http::abort_stream() +void API::http::abort_stream() { cancel_stream(); } diff --git a/src/mastodon-cpp.cpp b/src/mastodon-cpp.cpp index 804a4ca..e675063 100644 --- a/src/mastodon-cpp.cpp +++ b/src/mastodon-cpp.cpp @@ -39,7 +39,7 @@ API::API(const string &instance, const string &access_token) // } -const void API::set_useragent(const std::string &useragent) +void API::set_useragent(const std::string &useragent) { _useragent = useragent; } @@ -148,25 +148,25 @@ const std::string API::urldecode(const std::string &str) return curlpp::unescape(str); } -const uint_fast16_t API::register_app1(const string &instance, - const string &client_name, - const string &redirect_uri, - const string &scopes, - const string &website, - string &client_id, - string &client_secret, - string &url) +uint_fast16_t API::register_app1(const string &instance, + const string &client_name, + const string &redirect_uri, + const string &scopes, + const string &website, + string &client_id, + string &client_secret, + string &url) { return register_app1(client_name, redirect_uri, scopes, website, client_id, client_secret, url); } -const uint_fast16_t API::register_app1(const string &client_name, - const string &redirect_uri, - const string &scopes, - const string &website, - string &client_id, - string &client_secret, - string &url) +uint_fast16_t API::register_app1(const string &client_name, + const string &redirect_uri, + const string &scopes, + const string &website, + string &client_id, + string &client_secret, + string &url) { API::parametermap parameters = { @@ -214,21 +214,21 @@ const uint_fast16_t API::register_app1(const string &client_name, } -const uint_fast16_t API::register_app2(const string &instance, - const string &client_id, - const string &client_secret, - const string &redirect_uri, - const string &code, - string &access_token) +uint_fast16_t API::register_app2(const string &instance, + const string &client_id, + const string &client_secret, + const string &redirect_uri, + const string &code, + string &access_token) { return register_app2(client_id, client_secret, redirect_uri, code, access_token); } -const uint_fast16_t API::register_app2(const string &client_id, - const string &client_secret, - const string &redirect_uri, - const string &code, - string &access_token) +uint_fast16_t API::register_app2(const string &client_id, + const string &client_secret, + const string &redirect_uri, + const string &code, + string &access_token) { API::parametermap parameters = { @@ -280,7 +280,7 @@ bool API::exceptions(const bool &value) return _exceptions; } -const bool API::exceptions() const +bool API::exceptions() const { return _exceptions; } @@ -586,13 +586,13 @@ const string API::unescape_html(const string &html) return output; } -const void API::set_proxy(const string &proxy, const string &userpw) +void API::set_proxy(const string &proxy, const string &userpw) { _proxy = proxy; _proxy_userpw = userpw; } -const void API::get_proxy(string &proxy, string &userpw) const +void API::get_proxy(string &proxy, string &userpw) const { if (!_proxy.empty()) { diff --git a/src/mastodon-cpp.hpp b/src/mastodon-cpp.hpp index 6d9001d..515dfcd 100644 --- a/src/mastodon-cpp.hpp +++ b/src/mastodon-cpp.hpp @@ -101,7 +101,7 @@ public: explicit http(const API &api, const string &instance, const string &access_token); ~http(); - const uint_fast16_t request(const method &meth, + uint_fast16_t request(const method &meth, const string &path, string &answer); @@ -118,7 +118,7 @@ public: * * @since before 0.11.0 */ - const uint_fast16_t request(const method &meth, + uint_fast16_t request(const method &meth, const string &path, const curlpp::Forms &formdata, string &answer); @@ -126,7 +126,7 @@ public: /*! * @brief Get all headers in a string */ - const void get_headers(string &headers) const; + void get_headers(string &headers) const; /*! * @brief Cancels the stream. Use only with streams. @@ -138,10 +138,10 @@ public: * * @since 0.12.2 */ - const void cancel_stream(); + void cancel_stream(); [[deprecated("Will vanish in 1.0.0. Use cancel_stream() instead.")]] - const void abort_stream(); + void abort_stream(); /*! * @brief Gets the mutex guarding the string that is written to. @@ -163,10 +163,10 @@ public: bool _cancel_stream; std::mutex _mutex; - const size_t callback_write(char* data, size_t size, size_t nmemb, + size_t callback_write(char* data, size_t size, size_t nmemb, string *oss); [[deprecated("Will vanish in 1.0.0. Use callback_write() instead.")]] - const size_t callback(char* data, size_t size, size_t nmemb, + size_t callback(char* data, size_t size, size_t nmemb, string *oss); double callback_progress(double /* dltotal */, double /* dlnow */, double /* ultotal */, double /* ulnow */); @@ -304,7 +304,7 @@ public: * * @since before 0.11.0 */ - const void set_useragent(const string &useragent); + void set_useragent(const string &useragent); /*! * @brief Gets the useragent. @@ -375,23 +375,23 @@ public: * * @since before 0.11.0 */ - const uint_fast16_t register_app1(const string &client_name, - const string &redirect_uri, - const string &scopes, - const string &website, - string &client_id, - string &client_secret, - string &url); + uint_fast16_t register_app1(const string &client_name, + const string &redirect_uri, + const string &scopes, + const string &website, + string &client_id, + string &client_secret, + string &url); [[deprecated("Will vanish in 1.0.0")]] - const uint_fast16_t register_app1(const string &instance, - const string &client_name, - const string &redirect_uri, - const string &scopes, - const string &website, - string &client_id, - string &client_secret, - string &url); + uint_fast16_t register_app1(const string &instance, + const string &client_name, + const string &redirect_uri, + const string &scopes, + const string &website, + string &client_id, + string &client_secret, + string &url); /*! * @brief Register application, step 2/2 @@ -408,19 +408,19 @@ public: * * @since before 0.11.0 */ - const uint_fast16_t register_app2(const string &client_id, - const string &client_secret, - const string &redirect_uri, - const string &code, - string &access_token); + uint_fast16_t register_app2(const string &client_id, + const string &client_secret, + const string &redirect_uri, + const string &code, + string &access_token); [[deprecated("Will vanish in 1.0.0")]] - const uint_fast16_t register_app2(const string &instance, - const string &client_id, - const string &client_secret, - const string &redirect_uri, - const string &code, - string &access_token); + uint_fast16_t register_app2(const string &instance, + const string &client_id, + const string &client_secret, + const string &redirect_uri, + const string &code, + string &access_token); /*! * @brief Gets the header from the last answer. @@ -450,7 +450,7 @@ public: /*! * @brief Returns true if exceptions are turned on, false otherwise */ - const bool exceptions() const; + bool exceptions() const; /*! * @brief Replaces HTML entities with UTF-8 characters @@ -472,7 +472,7 @@ public: * * @since 0.15.0 */ - const void set_proxy(const string &proxy, const string &userpw = ""); + void set_proxy(const string &proxy, const string &userpw = ""); /*! * @brief For internal use @@ -482,7 +482,7 @@ public: * * @since 0.15.1 */ - const void get_proxy(string &proxy, string &userpw) const; + void get_proxy(string &proxy, string &userpw) const; /*! * @brief Make a GET request which doesn't require parameters. @@ -495,7 +495,7 @@ public: * * @since before 0.11.0 */ - const uint_fast16_t get(const Mastodon::API::v1 &call, string &answer); + uint_fast16_t get(const Mastodon::API::v1 &call, string &answer); /*! * @brief Make a GET request which requires parameters. @@ -508,18 +508,18 @@ public: * @return @ref error "Error code". If the URL has permanently changed, 13 * is returned and answer is set to the new URL. */ - const uint_fast16_t get(const Mastodon::API::v1 &call, - const parametermap ¶meters, - string &answer); + uint_fast16_t get(const Mastodon::API::v1 &call, + const parametermap ¶meters, + string &answer); /*! * @brief Make a GET request which requires parameters. * * @since 0.16.0 */ - const uint_fast16_t get(const Mastodon::API::v2 &call, - const parametermap ¶meters, - string &answer); + uint_fast16_t get(const Mastodon::API::v2 &call, + const parametermap ¶meters, + string &answer); /*! * @brief Make a custom GET request. @@ -533,20 +533,20 @@ public: * * @since before 0.11.0 */ - const uint_fast16_t get(const string &call, string &answer); + uint_fast16_t get(const string &call, string &answer); [[deprecated("Will vanish in 1.0.0, use get() without string argument " "instead.")]] - const uint_fast16_t get(const Mastodon::API::v1 &call, - const string &argument, - string &answer); + uint_fast16_t get(const Mastodon::API::v1 &call, + const string &argument, + string &answer); [[deprecated("Will vanish in 1.0.0, use get() without string argument " "instead.")]] - const uint_fast16_t get(const Mastodon::API::v1 &call, - const string &argument, - const parametermap ¶meters, - string &answer); + uint_fast16_t get(const Mastodon::API::v1 &call, + const string &argument, + const parametermap ¶meters, + string &answer); /*! * @brief Make a streaming GET request. @@ -562,10 +562,10 @@ public: * * @since before 0.11.0 */ - const uint_fast16_t get_stream(const Mastodon::API::v1 &call, - const parametermap ¶meters, - string &answer, - std::unique_ptr &ptr); + uint_fast16_t get_stream(const Mastodon::API::v1 &call, + const parametermap ¶meters, + string &answer, + std::unique_ptr &ptr); /*! * @brief Make a streaming GET request. @@ -580,9 +580,9 @@ public: * * @since before 0.11.0 */ - const uint_fast16_t get_stream(const Mastodon::API::v1 &call, - string &answer, - std::unique_ptr &ptr); + uint_fast16_t get_stream(const Mastodon::API::v1 &call, + string &answer, + std::unique_ptr &ptr); /*! * @brief Make a streaming GET request. @@ -598,16 +598,16 @@ public: * * @since before 0.11.0 */ - const uint_fast16_t get_stream(const string &call, - string &answer, - std::unique_ptr &ptr); + uint_fast16_t get_stream(const string &call, + string &answer, + std::unique_ptr &ptr); [[deprecated("Will vanish in 1.0.0, use get_stream() without string " "argument instead.")]] - const uint_fast16_t get_stream(const Mastodon::API::v1 &call, - const string &argument, - string &answer, - std::unique_ptr &ptr); + uint_fast16_t get_stream(const Mastodon::API::v1 &call, + const string &argument, + string &answer, + std::unique_ptr &ptr); /*! * @brief Make a PATCH request. @@ -624,9 +624,9 @@ public: * * @since before 0.11.0 */ - const uint_fast16_t patch(const Mastodon::API::v1 &call, - const parametermap ¶meters, - string &answer); + uint_fast16_t patch(const Mastodon::API::v1 &call, + const parametermap ¶meters, + string &answer); /*! * @brief Make a POST request which doesn't require parameters. @@ -640,7 +640,7 @@ public: * * @since before 0.11.0 */ - const uint_fast16_t post(const Mastodon::API::v1 &call, string &answer); + uint_fast16_t post(const Mastodon::API::v1 &call, string &answer); /*! * @brief Make a POST request which requires parameters. @@ -657,9 +657,9 @@ public: * * @since before 0.11.0 */ - const uint_fast16_t post(const Mastodon::API::v1 &call, - const parametermap ¶meters, - string &answer); + uint_fast16_t post(const Mastodon::API::v1 &call, + const parametermap ¶meters, + string &answer); /*! * @brief Make a custom POST request. @@ -676,22 +676,22 @@ public: * * @since before 0.11.0 */ - const uint_fast16_t post(const string &call, - const parametermap ¶meters, - string &answer); + uint_fast16_t post(const string &call, + const parametermap ¶meters, + string &answer); [[deprecated("Will vanish in 1.0.0, use post() without string argument " "instead.")]] - const uint_fast16_t post(const Mastodon::API::v1 &call, - const string &argument, - string &answer); + uint_fast16_t post(const Mastodon::API::v1 &call, + const string &argument, + string &answer); [[deprecated("Will vanish in 1.0.0, use post() without string argument " "instead.")]] - const uint_fast16_t post(const Mastodon::API::v1 &call, - const string &argument, - const parametermap ¶meters, - string &answer); + uint_fast16_t post(const Mastodon::API::v1 &call, + const string &argument, + const parametermap ¶meters, + string &answer); /*! * @brief Make a PUT request which requires a parameters. @@ -707,9 +707,9 @@ public: * * @since before 0.11.0 */ - const uint_fast16_t put(const Mastodon::API::v1 &call, - const parametermap ¶meters, - string &answer); + uint_fast16_t put(const Mastodon::API::v1 &call, + const parametermap ¶meters, + string &answer); /*! * @brief Make a custom PUT request. @@ -725,16 +725,16 @@ public: * * @since before 0.11.0 */ - const uint_fast16_t put(const string &call, + uint_fast16_t put(const string &call, const parametermap ¶meters, string &answer); [[deprecated("Will vanish in 1.0.0, use put() without string argument " "instead.")]] - const uint_fast16_t put(const Mastodon::API::v1 &call, - const string &argument, - const parametermap ¶meters, - string &answer); + uint_fast16_t put(const Mastodon::API::v1 &call, + const string &argument, + const parametermap ¶meters, + string &answer); /*! * @brief Make a DELETE request which requires parameters. @@ -746,8 +746,8 @@ public: * * @since before 0.11.0 */ - const uint_fast16_t del(const Mastodon::API::v1 &call, - const parametermap ¶meters); + uint_fast16_t del(const Mastodon::API::v1 &call, + const parametermap ¶meters); /*! * @brief Make a custom DELETE request. @@ -762,20 +762,20 @@ public: * * @since before 0.11.0 */ - const uint_fast16_t del(const string &call, - const parametermap ¶meters, - string &answer); + uint_fast16_t del(const string &call, + const parametermap ¶meters, + string &answer); [[deprecated("Will vanish in 1.0.0, use del() without string argument " "instead.")]] - const uint_fast16_t del(const Mastodon::API::v1 &call, - const string &argument); + uint_fast16_t del(const Mastodon::API::v1 &call, + const string &argument); [[deprecated("Will vanish in 1.0.0, use del() without string argument " "instead.")]] - const uint_fast16_t del(const Mastodon::API::v1 &call, - const string &argument, - const parametermap ¶meters); + uint_fast16_t del(const Mastodon::API::v1 &call, + const string &argument, + const parametermap ¶meters); private: const string _instance;