restclient-cpp
C++ client for making HTTP/REST requests
Classes | Functions
RestClient::Helpers Namespace Reference

: namespace for all helper functions More...

Classes

struct  UploadObject
 This structure represents the payload to upload on POST requests. More...
 

Functions

size_t write_callback (void *ptr, size_t size, size_t nmemb, void *userdata)
 write callback function for libcurl More...
 
size_t header_callback (void *ptr, size_t size, size_t nmemb, void *userdata)
 header callback for libcurl More...
 
size_t read_callback (void *ptr, size_t size, size_t nmemb, void *userdata)
 read callback function for libcurl More...
 

Detailed Description

: namespace for all helper functions

Function Documentation

size_t RestClient::Helpers::header_callback ( void *  data,
size_t  size,
size_t  nmemb,
void *  userdata 
)

header callback for libcurl

Parameters
datareturned (header line)
sizeof data
nmembmemblock
userdatapointer to user data object to save headr data
Returns
size * nmemb;
size_t RestClient::Helpers::read_callback ( void *  data,
size_t  size,
size_t  nmemb,
void *  userdata 
)

read callback function for libcurl

Parameters
datapointer of max size (size*nmemb) to write data to
sizesize parameter
nmembmemblock parameter
userdatapointer to user data to read data from
Returns
(size * nmemb)

get upload struct

set correct sizes

copy data to buffer

decrement length and increment data pointer

return copied size

size_t RestClient::Helpers::write_callback ( void *  data,
size_t  size,
size_t  nmemb,
void *  userdata 
)

write callback function for libcurl

Parameters
datareturned data of size (size*nmemb)
sizesize parameter
nmembmemblock parameter
userdatapointer to user data to save/work with return data
Returns
(size * nmemb)