libcurl低层封装,主要提供了CURL句柄资源管理功能
更多...
#include <eiennet_curl.hpp>
|
typedef size_t(* | WriteFunction) (char *buf, size_t itemSize, size_t count, void *data) |
|
typedef size_t(* | ReadFunction) (char *buf, size_t itemSize, size_t count, void *data) |
|
typedef size_t(* | HeaderFunction) (char *buf, size_t itemSize, size_t count, void *data) |
|
typedef int(* | ProgressFunction) (void *data, double dltotal, double dlnow, double ultotal, double ulnow) |
|
|
virtual size_t | OnWrite (char *buf, size_t itemSize, size_t count) |
|
virtual size_t | OnRead (char *buf, size_t itemSize, size_t count) |
|
virtual size_t | OnHeader (char *buf, size_t itemSize, size_t count) |
|
virtual int | OnDownloadProgress (double dltotal, double dlnow) |
|
virtual int | OnUploadProgress (double ultotal, double ulnow) |
|
|
static size_t | WriteCallback (char *buf, size_t itemSize, size_t count, void *data) |
|
static size_t | ReadCallback (char *buf, size_t itemSize, size_t count, void *data) |
|
static size_t | HeaderCallback (char *buf, size_t itemSize, size_t count, void *data) |
|
static int | ProgressCallback (void *data, double dltotal, double dlnow, double ultotal, double ulnow) |
|
libcurl低层封装,主要提供了CURL句柄资源管理功能
在文件 eiennet_curl.hpp 第 71 行定义.
typedef size_t(* eiennet::CUrl::HeaderFunction) (char *buf, size_t itemSize, size_t count, void *data) |
typedef int(* eiennet::CUrl::ProgressFunction) (void *data, double dltotal, double dlnow, double ultotal, double ulnow) |
typedef size_t(* eiennet::CUrl::ReadFunction) (char *buf, size_t itemSize, size_t count, void *data) |
typedef size_t(* eiennet::CUrl::WriteFunction) (char *buf, size_t itemSize, size_t count, void *data) |
eiennet::CUrl::CUrl |
( |
bool |
isInit = true | ) |
|
isInit为true将自动调用init(),否则不调用。
eiennet::CUrl::CUrl |
( |
CUrl const & |
other | ) |
|
virtual eiennet::CUrl::~CUrl |
( |
| ) |
|
|
virtual |
void eiennet::CUrl::cleanup |
( |
| ) |
|
int eiennet::CUrl::errNo |
( |
| ) |
const |
|
inline |
char const* eiennet::CUrl::errNoStr |
( |
| ) |
const |
char const* eiennet::CUrl::error |
( |
| ) |
const |
static size_t eiennet::CUrl::HeaderCallback |
( |
char * |
buf, |
|
|
size_t |
itemSize, |
|
|
size_t |
count, |
|
|
void * |
data |
|
) |
| |
|
staticprotected |
void eiennet::CUrl::init |
( |
| ) |
|
virtual int eiennet::CUrl::OnDownloadProgress |
( |
double |
dltotal, |
|
|
double |
dlnow |
|
) |
| |
|
protectedvirtual |
virtual size_t eiennet::CUrl::OnHeader |
( |
char * |
buf, |
|
|
size_t |
itemSize, |
|
|
size_t |
count |
|
) |
| |
|
protectedvirtual |
virtual size_t eiennet::CUrl::OnRead |
( |
char * |
buf, |
|
|
size_t |
itemSize, |
|
|
size_t |
count |
|
) |
| |
|
protectedvirtual |
virtual int eiennet::CUrl::OnUploadProgress |
( |
double |
ultotal, |
|
|
double |
ulnow |
|
) |
| |
|
protectedvirtual |
virtual size_t eiennet::CUrl::OnWrite |
( |
char * |
buf, |
|
|
size_t |
itemSize, |
|
|
size_t |
count |
|
) |
| |
|
protectedvirtual |
eiennet::CUrl::operator CURL * |
( |
| ) |
const |
|
inline |
CUrl& eiennet::CUrl::operator= |
( |
CUrl const & |
other | ) |
|
释放清理自身curl,复制其他curl,并且拷贝选项设置,并设置自己的一些选项:譬如回调函数对象指针
bool eiennet::CUrl::perform |
( |
| ) |
|
static int eiennet::CUrl::ProgressCallback |
( |
void * |
data, |
|
|
double |
dltotal, |
|
|
double |
dlnow, |
|
|
double |
ultotal, |
|
|
double |
ulnow |
|
) |
| |
|
staticprotected |
static size_t eiennet::CUrl::ReadCallback |
( |
char * |
buf, |
|
|
size_t |
itemSize, |
|
|
size_t |
count, |
|
|
void * |
data |
|
) |
| |
|
staticprotected |
void eiennet::CUrl::reset |
( |
| ) |
|
void eiennet::CUrl::setCookieJar |
( |
winux::String const & |
filename | ) |
|
void eiennet::CUrl::setErrorBuffer |
( |
char * |
errBuf | ) |
|
设定错误信息缓冲区,缓冲区大小必须是CURL_ERROR_SIZE=256
设置'取头部'处理函数,默认已设为WriteCallback()
void eiennet::CUrl::setHeaderHandlerData |
( |
void * |
data | ) |
|
设置'取头部'处理函数的自定义参数,默认设为this,使从静态成员函数传递到普通成员虚函数进行处理
void eiennet::CUrl::setHttpGet |
( |
bool |
b = true | ) |
|
设置成http GET请求方式。也可用于把curl恢复成使用GET的状态。
如果b
是1,这将强制HTTP请求回到使用GET的状态。若之前使用过POST、HEAD、PUT等状态,可以使用这个方法将强制HTTP请求回到使用GET的状态。
void eiennet::CUrl::setHttpHeader |
( |
SList const & |
headers | ) |
|
void eiennet::CUrl::setHttpPost |
( |
bool |
b = true | ) |
|
设置成http POST请求方式
如果b
是1,这将告诉libcurl发起常规POST请求。 这还会使得libcurl使用 "Content-Type: application/x-www-form-urlencoded" 请求头。
void eiennet::CUrl::setNoProgress |
( |
bool |
b | ) |
|
void eiennet::CUrl::setPassword |
( |
winux::String const & |
password | ) |
|
void eiennet::CUrl::setPostFieldSize |
( |
long |
size | ) |
|
void eiennet::CUrl::setPostMultipart |
( |
PostMultipart const & |
data | ) |
|
设置'进度'处理函数,默认已设为WriteCallback()
void eiennet::CUrl::setProgressHandlerData |
( |
void * |
data | ) |
|
设置'进度'处理函数的自定义参数,默认设为this,使从静态成员函数传递到普通成员虚函数进行处理
设置'读'处理函数,默认已设为WriteCallback()
void eiennet::CUrl::setReadHandlerData |
( |
void * |
data | ) |
|
设置'读'处理函数的自定义参数,默认设为this,使从静态成员函数传递到普通成员虚函数进行处理
void eiennet::CUrl::setSslVerifyHost |
( |
bool |
b | ) |
|
决定是否验证服务器证书适用于所谓的服务器
默认是true.
void eiennet::CUrl::setSslVerifyPeer |
( |
bool |
b | ) |
|
void eiennet::CUrl::setUsername |
( |
winux::String const & |
username | ) |
|
void eiennet::CUrl::setVerbose |
( |
bool |
b | ) |
|
设置'写'处理函数,默认已设为WriteCallback()
void eiennet::CUrl::setWriteHandlerData |
( |
void * |
data | ) |
|
设置'写'处理函数的自定义参数,默认设为this,使从静态成员函数传递到普通成员虚函数进行处理
static size_t eiennet::CUrl::WriteCallback |
( |
char * |
buf, |
|
|
size_t |
itemSize, |
|
|
size_t |
count, |
|
|
void * |
data |
|
) |
| |
|
staticprotected |
CURL* eiennet::CUrl::_curl |
|
protected |
int eiennet::CUrl::_errNo |
|
protected |
该类的文档由以下文件生成: