author | Michael Krelin <hacker@klever.net> | 2008-03-04 21:29:52 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2008-03-04 21:29:52 (UTC) |
commit | 1e3ed01c149aaeed5a64aacff218a5486128fc92 (patch) (unidiff) | |
tree | 9eede5ee850d3f1cb46b00daf3a9d698d5af884d /lib/curl.cc | |
parent | a7429a01d86dfde646332b25902f99ccf7f81934 (diff) | |
download | libopkele-1e3ed01c149aaeed5a64aacff218a5486128fc92.zip libopkele-1e3ed01c149aaeed5a64aacff218a5486128fc92.tar.gz libopkele-1e3ed01c149aaeed5a64aacff218a5486128fc92.tar.bz2 |
added curl_slist wrapper
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | lib/curl.cc | 20 |
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,20 +1,40 @@ | |||
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" |
4 | 5 | ||
5 | namespace opkele { | 6 | 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); |
12 | } | 32 | } |
13 | 33 | ||
14 | curl_t& curl_t::operator=(CURL *c) { | 34 | curl_t& curl_t::operator=(CURL *c) { |
15 | if(_c) | 35 | if(_c) |
16 | curl_easy_cleanup(_c); | 36 | curl_easy_cleanup(_c); |
17 | _c = c; | 37 | _c = c; |
18 | return *this; | 38 | return *this; |
19 | } | 39 | } |
20 | 40 | ||