00001 /* -*-mode: C++; style: K&R; c-basic-offset: 4 ; -*- */ 00002 00003 /* 00004 * curl.h 00005 * Simple wrapper around libCurl to download a remote URI simply. 00006 * 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 * 00022 * Steve Kemp 00023 * --- 00024 * http://www.steve.org.uk/ 00025 * 00026 */ 00027 00028 00029 #ifndef _CURL_H 00030 #define _CURL_H 00031 00032 #include <curl/curl.h> 00033 00053 class CCurl 00054 { 00055 00056 public: 00057 00062 CCurl( ); 00063 00064 00068 ~CCurl(); 00069 00070 00071 public: 00072 00073 00078 void fetchURI( const char *uri ); 00079 00080 00086 long getCode(); 00087 00088 00094 char *getData(); 00095 00096 00097 protected: 00098 00099 00108 static size_t write_data(void *ptr, size_t size, size_t nmemb, void *userp); 00109 00110 00111 private: 00112 00113 00117 CURL *m_url; 00118 00119 00123 void *m_data; 00124 00125 00129 int m_data_size; 00130 00131 00132 }; 00133 00134 #endif /* _CURL_H */