author | Michael Krelin <hacker@klever.net> | 2007-12-16 00:36:30 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-12-17 12:09:16 (UTC) |
commit | 7d8cda044fa3b428eb53ec2bfbeaa2e223114554 (patch) (unidiff) | |
tree | d81fc5436f1d22276972ffed473ed8b438bfb5d9 /lib | |
parent | 52c81fff0274c6bb54f6f9be414432ee6388e723 (diff) | |
download | libopkele-7d8cda044fa3b428eb53ec2bfbeaa2e223114554.zip libopkele-7d8cda044fa3b428eb53ec2bfbeaa2e223114554.tar.gz libopkele-7d8cda044fa3b428eb53ec2bfbeaa2e223114554.tar.bz2 |
moved curl_fetch_string_t/curl_pick_t classes into curl.h
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | lib/consumer.cc | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/lib/consumer.cc b/lib/consumer.cc index 9f7530f..3c3b4f8 100644 --- a/lib/consumer.cc +++ b/lib/consumer.cc | |||
@@ -14,31 +14,13 @@ | |||
14 | 14 | ||
15 | #include <pcre.h> | 15 | #include <pcre.h> |
16 | 16 | ||
17 | namespace opkele { | 17 | namespace opkele { |
18 | using namespace std; | 18 | using namespace std; |
19 | using util::curl_t; | 19 | using util::curl_t; |
20 | 20 | using util::curl_pick_t; | |
21 | template<int lim> | ||
22 | class curl_fetch_string_t : public curl_t { | ||
23 | public: | ||
24 | curl_fetch_string_t(CURL *c) | ||
25 | : curl_t(c) { } | ||
26 | ~curl_fetch_string_t() throw() { } | ||
27 | |||
28 | string response; | ||
29 | |||
30 | size_t write(void *p,size_t size,size_t nmemb) { | ||
31 | size_t bytes = size*nmemb; | ||
32 | size_t get = min(lim-response.length(),bytes); | ||
33 | response.append((const char *)p,get); | ||
34 | return get; | ||
35 | } | ||
36 | }; | ||
37 | |||
38 | typedef curl_fetch_string_t<16384> curl_pick_t; | ||
39 | 21 | ||
40 | class pcre_matches_t { | 22 | class pcre_matches_t { |
41 | public: | 23 | public: |
42 | int *_ov; | 24 | int *_ov; |
43 | int _s; | 25 | int _s; |
44 | 26 | ||