/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. static void tolua_reg_types (lua_State* L)
  5. {
  6. tolua_usertype(L, "FtkIconCache");
  7. }
  8. static int lua_ftk_icon_cache_create(lua_State* L)
  9. {
  10. tolua_Error err = {0};
  11. FtkIconCache* retv;
  12. const char** root_path;
  13. const char* rel_path;
  14. int param_ok = tolua_istable(L, 1, 0, &err) && tolua_isstring(L, 2, 0, &err);
  15. return_val_if_fail(param_ok, 0);
  16. root_path = tolua_tostrings(L, 1, 0);
  17. rel_path = tolua_tostring(L, 2, 0);
  18. retv = ftk_icon_cache_create(root_path, rel_path);
  19. tolua_pushusertype(L, (FtkIconCache*)retv, "FtkIconCache");
  20. free(root_path);
  21. return 1;
  22. }
  23. static int lua_ftk_icon_cache_load(lua_State* L)
  24. {
  25. tolua_Error err = {0};
  26. FtkBitmap* retv;
  27. FtkIconCache* thiz;
  28. const char* filename;
  29. int param_ok = tolua_isusertype(L, 1, "FtkIconCache", 0, &err) && tolua_isstring(L, 2, 0, &err);
  30. return_val_if_fail(param_ok, 0);
  31. thiz = tolua_tousertype(L, 1, 0);
  32. filename = tolua_tostring(L, 2, 0);
  33. retv = ftk_icon_cache_load(thiz, filename);
  34. tolua_pushusertype(L, (FtkBitmap*)retv, "FtkBitmap");
  35. return 1;
  36. }
  37. static int lua_ftk_icon_cache_destroy(lua_State* L)
  38. {
  39. tolua_Error err = {0};
  40. FtkIconCache* thiz;
  41. int param_ok = tolua_isusertype(L, 1, "FtkIconCache", 0, &err);
  42. return_val_if_fail(param_ok, 0);
  43. thiz = tolua_tousertype(L, 1, 0);
  44. ftk_icon_cache_destroy(thiz);
  45. return 1;
  46. }
  47. int tolua_ftk_icon_cache_init(lua_State* L)
  48. {
  49. tolua_open(L);
  50. tolua_reg_types(L);
  51. tolua_module(L, NULL, 0);
  52. tolua_beginmodule(L, NULL);
  53. tolua_cclass(L,"FtkIconCache", "FtkIconCache", "", NULL);
  54. tolua_beginmodule(L, "FtkIconCache");
  55. tolua_function(L, "Create", lua_ftk_icon_cache_create);
  56. tolua_function(L, "Load", lua_ftk_icon_cache_load);
  57. tolua_function(L, "Destroy", lua_ftk_icon_cache_destroy);
  58. tolua_endmodule(L);
  59. tolua_endmodule(L);
  60. return 1;
  61. }