AppEasy Core SDK  1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
CzRemoteReq Class Reference

CzRemmoteReq - A remote request. More...

#include <CzRemoteReq.h>

Inheritance diagram for CzRemoteReq:
IzXomlResource

List of all members.

Public Member Functions

void setUrl (const char *url)
const CzStringgetUrl () const
CzEventManagergetEventsManager ()
void setPost (bool post)
bool isPost () const
void setVariable (const char *variable_name)
void setVariable (CzXomlVariable *var)
CzXomlVariablegetVariable ()
void setData (const char *data)
const CzStringgetData () const
 CzRemoteReq ()
virtual ~CzRemoteReq ()
virtual bool setProperty (unsigned int property_name, const CzXomlProperty &data, bool delta)
 Sets the named property of the Remote Request.
bool setProperty (const char *property_name, const CzString &data, bool delta)
 Sets the named property of the request.
virtual bool setProperty (unsigned int property_name, const CzString &data, bool delta)
 Sets the named property of the request.
bool getProperty (const char *property_name, CzXomlProperty &prop)
 Gets the named property of the request.
virtual bool getProperty (unsigned int property_name, CzXomlProperty &prop)
int LoadFromXoml (IzXomlResource *parebt, bool load_children, CzXmlNode *node)
void MakeRequest ()
void DataReceived ()

Static Public Member Functions

static void InitClass ()
 Initialises the class.
static void ReleaseClass ()
static bool _setName (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getName (IzXomlResource *target)
static bool _setTag (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static bool _setURL (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getURL (IzXomlResource *target)
static bool _setData (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getData (IzXomlResource *target)
static bool _setOnResponse (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static bool _setOnError (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static bool _setPost (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getPost (IzXomlResource *target)
static bool _setVariable (IzXomlResource *target, const CzXomlProperty &prop, bool add)
static CzXomlProperty _getVariable (IzXomlResource *target)

Protected Member Functions

void ProcessEventActions (unsigned int event_name)

Protected Attributes

CzEventManagerEventsManager
CzXomlVariableVariable
CzHttpRequest Request

Static Protected Attributes

static CzXomlClassDefRemoteRequestClassDef = NULL

Detailed Description

CzRemmoteReq - A remote request.

XOML provides many ways of communicating with external data that is located on a web server / web site. Files, images, audio and fonts can for example reside outside the app on some web site and can be loaded on demand by the XOML app. This is a very easy to use automated system that provides very powerful control over what resources you ship with your apps and which you can host on a server and change at any time.

However, its often useful to be able to communicate with a web service or web service, such as send information about the user or the app. For example, your app may store its users data on the server in a database. XOML offers the ability to use both HTTP POST and GET to send and retrieve data to and from a web server.

Heres a short example:

XOML Example:
<RemoteReq Name="Request1" URL="http://www.mywebservice.com" Data="name=Mat" OnResponse="GotData" OnError="Error" Variable="ReqVar1">
    <Header Name="Content-Type" Value="application/x-www-form-urlencoded" />
</RemoteReq>

This example creates a remote request definition that calls mywebservice.com and passes the data “name=Mat”. The inner header tag sets the Content-Type header. The server will later send a response which is written into the variable ReqVar1 and calls the GotData actions list allowing you to perform actions when the data I received. If an error occurs then Error actions list will be called instead.

Note that a RemoteReq is not automatically sent when it is created. You need to actually call the request from an action or program command, e.g.:

<Actions Name="GetData">
    <Action Method="RemoteReq" P1="Request1" />
</Actions>

<Program Name="Program1" AutoRun="true">
    <Command Method="remote_req" P1="Request1" />
</Program>

A request will remain in memory for as long as the RemoteReq resource is available. A RemoteReq can be re-used.


Constructor & Destructor Documentation


Member Function Documentation

bool CzRemoteReq::_setData ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzRemoteReq::_setName ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzRemoteReq::_setOnError ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzRemoteReq::_setOnResponse ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzRemoteReq::_setPost ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzRemoteReq::_setTag ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzRemoteReq::_setURL ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
bool CzRemoteReq::_setVariable ( IzXomlResource target,
const CzXomlProperty prop,
bool  add 
) [static]
const CzString& CzRemoteReq::getData ( ) const [inline]
bool CzRemoteReq::getProperty ( const char *  property_name,
CzXomlProperty prop 
)

Gets the named property of the request.

Returns the named property of the request. The properties value is returned in a CzXomlProperty which is a structure that contains a union of all possible property types.

Parameters:
property_nameName of the property.
[out]propThe property data.
Returns:
true if it succeeds, false if property does not exist.
bool CzRemoteReq::getProperty ( unsigned int  property_name,
CzXomlProperty prop 
) [virtual]

Returns the named property of the request. The properties value is returned in a CzXomlProperty which is a structure that contains a union of all possible property types.

Parameters:
property_nameName of the property as a string hash (faster searching).
[in,out]propThe property.
Returns:
true if it succeeds, false if property does not exist.
const CzString& CzRemoteReq::getUrl ( ) const [inline]
void CzRemoteReq::InitClass ( ) [static]

Initialises the class.

Sets up the classes avaiiable properties. Used by the XOML system to find, set amd get class properties.

bool CzRemoteReq::isPost ( ) const [inline]
int CzRemoteReq::LoadFromXoml ( IzXomlResource parebt,
bool  load_children,
CzXmlNode node 
) [virtual]

Implements IzXomlResource.

void CzRemoteReq::ProcessEventActions ( unsigned int  event_name) [protected]
void CzRemoteReq::ReleaseClass ( ) [static]
void CzRemoteReq::setData ( const char *  data) [inline]
void CzRemoteReq::setPost ( bool  post) [inline]
bool CzRemoteReq::setProperty ( unsigned int  property_name,
const CzXomlProperty data,
bool  delta 
) [virtual]

Sets the named property of the Remote Request.

Sets the named property of this Remote Request. The properties value supplied will be converted. If delta is set to true then the existing value of the property will be added to instead of replaced.

Parameters:
property_nameName of the property as a string hash (faster searching).
[in]dataThe property data.
deltatrue if property should be added to instead of replaced.
Returns:
true if it succeeds, false if property does not exist.
bool CzRemoteReq::setProperty ( const char *  property_name,
const CzString data,
bool  delta 
)

Sets the named property of the request.

Sets the named property of this request. The properties value (data) is supplied as a string and will be converted. If delta is set to true then the existing value of the property will be added to instead of replaced.

Parameters:
property_nameName of the property.
[in]dataThe property data.
deltatrue if property should be added to instead of replaced.
Returns:
true if it succeeds, false if property does not exist.
bool CzRemoteReq::setProperty ( unsigned int  property_name,
const CzString data,
bool  delta 
) [virtual]

Sets the named property of the request.

Sets the named property of this request. The properties value (data) is supplied as a string and will be converted. If delta is set to true then the existing value of the property will be added to instead of replaced.

Parameters:
property_nameName of the property as a string hash (faster searching).
[in]dataThe property data.
deltatrue if property should be added to instead of replaced.
Returns:
true if it succeeds, false if property does not exist.
void CzRemoteReq::setUrl ( const char *  url) [inline]
void CzRemoteReq::setVariable ( const char *  variable_name)
void CzRemoteReq::setVariable ( CzXomlVariable var) [inline]

Member Data Documentation


The documentation for this class was generated from the following files: