$#include "ResourceCache.h" class ResourceCache { void ReleaseAllResources(bool force = false); bool ReloadResource(Resource* resource); void SetMemoryBudget(ShortStringHash type, unsigned budget); void SetMemoryBudget(const char* type, unsigned budget); void SetAutoReloadResources(bool enable); // template T* GetResource(const String& name); Resource* GetResource(const char* type, const String& name); // template T* GetResource(const char* name); Resource* GetResource(const char* type, const char* name); bool Exists(const String& name) const; bool Exists(StringHash nameHash) const; unsigned GetMemoryBudget(ShortStringHash type) const; unsigned GetMemoryUse(ShortStringHash type) const; unsigned GetTotalMemoryUse() const; const String& GetResourceName(StringHash nameHash) const; String GetResourceFileName(const String& name) const; bool GetAutoReloadResources() const; tolua_readonly tolua_property__get_set unsigned totalMemoryUse; tolua_readonly tolua_property__get_set bool autoReloadResources; }; ${ // Disable generated GetResource funciton. #define TOLUA_DISABLE_tolua_ResourceLuaAPI_ResourceCache_GetResource00 #define TOLUA_DISABLE_tolua_ResourceLuaAPI_ResourceCache_GetResource01 static int tolua_ResourceLuaAPI_ResourceCache_GetResource00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"ResourceCache",0,&tolua_err) || !tolua_isstring(tolua_S,2,0,&tolua_err) || (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const String",0,&tolua_err)) || !tolua_isnoobj(tolua_S,4,&tolua_err) ) goto tolua_lerror; else #endif { ResourceCache* self = (ResourceCache*) tolua_tousertype(tolua_S,1,0); const char* type = ((const char*) tolua_tostring(tolua_S,2,0)); const String* name = ((const String*) tolua_tousertype(tolua_S,3,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetResource'", NULL); #endif { Resource* tolua_ret = (Resource*) self->GetResource(type,*name); tolua_pushusertype(tolua_S,(void*)tolua_ret,type); } } return 1; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'GetResource'.",&tolua_err); return 0; #endif } static int tolua_ResourceLuaAPI_ResourceCache_GetResource01(lua_State* tolua_S) { tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"ResourceCache",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 { ResourceCache* self = (ResourceCache*) tolua_tousertype(tolua_S,1,0); const char* type = ((const char*) tolua_tostring(tolua_S,2,0)); const char* name = ((const char*) tolua_tostring(tolua_S,3,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetResource'", NULL); #endif { Resource* tolua_ret = (Resource*) self->GetResource(type,name); tolua_pushusertype(tolua_S,(void*)tolua_ret,type); } } return 1; tolua_lerror: return tolua_ResourceLuaAPI_ResourceCache_GetResource00(tolua_S); } $}