From a6f0b20bc57d89267fcf9224a5aa842efa441f5f Mon Sep 17 00:00:00 2001 From: tastytea Date: Wed, 4 Apr 2018 04:38:04 +0200 Subject: [PATCH] refactoring, documentation-enhancement --- src/easy/easy.hpp | 4 ++++ src/easy/entities/notification.cpp | 2 +- src/mastodon-cpp.hpp | 12 +++++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/easy/easy.hpp b/src/easy/easy.hpp index f5c3439..d774e7b 100644 --- a/src/easy/easy.hpp +++ b/src/easy/easy.hpp @@ -116,6 +116,9 @@ public: class Link { public: + /*! + * @param link_header The content of the `Link` header + */ explicit Link(const string &link_header); /*! @@ -273,6 +276,7 @@ public: */ const std::vector get_vector(const string &key) const; + private: Json::Value _tree; bool _valid; }; diff --git a/src/easy/entities/notification.cpp b/src/easy/entities/notification.cpp index 52d0d08..bee5a31 100644 --- a/src/easy/entities/notification.cpp +++ b/src/easy/entities/notification.cpp @@ -30,7 +30,7 @@ Notification::Notification() const Easy::Account Notification::account() const { - const Json::Value node = _tree["account"]; + const Json::Value node = get("account"); if (node.isObject()) { return Easy::Account(node.toStyledString()); diff --git a/src/mastodon-cpp.hpp b/src/mastodon-cpp.hpp index 944e0e1..0dda7dd 100644 --- a/src/mastodon-cpp.hpp +++ b/src/mastodon-cpp.hpp @@ -80,6 +80,9 @@ public: class http { public: + /*! + * @brief HTTP methods + */ enum class method { GET, @@ -113,11 +116,11 @@ public: const curlpp::Forms &formdata, string &answer); + /*! + * @brief Get all headers in a string + */ const void get_headers(string &headers) const; - const size_t callback(char* data, size_t size, size_t nmemb, - string *oss); - /*! * @brief Aborts the stream. Use only with streams. * @@ -134,6 +137,9 @@ public: const string _access_token; string _headers; bool _abort_stream; + + const size_t callback(char* data, size_t size, size_t nmemb, + string *oss); }; /*!