summaryrefslogtreecommitdiffabout
path: root/lib
authorMichael Krelin <hacker@klever.net>2008-03-04 21:29:52 (UTC)
committer Michael Krelin <hacker@klever.net>2008-03-04 21:29:52 (UTC)
commit1e3ed01c149aaeed5a64aacff218a5486128fc92 (patch) (unidiff)
tree9eede5ee850d3f1cb46b00daf3a9d698d5af884d /lib
parenta7429a01d86dfde646332b25902f99ccf7f81934 (diff)
downloadlibopkele-1e3ed01c149aaeed5a64aacff218a5486128fc92.zip
libopkele-1e3ed01c149aaeed5a64aacff218a5486128fc92.tar.gz
libopkele-1e3ed01c149aaeed5a64aacff218a5486128fc92.tar.bz2
added curl_slist wrapper
Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (limited to 'lib') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/curl.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/curl.cc b/lib/curl.cc
index 6172828..734e2ca 100644
--- a/lib/curl.cc
+++ b/lib/curl.cc
@@ -1,3 +1,4 @@
1#include <opkele/exception.h>
1#include <opkele/curl.h> 2#include <opkele/curl.h>
2 3
3#include "config.h" 4#include "config.h"
@@ -6,6 +7,25 @@ namespace opkele {
6 7
7 namespace util { 8 namespace util {
8 9
10 curl_slist_t::~curl_slist_t() throw() {
11 if(_s)
12 curl_slist_free_all(_s);
13 }
14
15 curl_slist_t& curl_slist_t::operator=(curl_slist *s) {
16 if(_s)
17 curl_slist_free_all(_s);
18 _s = s;
19 return *this;
20 }
21
22 void curl_slist_t::append(const char *str) {
23 curl_slist *s = curl_slist_append(_s,str);
24 if(!s)
25 throw opkele::exception(OPKELE_CP_ "failed to curl_slist_append()");
26 _s=s;
27 }
28
9 curl_t::~curl_t() throw() { 29 curl_t::~curl_t() throw() {
10 if(_c) 30 if(_c)
11 curl_easy_cleanup(_c); 31 curl_easy_cleanup(_c);