48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
/* -----------------------------------------------------------------------------
|
|
GSFramework
|
|
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
|
----------------------------------------------------------------------------- */
|
|
|
|
|
|
#ifndef __HTTPINTERFACE__
|
|
#define __HTTPINTERFACE__
|
|
|
|
|
|
#include "container/narray.h"
|
|
|
|
|
|
namespace GS {
|
|
namespace HTTP {
|
|
|
|
/*!
|
|
@short HTTP interface.
|
|
@author Emmanuel Julien (ejulien@owloh.com)
|
|
*/
|
|
struct IHTTP
|
|
{
|
|
/// Process a request return value.
|
|
virtual void OnRequestComplete(int ticket_id, const Array <char> &data) = 0;
|
|
/// Process a request error.
|
|
virtual void OnRequestError(int ticket_id) = 0;
|
|
|
|
/*!
|
|
@short Post an asynchronous HTTP request.
|
|
|
|
This function posts an asynchronous HTTP request and returns a ticket
|
|
id to the caller. When task result is available the OnRequestComplete
|
|
or OnRequestError handler functions will be called.
|
|
*/
|
|
virtual int Post(const char *url, const char *post) = 0;
|
|
|
|
/// Process pending event dispatch in the caller thread.
|
|
virtual void Update() = 0;
|
|
|
|
virtual ~IHTTP() {}
|
|
};
|
|
|
|
} // HTTP
|
|
} // GS
|
|
|
|
|
|
#endif // __HTTPINTERFACE__
|