Merge branch 'develop' into main
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
tastytea 2020-01-14 23:50:05 +01:00
commit 11608abed8
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
6 changed files with 30 additions and 7 deletions

View File

@ -113,7 +113,7 @@ yum install ./libmastodonpp*.rpm
* Optional
** Documentation: link:{uri-doxygen}[Doxygen] (tested: 1.8)
** Tests: link:{uri-catch}[Catch] (tested: 2.5 / 1.2)
** DEB package: link:{uri-dpkg}[dpkg] (tested: 1.18)
** DEB package: link:{uri-dpkg}[dpkg] (tested: 1.19)
** RPM package: link:{uri-rpm-build}[rpm-build] (tested: 4.11)
==== Get sourcecode

View File

@ -229,7 +229,7 @@ protected:
*
* @since 0.1.0
*/
void set_access_token(const string_view access_token);
void set_access_token(string_view access_token);
/*!
@ -239,6 +239,11 @@ protected:
*/
void set_cainfo(string_view path);
/*!
* @brief Sets the User-Agent.
*
* @since 0.3.0
*/
void set_useragent(string_view useragent);
private:

View File

@ -189,6 +189,14 @@ public:
CURLWrapper::set_cainfo(path);
}
/*!
* @brief Sets the User-Agent.
*
* Sets also the User-Agent for all Connection%s that are initialized with
* this Instance afterwards.
*
* @since 0.3.0
*/
void set_useragent(const string_view useragent)
{
_useragent = useragent;
@ -205,8 +213,8 @@ public:
*
* Example:
* @code
* mastodonpp::Instance instance("example.com", {});
* mastodonpp::Instance::ObtainToken token(instance);
* mastodonpp::Instance instance{"example.com", {}};
* mastodonpp::Instance::ObtainToken token{instance};
* auto answer{token.step1("Good program", "read:blocks read:mutes", "")};
* if (answer)
* {
@ -226,7 +234,12 @@ public:
class ObtainToken : public CURLWrapper
{
public:
ObtainToken(Instance &instance)
/*!
* @brief Constructor.
*
* @since 0.3.0
*/
explicit ObtainToken(Instance &instance)
: _instance{instance}
, _baseuri{instance.get_baseuri()}
{

View File

@ -189,6 +189,7 @@ private:
*
* @since 0.3.0
*/
[[nodiscard]]
parametermap parse_pagination(bool next) const;
};

View File

@ -30,7 +30,7 @@ namespace mastodonpp
using std::get;
using std::holds_alternative;
using std::any_of;
using std::array;
using std::array; // NOLINT(misc-unused-using-decls)
using std::atomic;
using std::uint8_t;
using std::uint16_t;
@ -251,6 +251,7 @@ void CURLWrapper::set_access_token(const string_view access_token)
void CURLWrapper::set_cainfo(const string_view path)
{
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
CURLcode code{curl_easy_setopt(_connection, CURLOPT_CAINFO, path.data())};
if (code != CURLE_OK)
{

View File

@ -23,7 +23,7 @@
namespace mastodonpp
{
using std::cerr;
using std::cerr; // NOLINT(misc-unused-using-decls)
using std::string_view;
//! @private
@ -40,13 +40,16 @@ constexpr auto shorten_filename(const string_view &filename)
return filename;
}
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define commonlog cerr << '[' << shorten_filename(__FILE__) \
<< ':' << __LINE__ << ']'
#ifndef NDEBUG
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define debuglog commonlog << " DEBUG: "
#else
#define debuglog false && cerr
#endif
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define errorlog commonlog << " ERROR: "
} // namespace mastodonpp