summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-04-06 11:30:10 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2018-04-06 11:51:57 +0100
commit481dfeb9097dbd350b69e700b00787c195fe851c (patch)
tree1e8dac1a01f4b73009bdb1afaf134e60d2d7006b
parentC++17 (diff)
downloadlibadhocutil-481dfeb9097dbd350b69e700b00787c195fe851c.tar.bz2
libadhocutil-481dfeb9097dbd350b69e700b00787c195fe851c.tar.xz
libadhocutil-481dfeb9097dbd350b69e700b00787c195fe851c.zip
C++17
Remove all boost things now in the standard library from curl things.
-rw-r--r--libadhocutil/curlHandle.cpp4
-rw-r--r--libadhocutil/curlHandle.h6
-rw-r--r--libadhocutil/curlMultiHandle.cpp12
-rw-r--r--libadhocutil/curlMultiHandle.h12
4 files changed, 16 insertions, 18 deletions
diff --git a/libadhocutil/curlHandle.cpp b/libadhocutil/curlHandle.cpp
index d4d8650..f68eb10 100644
--- a/libadhocutil/curlHandle.cpp
+++ b/libadhocutil/curlHandle.cpp
@@ -129,10 +129,10 @@ CurlException::ice_print(std::ostream & s) const
{
if (httpcode) {
CurlExceptionMsgHttp::write(s, *httpcode, message, resultcode);
- }
+ }
else {
CurlExceptionMsg::write(s, message, resultcode);
- }
+ }
}
}
diff --git a/libadhocutil/curlHandle.h b/libadhocutil/curlHandle.h
index 7bbcfc4..dc33e40 100644
--- a/libadhocutil/curlHandle.h
+++ b/libadhocutil/curlHandle.h
@@ -2,7 +2,7 @@
#define ADHOCUTIL_CURLHANDLE_H
#include <curl/curl.h>
-#include "intrusivePtrBase.h"
+#include <memory>
#include "visibility.h"
namespace AdHoc {
@@ -10,7 +10,7 @@ namespace Net {
/// libcurl handle wrapper.
/** Wraps a libcurl CURL * object in a C++ friendly manner. */
-class DLL_PUBLIC CurlHandle : public virtual IntrusivePtrBase {
+class DLL_PUBLIC CurlHandle {
public:
/**
* Create a new CurlHandle.
@@ -49,7 +49,7 @@ class DLL_PUBLIC CurlHandle : public virtual IntrusivePtrBase {
curl_httppost * postS, * postE;
/// @endcond
};
-typedef boost::intrusive_ptr<CurlHandle> CurlHandlePtr;
+typedef std::shared_ptr<CurlHandle> CurlHandlePtr;
/// @cond
template <>
diff --git a/libadhocutil/curlMultiHandle.cpp b/libadhocutil/curlMultiHandle.cpp
index 9afd9e1..cf75032 100644
--- a/libadhocutil/curlMultiHandle.cpp
+++ b/libadhocutil/curlMultiHandle.cpp
@@ -9,7 +9,7 @@ namespace Net {
class RunningCurl : public CurlStreamSource {
public:
- RunningCurl(const std::string & url, const boost::function<void(std::istream &)> & c) :
+ RunningCurl(const std::string & url, const std::function<void(std::istream &)> & c) :
CurlStreamSource(url),
consumer(c)
{
@@ -18,12 +18,12 @@ class RunningCurl : public CurlStreamSource {
void callback() override
{
typedef boost::reference_wrapper<RunningCurl> rc_ref;
- boost::iostreams::stream<rc_ref> curlstrm(boost::ref(*this));
+ boost::iostreams::stream<rc_ref> curlstrm(std::ref(*this));
consumer(curlstrm);
}
private:
- const boost::function<void(std::istream &)> consumer;
+ const std::function<void(std::istream &)> consumer;
};
CurlMultiHandle::CurlMultiHandle()
@@ -35,11 +35,9 @@ CurlMultiHandle::~CurlMultiHandle()
}
CurlHandlePtr
-CurlMultiHandle::addCurl(const std::string & url, const boost::function<void(std::istream &)> & c)
+CurlMultiHandle::addCurl(const std::string & url, const std::function<void(std::istream &)> & c)
{
- RunningCurl * css = new RunningCurl(url, c);
- curls.insert(css);
- return css;
+ return *curls.insert(std::make_shared<RunningCurl>(url, c)).first;
}
void
diff --git a/libadhocutil/curlMultiHandle.h b/libadhocutil/curlMultiHandle.h
index 6dc79b9..2ceee46 100644
--- a/libadhocutil/curlMultiHandle.h
+++ b/libadhocutil/curlMultiHandle.h
@@ -1,10 +1,10 @@
#ifndef ADHOCUTIL_CURLMULTIHANDLE_H
#define ADHOCUTIL_CURLMULTIHANDLE_H
-#include <boost/function.hpp>
+#include <functional>
#include <set>
#include <map>
-#include "intrusivePtrBase.h"
+#include <memory>
#include "visibility.h"
#include "curlHandle.h"
@@ -12,13 +12,13 @@ namespace AdHoc {
namespace Net {
class RunningCurl;
-typedef boost::intrusive_ptr<RunningCurl> RunningCurlPtr;
+typedef std::shared_ptr<RunningCurl> RunningCurlPtr;
/// Perform multiple CURL operations at once.
-class DLL_PUBLIC CurlMultiHandle : public IntrusivePtrBase {
+class DLL_PUBLIC CurlMultiHandle {
public:
/** A function that should consume the inbound byte stream. */
- typedef boost::function<void(std::istream &)> Consumer;
+ typedef std::function<void(std::istream &)> Consumer;
CurlMultiHandle();
~CurlMultiHandle();
@@ -36,7 +36,7 @@ class DLL_PUBLIC CurlMultiHandle : public IntrusivePtrBase {
CURLs curls;
};
-typedef boost::intrusive_ptr<CurlMultiHandle> CurlMultiHandlePtr;
+typedef std::shared_ptr<CurlMultiHandle> CurlMultiHandlePtr;
}
}