Merge branch 'develop' into main

This commit is contained in:
tastytea 2020-03-20 13:52:59 +01:00
commit 778b7c3a5f
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
4 changed files with 69 additions and 5 deletions

View File

@ -92,6 +92,25 @@ public:
_instance.copy_connection_properties(*this);
}
/*!
* @brief Copy constructor. A new CURLWrapper is constructed.
*
* @since 0.5.2
*/
Connection(const Connection &other) = default;
//! Move constructor
Connection(Connection &&other) noexcept = delete;
//! Destructor
~Connection() noexcept override = default;
//! Copy assignment operator
Connection& operator=(const Connection &other) = delete;
//! Move assignment operator
Connection& operator=(Connection &&other) noexcept = delete;
/*!
* @brief Make a HTTP GET call with parameters.
*

View File

@ -70,8 +70,12 @@ public:
*/
CURLWrapper();
//! Copy constructor
CURLWrapper(const CURLWrapper &other) = delete;
/*!
* @brief Copy constructor. Does the same as the Constructor.
*
* @since 0.5.2
*/
CURLWrapper(const CURLWrapper &);
//! Move constructor
CURLWrapper(CURLWrapper &&other) noexcept = delete;
@ -253,6 +257,13 @@ private:
string _curl_buffer_body;
bool _stream_cancelled;
/*!
* @brief Initializes curl and sets up connection.
*
* @since 0.5.2
*/
void init();
/*!
* @brief libcurl write callback function.
*

View File

@ -65,6 +65,25 @@ public:
, _max_chars{0}
{}
/*!
* @brief Copy constructor. A new CURLWrapper is constructed.
*
* @since 0.5.2
*/
Instance(const Instance &other) = default;
//! Move constructor
Instance(Instance &&other) noexcept = delete;
//! Destructor
~Instance() noexcept override = default;
//! Copy assignment operator
Instance& operator=(const Instance &other) = delete;
//! Move assignment operator
Instance& operator=(Instance &&other) noexcept = delete;
/*!
* @brief Set the properties of the connection of the calling class up.
*

View File

@ -41,9 +41,7 @@ using std::uint16_t;
// No one will ever need more than 65535 connections. 😉
static atomic<uint16_t> curlwrapper_instances{0};
CURLWrapper::CURLWrapper()
: _curl_buffer_error{}
, _stream_cancelled{false}
void CURLWrapper::init()
{
if (curlwrapper_instances == 0)
{
@ -55,6 +53,23 @@ CURLWrapper::CURLWrapper()
_connection = curl_easy_init();
setup_curl();
}
CURLWrapper::CURLWrapper()
: _connection{}
, _curl_buffer_error{}
, _stream_cancelled{false}
{
init();
}
CURLWrapper::CURLWrapper(const CURLWrapper &)
: _connection{}
, _curl_buffer_error{}
, _stream_cancelled{false}
{
init();
}
CURLWrapper::~CURLWrapper() noexcept
{
curl_easy_cleanup(_connection);