PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/script_binding/lua/lua_ftk_icon_cache.c

http://ftk.googlecode.com/
C | 77 lines | 60 code | 16 blank | 1 comment | 2 complexity | b4bdbe8a751997a63856649935853239 MD5 | raw file
 1/*This file is generated by luagen.*/
 2#include "lua_ftk_icon_cache.h"
 3#include "lua_ftk_callbacks.h"
 4
 5static void tolua_reg_types (lua_State* L)
 6{
 7	tolua_usertype(L, "FtkIconCache");
 8}
 9
10static int lua_ftk_icon_cache_create(lua_State* L)
11{
12	tolua_Error err = {0};
13	FtkIconCache* retv;
14	const char** root_path;
15	const char* rel_path;
16	int param_ok = tolua_istable(L, 1, 0, &err) && tolua_isstring(L, 2, 0, &err);
17
18	return_val_if_fail(param_ok, 0);
19
20	root_path = tolua_tostrings(L, 1, 0);
21	rel_path = tolua_tostring(L, 2, 0);
22	retv = ftk_icon_cache_create(root_path, rel_path);
23	tolua_pushusertype(L, (FtkIconCache*)retv, "FtkIconCache");
24	free(root_path);
25
26	return 1;
27}
28
29static int lua_ftk_icon_cache_load(lua_State* L)
30{
31	tolua_Error err = {0};
32	FtkBitmap* retv;
33	FtkIconCache* thiz;
34	const char* filename;
35	int param_ok = tolua_isusertype(L, 1, "FtkIconCache", 0, &err) && tolua_isstring(L, 2, 0, &err);
36
37	return_val_if_fail(param_ok, 0);
38
39	thiz = tolua_tousertype(L, 1, 0);
40	filename = tolua_tostring(L, 2, 0);
41	retv = ftk_icon_cache_load(thiz, filename);
42	tolua_pushusertype(L, (FtkBitmap*)retv, "FtkBitmap");
43
44	return 1;
45}
46
47static int lua_ftk_icon_cache_destroy(lua_State* L)
48{
49	tolua_Error err = {0};
50	FtkIconCache* thiz;
51	int param_ok = tolua_isusertype(L, 1, "FtkIconCache", 0, &err);
52
53	return_val_if_fail(param_ok, 0);
54
55	thiz = tolua_tousertype(L, 1, 0);
56	ftk_icon_cache_destroy(thiz);
57
58	return 1;
59}
60
61int tolua_ftk_icon_cache_init(lua_State* L)
62{
63	tolua_open(L);
64	tolua_reg_types(L);
65	tolua_module(L, NULL, 0);
66	tolua_beginmodule(L, NULL);
67	tolua_cclass(L,"FtkIconCache", "FtkIconCache", "", NULL);
68	tolua_beginmodule(L, "FtkIconCache");
69	tolua_function(L, "Create", lua_ftk_icon_cache_create);
70	tolua_function(L, "Load", lua_ftk_icon_cache_load);
71	tolua_function(L, "Destroy", lua_ftk_icon_cache_destroy);
72	tolua_endmodule(L);
73	tolua_endmodule(L);
74
75
76	return 1;
77}