Define copy constructor for instance.
continuous-integration/drone/push Build is passing Details

Needed because the underlying CURLWrapper is not copied but freshly created, so
access_token, proxy, cainfo and useragent have to be set.
This commit is contained in:
tastytea 2020-03-21 11:27:02 +01:00
parent 251d8a975c
commit 5bf1e9bf25
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 16 additions and 1 deletions

View File

@ -64,7 +64,7 @@ public:
*
* @since 0.5.2
*/
Instance(const Instance &other) = default;
Instance(const Instance &other);
//! Move constructor
Instance(Instance &&other) noexcept = delete;

View File

@ -39,6 +39,21 @@ Instance::Instance(const string_view hostname, const string_view access_token)
set_access_token(access_token);
}
Instance::Instance(const Instance &other)
: CURLWrapper{other}
, _hostname{other._hostname}
, _baseuri{other._baseuri}
, _access_token{other._access_token}
, _max_chars{other._max_chars}
, _proxy{other._proxy}
, _post_formats{other._post_formats}
, _cainfo{other._cainfo}
, _useragent{other._useragent}
{
CURLWrapper::setup_connection_properties(_proxy, _access_token,
_cainfo, _useragent);
}
uint64_t Instance::get_max_chars() noexcept
{
constexpr uint64_t default_max_chars{500};