static int tolua_cocos2dx_httprequest_luabinding_CCHTTPRequest_getErrorMessage00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"CCHTTPRequest",0,&tolua_err) || !tolua_isnoobj(tolua_S,2,&tolua_err) ) goto tolua_lerror; else #endif { CCHTTPRequest* self = (CCHTTPRequest*) tolua_tousertype(tolua_S,1,0); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'getErrorMessage'", NULL); #endif { string tolua_ret = (string) self->getErrorMessage(); tolua_pushcppstring(tolua_S,(const char*)tolua_ret); } } return 1; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'getErrorMessage'.",&tolua_err); return 0; #endif }
static int tolua_cocos2dx_httprequest_luabinding_CCHTTPRequest_saveResponseData00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"CCHTTPRequest",0,&tolua_err) || !tolua_isstring(tolua_S,2,0,&tolua_err) || !tolua_isnoobj(tolua_S,3,&tolua_err) ) goto tolua_lerror; else #endif { CCHTTPRequest* self = (CCHTTPRequest*) tolua_tousertype(tolua_S,1,0); const char* filename = ((const char*) tolua_tostring(tolua_S,2,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'saveResponseData'", NULL); #endif { int tolua_ret = (int) self->saveResponseData(filename); tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); } } return 1; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'saveResponseData'.",&tolua_err); return 0; #endif }
static int tolua_cocos2dx_httprequest_luabinding_CCHTTPRequest_setRequestUrl00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"CCHTTPRequest",0,&tolua_err) || !tolua_isstring(tolua_S,2,0,&tolua_err) || !tolua_isnoobj(tolua_S,3,&tolua_err) ) goto tolua_lerror; else #endif { CCHTTPRequest* self = (CCHTTPRequest*) tolua_tousertype(tolua_S,1,0); const char* url = ((const char*) tolua_tostring(tolua_S,2,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'setRequestUrl'", NULL); #endif { self->setRequestUrl(url); } } return 0; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'setRequestUrl'.",&tolua_err); return 0; #endif }
static int tolua_cocos2dx_httprequest_luabinding_CCHTTPRequest_cancel00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"CCHTTPRequest",0,&tolua_err) || !tolua_isnoobj(tolua_S,2,&tolua_err) ) goto tolua_lerror; else #endif { CCHTTPRequest* self = (CCHTTPRequest*) tolua_tousertype(tolua_S,1,0); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cancel'", NULL); #endif { self->cancel(); } } return 0; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'cancel'.",&tolua_err); return 0; #endif }
static int tolua_cocos2dx_httprequest_luabinding_CCHTTPRequest_getResponseDataLength00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"CCHTTPRequest",0,&tolua_err) || !tolua_isnoobj(tolua_S,2,&tolua_err) ) goto tolua_lerror; else #endif { CCHTTPRequest* self = (CCHTTPRequest*) tolua_tousertype(tolua_S,1,0); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'getResponseDataLength'", NULL); #endif { int tolua_ret = (int) self->getResponseDataLength(); tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); } } return 1; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'getResponseDataLength'.",&tolua_err); return 0; #endif }
static int tolua_cocos2dx_httprequest_luabinding_CCHTTPRequest_setTimeout00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"CCHTTPRequest",0,&tolua_err) || !tolua_isnumber(tolua_S,2,0,&tolua_err) || !tolua_isnoobj(tolua_S,3,&tolua_err) ) goto tolua_lerror; else #endif { CCHTTPRequest* self = (CCHTTPRequest*) tolua_tousertype(tolua_S,1,0); int timeout = ((int) tolua_tonumber(tolua_S,2,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'setTimeout'", NULL); #endif { self->setTimeout(timeout); } } return 0; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'setTimeout'.",&tolua_err); return 0; #endif }
static int tolua_cocos2dx_httprequest_luabinding_CCHTTPRequest_start00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"CCHTTPRequest",0,&tolua_err) || !tolua_isnoobj(tolua_S,2,&tolua_err) ) goto tolua_lerror; else #endif { CCHTTPRequest* self = (CCHTTPRequest*) tolua_tousertype(tolua_S,1,0); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'start'", NULL); #endif { bool tolua_ret = (bool) self->start(); tolua_pushboolean(tolua_S,(bool)tolua_ret); } } return 1; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'start'.",&tolua_err); return 0; #endif }
static int tolua_cocos2dx_httprequest_luabinding_CCHTTPRequest_addFormFile00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"CCHTTPRequest",0,&tolua_err) || !tolua_isstring(tolua_S,2,0,&tolua_err) || !tolua_isstring(tolua_S,3,0,&tolua_err) || !tolua_isstring(tolua_S,4,1,&tolua_err) || !tolua_isnoobj(tolua_S,5,&tolua_err) ) goto tolua_lerror; else #endif { CCHTTPRequest* self = (CCHTTPRequest*) tolua_tousertype(tolua_S,1,0); const char* name = ((const char*) tolua_tostring(tolua_S,2,0)); const char* filePath = ((const char*) tolua_tostring(tolua_S,3,0)); const char* fileType = ((const char*) tolua_tostring(tolua_S,4,"application/octet-stream")); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'addFormFile'", NULL); #endif { self->addFormFile(name,filePath,fileType); } } return 0; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'addFormFile'.",&tolua_err); return 0; #endif }
static int tolua_cocos2dx_httprequest_luabinding_CCHTTPRequest_addFormContents00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"CCHTTPRequest",0,&tolua_err) || !tolua_isstring(tolua_S,2,0,&tolua_err) || !tolua_isstring(tolua_S,3,0,&tolua_err) || !tolua_isnoobj(tolua_S,4,&tolua_err) ) goto tolua_lerror; else #endif { CCHTTPRequest* self = (CCHTTPRequest*) tolua_tousertype(tolua_S,1,0); const char* name = ((const char*) tolua_tostring(tolua_S,2,0)); const char* value = ((const char*) tolua_tostring(tolua_S,3,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'addFormContents'", NULL); #endif { self->addFormContents(name,value); } } return 0; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'addFormContents'.",&tolua_err); return 0; #endif }
static int tolua_cocos2dx_extra_luabinding_CCHTTPRequest_getResponseData00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"CCHTTPRequest",0,&tolua_err) || !tolua_isnoobj(tolua_S,2,&tolua_err) ) goto tolua_lerror; else #endif { CCHTTPRequest* self = (CCHTTPRequest*) tolua_tousertype(tolua_S,1,0); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'getResponseDataLua'", NULL); #endif { self->getResponseDataLua(); } } return 1; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'getResponseData'.",&tolua_err); return 0; #endif }
CCHTTPRequest* CCNetwork::createHTTPRequestLua(LUA_FUNCTION listener, const char* url, int method) { CCHTTPRequest* request = CCHTTPRequest::createWithUrlLua(listener, url, method); request->start(); return request; }
void AssetsUpdateLayer::requestLastestVersion() { char reqStr[128]; sprintf(reqStr, "%s%s", SERVER_ADDRESS, ASSETS_VERSION_FILE); CCHTTPRequest* req = CCHTTPRequest::createWithUrl(this, /*HTTPRequest_selector(AssetsUpdateLayer::requestLastestVersionCallback), */ reqStr); req->start(); }
CCHTTPRequest* CCHTTPRequest::createWithUrlLua(LUA_FUNCTION listener, const char* url, int method) { CCHTTPRequest* request = new CCHTTPRequest(); request->initWithListener(listener, url, method); request->autorelease(); return request; }
CCHTTPRequest* CCHTTPRequest::createWithUrl(CCHTTPRequestDelegate* delegate, const char* url, int method) { CCHTTPRequest* request = new CCHTTPRequest(); request->initWithDelegate(delegate, url, method); request->autorelease(); return request; }
NS_CC_EXTRA_BEGIN CCHTTPRequest* CCNetwork::createHTTPRequest(CCHTTPRequestDelegate* delegate, const char* url, int method) { CCHTTPRequest* request = CCHTTPRequest::createWithUrl(delegate, url, method); request->start(); return request; }
NS_CC_EXTRA_BEGIN #if (CC_CURL_ENABLED > 0 || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) CCHTTPRequest* CCNetwork::createHTTPRequest(CCHTTPRequestDelegate* delegate, const char* url, int method) { CCHTTPRequest* request = CCHTTPRequest::createWithUrl(delegate, url, method); request->start(); return request; }