Reformat header files.
This commit is contained in:
parent
63d2497966
commit
8c7493e68e
@ -339,8 +339,7 @@ public:
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
inline string_view to_string_view() const
|
||||
[[nodiscard]] inline string_view to_string_view() const
|
||||
{
|
||||
return _endpoint_map.at(_endpoint);
|
||||
}
|
||||
|
@ -129,8 +129,7 @@ public:
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
answer_type get(const endpoint_variant &endpoint,
|
||||
[[nodiscard]] answer_type get(const endpoint_variant &endpoint,
|
||||
const parametermap ¶meters);
|
||||
|
||||
/*!
|
||||
@ -145,8 +144,7 @@ public:
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
inline answer_type get(const endpoint_variant &endpoint)
|
||||
[[nodiscard]] inline answer_type get(const endpoint_variant &endpoint)
|
||||
{
|
||||
return get(endpoint, {});
|
||||
}
|
||||
@ -171,8 +169,7 @@ public:
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
answer_type post(const endpoint_variant &endpoint,
|
||||
[[nodiscard]] answer_type post(const endpoint_variant &endpoint,
|
||||
const parametermap ¶meters);
|
||||
|
||||
/*!
|
||||
@ -182,8 +179,7 @@ public:
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
inline answer_type post(const endpoint_variant &endpoint)
|
||||
[[nodiscard]] inline answer_type post(const endpoint_variant &endpoint)
|
||||
{
|
||||
return post(endpoint, {});
|
||||
}
|
||||
@ -197,8 +193,7 @@ public:
|
||||
*
|
||||
* @since 0.2.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
answer_type patch(const endpoint_variant &endpoint,
|
||||
[[nodiscard]] answer_type patch(const endpoint_variant &endpoint,
|
||||
const parametermap ¶meters);
|
||||
|
||||
/*!
|
||||
@ -208,8 +203,7 @@ public:
|
||||
*
|
||||
* @since 0.2.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
inline answer_type patch(const endpoint_variant &endpoint)
|
||||
[[nodiscard]] inline answer_type patch(const endpoint_variant &endpoint)
|
||||
{
|
||||
return patch(endpoint, {});
|
||||
}
|
||||
@ -223,8 +217,7 @@ public:
|
||||
*
|
||||
* @since 0.2.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
answer_type put(const endpoint_variant &endpoint,
|
||||
[[nodiscard]] answer_type put(const endpoint_variant &endpoint,
|
||||
const parametermap ¶meters);
|
||||
|
||||
/*!
|
||||
@ -234,8 +227,7 @@ public:
|
||||
*
|
||||
* @since 0.2.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
inline answer_type put(const endpoint_variant &endpoint)
|
||||
[[nodiscard]] inline answer_type put(const endpoint_variant &endpoint)
|
||||
{
|
||||
return put(endpoint, {});
|
||||
}
|
||||
@ -249,8 +241,7 @@ public:
|
||||
*
|
||||
* @since 0.2.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
answer_type del(const endpoint_variant &endpoint,
|
||||
[[nodiscard]] answer_type del(const endpoint_variant &endpoint,
|
||||
const parametermap ¶meters);
|
||||
|
||||
/*!
|
||||
@ -260,8 +251,7 @@ public:
|
||||
*
|
||||
* @since 0.2.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
inline answer_type del(const endpoint_variant &endpoint)
|
||||
[[nodiscard]] inline answer_type del(const endpoint_variant &endpoint)
|
||||
{
|
||||
return del(endpoint, {});
|
||||
}
|
||||
@ -291,12 +281,13 @@ public:
|
||||
{
|
||||
CURLWrapper::cancel_stream();
|
||||
}
|
||||
|
||||
private:
|
||||
const Instance &_instance;
|
||||
const string_view _baseuri;
|
||||
|
||||
[[nodiscard]]
|
||||
string endpoint_to_uri(const endpoint_variant &endpoint) const;
|
||||
[[nodiscard]] string
|
||||
endpoint_to_uri(const endpoint_variant &endpoint) const;
|
||||
};
|
||||
|
||||
} // namespace mastodonpp
|
||||
|
@ -17,9 +17,8 @@
|
||||
#ifndef MASTODONPP_CURL_WRAPPER_HPP
|
||||
#define MASTODONPP_CURL_WRAPPER_HPP
|
||||
|
||||
#include "types.hpp"
|
||||
|
||||
#include "curl/curl.h"
|
||||
#include "types.hpp"
|
||||
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
@ -162,8 +161,7 @@ public:
|
||||
*/
|
||||
void setup_connection_properties(string_view proxy,
|
||||
string_view access_token,
|
||||
string_view cainfo,
|
||||
string_view useragent);
|
||||
string_view cainfo, string_view useragent);
|
||||
|
||||
protected:
|
||||
/*!
|
||||
@ -185,8 +183,8 @@ protected:
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
answer_type make_request(const http_method &method, string uri,
|
||||
[[nodiscard]] answer_type make_request(const http_method &method,
|
||||
string uri,
|
||||
const parametermap ¶meters);
|
||||
|
||||
/*!
|
||||
@ -194,8 +192,7 @@ protected:
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
inline string &get_buffer()
|
||||
[[nodiscard]] inline string &get_buffer()
|
||||
{
|
||||
return _curl_buffer_body;
|
||||
}
|
||||
@ -233,7 +230,6 @@ protected:
|
||||
*/
|
||||
void set_access_token(string_view access_token);
|
||||
|
||||
|
||||
/*!
|
||||
* @brief Set path to Certificate Authority (CA) bundle.
|
||||
*
|
||||
@ -352,8 +348,8 @@ private:
|
||||
*
|
||||
* @since 0.2.0
|
||||
*/
|
||||
static void add_mime_part(curl_mime *mime,
|
||||
string_view name, string_view data);
|
||||
static void add_mime_part(curl_mime *mime, string_view name,
|
||||
string_view data);
|
||||
|
||||
/*!
|
||||
* @brief Convert parametermap to `*curl_mime`.
|
||||
|
@ -26,9 +26,9 @@
|
||||
namespace mastodonpp
|
||||
{
|
||||
|
||||
using std::uint16_t;
|
||||
using std::exception;
|
||||
using std::string;
|
||||
using std::uint16_t;
|
||||
|
||||
/*!
|
||||
* @brief Exception for libcurl errors.
|
||||
@ -77,8 +77,7 @@ public:
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
const char *what() const noexcept override;
|
||||
[[nodiscard]] const char *what() const noexcept override;
|
||||
|
||||
private:
|
||||
const string _message;
|
||||
|
@ -42,8 +42,7 @@ using std::string;
|
||||
*
|
||||
* @since 0.4.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
string unescape_html(string html);
|
||||
[[nodiscard]] string unescape_html(string html);
|
||||
|
||||
} // namespace mastodonpp
|
||||
|
||||
|
@ -29,9 +29,9 @@
|
||||
namespace mastodonpp
|
||||
{
|
||||
|
||||
using std::uint64_t;
|
||||
using std::string;
|
||||
using std::string_view;
|
||||
using std::uint64_t;
|
||||
using std::vector;
|
||||
|
||||
/*!
|
||||
@ -98,8 +98,7 @@ public:
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
inline string_view get_hostname() const noexcept
|
||||
[[nodiscard]] inline string_view get_hostname() const noexcept
|
||||
{
|
||||
return _hostname;
|
||||
}
|
||||
@ -111,8 +110,7 @@ public:
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
inline string_view get_baseuri() const noexcept
|
||||
[[nodiscard]] inline string_view get_baseuri() const noexcept
|
||||
{
|
||||
return _baseuri;
|
||||
}
|
||||
@ -122,8 +120,7 @@ public:
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
inline string_view get_access_token() const noexcept
|
||||
[[nodiscard]] inline string_view get_access_token() const noexcept
|
||||
{
|
||||
return _access_token;
|
||||
}
|
||||
@ -153,8 +150,7 @@ public:
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
uint64_t get_max_chars() noexcept;
|
||||
[[nodiscard]] uint64_t get_max_chars() noexcept;
|
||||
|
||||
/*! @copydoc CURLWrapper::set_proxy(string_view)
|
||||
*
|
||||
@ -176,8 +172,7 @@ public:
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
answer_type get_nodeinfo();
|
||||
[[nodiscard]] answer_type get_nodeinfo();
|
||||
|
||||
/*!
|
||||
* @brief Returns the allowed mime types for statuses.
|
||||
@ -284,8 +279,8 @@ public:
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
answer_type step_1(string_view client_name, string_view scopes,
|
||||
[[nodiscard]] answer_type step_1(string_view client_name,
|
||||
string_view scopes,
|
||||
string_view website);
|
||||
|
||||
/*!
|
||||
@ -303,8 +298,7 @@ public:
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
answer_type step_2(string_view code);
|
||||
[[nodiscard]] answer_type step_2(string_view code);
|
||||
|
||||
private:
|
||||
Instance &_instance;
|
||||
|
@ -31,13 +31,13 @@
|
||||
namespace mastodonpp
|
||||
{
|
||||
|
||||
using std::uint8_t;
|
||||
using std::uint16_t;
|
||||
using std::map;
|
||||
using std::ostream;
|
||||
using std::pair;
|
||||
using std::string;
|
||||
using std::string_view;
|
||||
using std::pair;
|
||||
using std::uint16_t;
|
||||
using std::uint8_t;
|
||||
using std::variant;
|
||||
using std::vector;
|
||||
|
||||
@ -60,16 +60,16 @@ using std::vector;
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
using parametermap =
|
||||
map<string_view, variant<string_view, vector<string_view>>>;
|
||||
using parametermap = map<string_view,
|
||||
variant<string_view, vector<string_view>>>;
|
||||
|
||||
/*!
|
||||
* @brief A single parameter of a parametermap.
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
using parameterpair =
|
||||
pair<string_view, variant<string_view, vector<string_view>>>;
|
||||
using parameterpair = pair<string_view,
|
||||
variant<string_view, vector<string_view>>>;
|
||||
|
||||
/*!
|
||||
* @brief Return type for Request%s.
|
||||
@ -149,8 +149,7 @@ struct answer_type
|
||||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
string_view get_header(string_view field) const;
|
||||
[[nodiscard]] string_view get_header(string_view field) const;
|
||||
|
||||
/*!
|
||||
* @brief Returns the parameters needed for the next entries.
|
||||
@ -159,8 +158,7 @@ struct answer_type
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
inline parametermap next() const
|
||||
[[nodiscard]] inline parametermap next() const
|
||||
{
|
||||
return parse_pagination(true);
|
||||
}
|
||||
@ -173,8 +171,7 @@ struct answer_type
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
inline parametermap prev() const
|
||||
[[nodiscard]] inline parametermap prev() const
|
||||
{
|
||||
return parse_pagination(false);
|
||||
}
|
||||
@ -188,8 +185,7 @@ private:
|
||||
*
|
||||
* @since 0.3.0
|
||||
*/
|
||||
[[nodiscard]]
|
||||
parametermap parse_pagination(bool next) const;
|
||||
[[nodiscard]] parametermap parse_pagination(bool next) const;
|
||||
};
|
||||
|
||||
} // namespace mastodonpp
|
||||
|
@ -41,8 +41,8 @@ constexpr auto shorten_filename(const string_view &filename)
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
#define commonlog cerr << '[' << shorten_filename(__FILE__) \
|
||||
<< ':' << __LINE__ << ']'
|
||||
#define commonlog \
|
||||
cerr << '[' << shorten_filename(__FILE__) << ':' << __LINE__ << ']'
|
||||
#ifndef NDEBUG
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
# define debuglog commonlog << " DEBUG: "
|
||||
|
Loading…
x
Reference in New Issue
Block a user