summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortastytea2020-03-21 11:27:02 +0100
committertastytea2020-03-21 11:38:34 +0100
commit5bf1e9bf252233e5bda05b98041e1386537e8ae5 (patch)
tree51ea71b0a94c8b8ebdc947c44163340fbf7afbaf
parent251d8a975ccf8ee4a635f1b4bd510c13de4eff5a (diff)
downloadmastodonpp-5bf1e9bf252233e5bda05b98041e1386537e8ae5.tar
mastodonpp-5bf1e9bf252233e5bda05b98041e1386537e8ae5.tar.gz
mastodonpp-5bf1e9bf252233e5bda05b98041e1386537e8ae5.zip
Define copy constructor for instance.
Needed because the underlying CURLWrapper is not copied but freshly created, so access_token, proxy, cainfo and useragent have to be set.
-rw-r--r--include/instance.hpp2
-rw-r--r--src/instance.cpp15
2 files changed, 16 insertions, 1 deletions
diff --git a/include/instance.hpp b/include/instance.hpp
index de21c19..214be77 100644
--- a/include/instance.hpp
+++ b/include/instance.hpp
@@ -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;
diff --git a/src/instance.cpp b/src/instance.cpp
index f410b27..5056242 100644
--- a/src/instance.cpp
+++ b/src/instance.cpp
@@ -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};