iFun Engine API  1.0.0-b3795
Great Technology for Great Games
 All Classes Files Functions Variables Typedefs Macros
Public Types | Public Member Functions | List of all members
fun::Curl Class Reference

Wrapepr class for libcurl.

#include <curl.h>

Inheritance diagram for fun::Curl:

Public Types

typedef boost::function< void(CURLcode)> Callback
 Callback for asynchronous operations.

Public Member Functions

 Curl ()
 ~Curl ()
string GetResult () const
 Returns the stored result in the string format.
CURLcode GetResultCode () const
 Returns the stored result code in CURLcode. More...
CURL * handle ()
 Getter to access the native handle. More...
bool IsReady () const
 Checks if the curl instance is ready to use. More...
void set_verbose (bool on)
 Set verbosity.
void StartAsync (const string &url, const Callback &cb)
 Runs in an asynchronouse way. More...
CURLcode StartSync (const string &url)
 Kickstarts to fetch the url in a synchronous manner. More...

Member Function Documentation

CURLcode fun::Curl::GetResultCode ( ) const
CURL* fun::Curl::handle ( )

You may use it to invoke curl_easy_setopt().

libcurl's easy handle.
bool fun::Curl::IsReady ( ) const
void fun::Curl::StartAsync ( const string &  url,
const Callback cb 

CURL result code will be passed to the given callback function. You may want to use Event::post inside the callback for the callback might be called by a different thread.

urltarget url string
cbCallback instance to be invoked once done with the url.
CURLcode fun::Curl::StartSync ( const string &  url)
urltarget url string
operation result in CURLcode.