PageRenderTime 325ms CodeModel.GetById 181ms app.highlight 5ms RepoModel.GetById 137ms app.codeStats 0ms

/script_binding/lua/lua_ftk_file.c

http://ftk.googlecode.com/
C | 59 lines | 46 code | 12 blank | 1 comment | 1 complexity | 22d596f1acd3a822d80636a8ee6b6aef MD5 | raw file
 1/*This file is generated by luagen.*/
 2#include "lua_ftk_file.h"
 3#include "lua_ftk_callbacks.h"
 4
 5static void tolua_reg_types (lua_State* L)
 6{
 7	tolua_usertype(L, "FtkFile");
 8}
 9
10static int lua_ftk_file_get_info(lua_State* L)
11{
12	tolua_Error err = {0};
13	Ret retv;
14	const char* file_name;
15	FtkFileInfo* info;
16	int param_ok = tolua_isstring(L, 1, 0, &err) && tolua_isusertype(L, 2, "FtkFileInfo", 0, &err);
17
18	return_val_if_fail(param_ok, 0);
19
20	file_name = tolua_tostring(L, 1, 0);
21	info = tolua_tousertype(L, 2, 0);
22	retv = ftk_file_get_info(file_name, info);
23	tolua_pushnumber(L, (lua_Number)retv);
24
25	return 1;
26}
27
28static int lua_ftk_file_get_mime_type(lua_State* L)
29{
30	tolua_Error err = {0};
31	const char* retv;
32	const char* file_name;
33	int param_ok = tolua_isstring(L, 1, 0, &err);
34
35	return_val_if_fail(param_ok, 0);
36
37	file_name = tolua_tostring(L, 1, 0);
38	retv = ftk_file_get_mime_type(file_name);
39	tolua_pushstring(L, (const char*)retv);
40
41	return 1;
42}
43
44int tolua_ftk_file_init(lua_State* L)
45{
46	tolua_open(L);
47	tolua_reg_types(L);
48	tolua_module(L, NULL, 0);
49	tolua_beginmodule(L, NULL);
50	tolua_cclass(L,"FtkFile", "FtkFile", "", NULL);
51	tolua_beginmodule(L, "FtkFile");
52	tolua_function(L, "GetInfo", lua_ftk_file_get_info);
53	tolua_function(L, "GetMimeType", lua_ftk_file_get_mime_type);
54	tolua_endmodule(L);
55	tolua_endmodule(L);
56
57
58	return 1;
59}