PageRenderTime 484ms CodeModel.GetById 161ms app.highlight 6ms RepoModel.GetById 196ms app.codeStats 0ms

/script_binding/lua/lua_ftk_translator.c

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