lua_FileSystem.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. // Autogenerated by gameplay-luagen
  2. #include "Base.h"
  3. #include "ScriptController.h"
  4. #include "lua_FileSystem.h"
  5. #include "Base.h"
  6. #include "FileSystem.h"
  7. #include "Platform.h"
  8. #include "Properties.h"
  9. #include "Stream.h"
  10. namespace gameplay
  11. {
  12. void luaRegister_FileSystem()
  13. {
  14. const luaL_Reg lua_members[] =
  15. {
  16. {NULL, NULL}
  17. };
  18. const luaL_Reg lua_statics[] =
  19. {
  20. {"createFileFromAsset", lua_FileSystem_static_createFileFromAsset},
  21. {"fileExists", lua_FileSystem_static_fileExists},
  22. {"getAssetPath", lua_FileSystem_static_getAssetPath},
  23. {"getDirectoryName", lua_FileSystem_static_getDirectoryName},
  24. {"getExtension", lua_FileSystem_static_getExtension},
  25. {"getResourcePath", lua_FileSystem_static_getResourcePath},
  26. {"isAbsolutePath", lua_FileSystem_static_isAbsolutePath},
  27. {"loadResourceAliases", lua_FileSystem_static_loadResourceAliases},
  28. {"readAll", lua_FileSystem_static_readAll},
  29. {"resolvePath", lua_FileSystem_static_resolvePath},
  30. {"setAssetPath", lua_FileSystem_static_setAssetPath},
  31. {"setResourcePath", lua_FileSystem_static_setResourcePath},
  32. {NULL, NULL}
  33. };
  34. std::vector<std::string> scopePath;
  35. gameplay::ScriptUtil::registerClass("FileSystem", lua_members, NULL, lua_FileSystem__gc, lua_statics, scopePath);
  36. }
  37. static FileSystem* getInstance(lua_State* state)
  38. {
  39. void* userdata = luaL_checkudata(state, 1, "FileSystem");
  40. luaL_argcheck(state, userdata != NULL, 1, "'FileSystem' expected.");
  41. return (FileSystem*)((gameplay::ScriptUtil::LuaObject*)userdata)->instance;
  42. }
  43. int lua_FileSystem__gc(lua_State* state)
  44. {
  45. // Get the number of parameters.
  46. int paramCount = lua_gettop(state);
  47. // Attempt to match the parameters to a valid binding.
  48. switch (paramCount)
  49. {
  50. case 1:
  51. {
  52. if ((lua_type(state, 1) == LUA_TUSERDATA))
  53. {
  54. void* userdata = luaL_checkudata(state, 1, "FileSystem");
  55. luaL_argcheck(state, userdata != NULL, 1, "'FileSystem' expected.");
  56. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)userdata;
  57. if (object->owns)
  58. {
  59. FileSystem* instance = (FileSystem*)object->instance;
  60. SAFE_DELETE(instance);
  61. }
  62. return 0;
  63. }
  64. lua_pushstring(state, "lua_FileSystem__gc - Failed to match the given parameters to a valid function signature.");
  65. lua_error(state);
  66. break;
  67. }
  68. default:
  69. {
  70. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  71. lua_error(state);
  72. break;
  73. }
  74. }
  75. return 0;
  76. }
  77. int lua_FileSystem_static_createFileFromAsset(lua_State* state)
  78. {
  79. // Get the number of parameters.
  80. int paramCount = lua_gettop(state);
  81. // Attempt to match the parameters to a valid binding.
  82. switch (paramCount)
  83. {
  84. case 1:
  85. {
  86. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
  87. {
  88. // Get parameter 1 off the stack.
  89. const char* param1 = gameplay::ScriptUtil::getString(1, false);
  90. FileSystem::createFileFromAsset(param1);
  91. return 0;
  92. }
  93. lua_pushstring(state, "lua_FileSystem_static_createFileFromAsset - Failed to match the given parameters to a valid function signature.");
  94. lua_error(state);
  95. break;
  96. }
  97. default:
  98. {
  99. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  100. lua_error(state);
  101. break;
  102. }
  103. }
  104. return 0;
  105. }
  106. int lua_FileSystem_static_fileExists(lua_State* state)
  107. {
  108. // Get the number of parameters.
  109. int paramCount = lua_gettop(state);
  110. // Attempt to match the parameters to a valid binding.
  111. switch (paramCount)
  112. {
  113. case 1:
  114. {
  115. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
  116. {
  117. // Get parameter 1 off the stack.
  118. const char* param1 = gameplay::ScriptUtil::getString(1, false);
  119. bool result = FileSystem::fileExists(param1);
  120. // Push the return value onto the stack.
  121. lua_pushboolean(state, result);
  122. return 1;
  123. }
  124. lua_pushstring(state, "lua_FileSystem_static_fileExists - Failed to match the given parameters to a valid function signature.");
  125. lua_error(state);
  126. break;
  127. }
  128. default:
  129. {
  130. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  131. lua_error(state);
  132. break;
  133. }
  134. }
  135. return 0;
  136. }
  137. int lua_FileSystem_static_getAssetPath(lua_State* state)
  138. {
  139. // Get the number of parameters.
  140. int paramCount = lua_gettop(state);
  141. // Attempt to match the parameters to a valid binding.
  142. switch (paramCount)
  143. {
  144. case 0:
  145. {
  146. const char* result = FileSystem::getAssetPath();
  147. // Push the return value onto the stack.
  148. lua_pushstring(state, result);
  149. return 1;
  150. break;
  151. }
  152. default:
  153. {
  154. lua_pushstring(state, "Invalid number of parameters (expected 0).");
  155. lua_error(state);
  156. break;
  157. }
  158. }
  159. return 0;
  160. }
  161. int lua_FileSystem_static_getDirectoryName(lua_State* state)
  162. {
  163. // Get the number of parameters.
  164. int paramCount = lua_gettop(state);
  165. // Attempt to match the parameters to a valid binding.
  166. switch (paramCount)
  167. {
  168. case 1:
  169. {
  170. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
  171. {
  172. // Get parameter 1 off the stack.
  173. const char* param1 = gameplay::ScriptUtil::getString(1, false);
  174. std::string result = FileSystem::getDirectoryName(param1);
  175. // Push the return value onto the stack.
  176. lua_pushstring(state, result.c_str());
  177. return 1;
  178. }
  179. lua_pushstring(state, "lua_FileSystem_static_getDirectoryName - Failed to match the given parameters to a valid function signature.");
  180. lua_error(state);
  181. break;
  182. }
  183. default:
  184. {
  185. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  186. lua_error(state);
  187. break;
  188. }
  189. }
  190. return 0;
  191. }
  192. int lua_FileSystem_static_getExtension(lua_State* state)
  193. {
  194. // Get the number of parameters.
  195. int paramCount = lua_gettop(state);
  196. // Attempt to match the parameters to a valid binding.
  197. switch (paramCount)
  198. {
  199. case 1:
  200. {
  201. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
  202. {
  203. // Get parameter 1 off the stack.
  204. const char* param1 = gameplay::ScriptUtil::getString(1, false);
  205. std::string result = FileSystem::getExtension(param1);
  206. // Push the return value onto the stack.
  207. lua_pushstring(state, result.c_str());
  208. return 1;
  209. }
  210. lua_pushstring(state, "lua_FileSystem_static_getExtension - Failed to match the given parameters to a valid function signature.");
  211. lua_error(state);
  212. break;
  213. }
  214. default:
  215. {
  216. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  217. lua_error(state);
  218. break;
  219. }
  220. }
  221. return 0;
  222. }
  223. int lua_FileSystem_static_getResourcePath(lua_State* state)
  224. {
  225. // Get the number of parameters.
  226. int paramCount = lua_gettop(state);
  227. // Attempt to match the parameters to a valid binding.
  228. switch (paramCount)
  229. {
  230. case 0:
  231. {
  232. const char* result = FileSystem::getResourcePath();
  233. // Push the return value onto the stack.
  234. lua_pushstring(state, result);
  235. return 1;
  236. break;
  237. }
  238. default:
  239. {
  240. lua_pushstring(state, "Invalid number of parameters (expected 0).");
  241. lua_error(state);
  242. break;
  243. }
  244. }
  245. return 0;
  246. }
  247. int lua_FileSystem_static_isAbsolutePath(lua_State* state)
  248. {
  249. // Get the number of parameters.
  250. int paramCount = lua_gettop(state);
  251. // Attempt to match the parameters to a valid binding.
  252. switch (paramCount)
  253. {
  254. case 1:
  255. {
  256. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
  257. {
  258. // Get parameter 1 off the stack.
  259. const char* param1 = gameplay::ScriptUtil::getString(1, false);
  260. bool result = FileSystem::isAbsolutePath(param1);
  261. // Push the return value onto the stack.
  262. lua_pushboolean(state, result);
  263. return 1;
  264. }
  265. lua_pushstring(state, "lua_FileSystem_static_isAbsolutePath - Failed to match the given parameters to a valid function signature.");
  266. lua_error(state);
  267. break;
  268. }
  269. default:
  270. {
  271. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  272. lua_error(state);
  273. break;
  274. }
  275. }
  276. return 0;
  277. }
  278. int lua_FileSystem_static_loadResourceAliases(lua_State* state)
  279. {
  280. // Get the number of parameters.
  281. int paramCount = lua_gettop(state);
  282. // Attempt to match the parameters to a valid binding.
  283. switch (paramCount)
  284. {
  285. case 1:
  286. {
  287. do
  288. {
  289. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
  290. {
  291. // Get parameter 1 off the stack.
  292. const char* param1 = gameplay::ScriptUtil::getString(1, false);
  293. FileSystem::loadResourceAliases(param1);
  294. return 0;
  295. }
  296. } while (0);
  297. do
  298. {
  299. if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL))
  300. {
  301. // Get parameter 1 off the stack.
  302. bool param1Valid;
  303. gameplay::ScriptUtil::LuaArray<Properties> param1 = gameplay::ScriptUtil::getObjectPointer<Properties>(1, "Properties", false, &param1Valid);
  304. if (!param1Valid)
  305. break;
  306. FileSystem::loadResourceAliases(param1);
  307. return 0;
  308. }
  309. } while (0);
  310. lua_pushstring(state, "lua_FileSystem_static_loadResourceAliases - Failed to match the given parameters to a valid function signature.");
  311. lua_error(state);
  312. break;
  313. }
  314. default:
  315. {
  316. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  317. lua_error(state);
  318. break;
  319. }
  320. }
  321. return 0;
  322. }
  323. int lua_FileSystem_static_readAll(lua_State* state)
  324. {
  325. // Get the number of parameters.
  326. int paramCount = lua_gettop(state);
  327. // Attempt to match the parameters to a valid binding.
  328. switch (paramCount)
  329. {
  330. case 1:
  331. {
  332. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
  333. {
  334. // Get parameter 1 off the stack.
  335. const char* param1 = gameplay::ScriptUtil::getString(1, false);
  336. const char* result = FileSystem::readAll(param1);
  337. // Push the return value onto the stack.
  338. lua_pushstring(state, result);
  339. return 1;
  340. }
  341. lua_pushstring(state, "lua_FileSystem_static_readAll - Failed to match the given parameters to a valid function signature.");
  342. lua_error(state);
  343. break;
  344. }
  345. case 2:
  346. {
  347. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
  348. (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA))
  349. {
  350. // Get parameter 1 off the stack.
  351. const char* param1 = gameplay::ScriptUtil::getString(1, false);
  352. // Get parameter 2 off the stack.
  353. gameplay::ScriptUtil::LuaArray<int> param2 = gameplay::ScriptUtil::getIntPointer(2);
  354. const char* result = FileSystem::readAll(param1, param2);
  355. // Push the return value onto the stack.
  356. lua_pushstring(state, result);
  357. return 1;
  358. }
  359. lua_pushstring(state, "lua_FileSystem_static_readAll - Failed to match the given parameters to a valid function signature.");
  360. lua_error(state);
  361. break;
  362. }
  363. default:
  364. {
  365. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  366. lua_error(state);
  367. break;
  368. }
  369. }
  370. return 0;
  371. }
  372. int lua_FileSystem_static_resolvePath(lua_State* state)
  373. {
  374. // Get the number of parameters.
  375. int paramCount = lua_gettop(state);
  376. // Attempt to match the parameters to a valid binding.
  377. switch (paramCount)
  378. {
  379. case 1:
  380. {
  381. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
  382. {
  383. // Get parameter 1 off the stack.
  384. const char* param1 = gameplay::ScriptUtil::getString(1, false);
  385. const char* result = FileSystem::resolvePath(param1);
  386. // Push the return value onto the stack.
  387. lua_pushstring(state, result);
  388. return 1;
  389. }
  390. lua_pushstring(state, "lua_FileSystem_static_resolvePath - Failed to match the given parameters to a valid function signature.");
  391. lua_error(state);
  392. break;
  393. }
  394. default:
  395. {
  396. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  397. lua_error(state);
  398. break;
  399. }
  400. }
  401. return 0;
  402. }
  403. int lua_FileSystem_static_setAssetPath(lua_State* state)
  404. {
  405. // Get the number of parameters.
  406. int paramCount = lua_gettop(state);
  407. // Attempt to match the parameters to a valid binding.
  408. switch (paramCount)
  409. {
  410. case 1:
  411. {
  412. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
  413. {
  414. // Get parameter 1 off the stack.
  415. const char* param1 = gameplay::ScriptUtil::getString(1, false);
  416. FileSystem::setAssetPath(param1);
  417. return 0;
  418. }
  419. lua_pushstring(state, "lua_FileSystem_static_setAssetPath - Failed to match the given parameters to a valid function signature.");
  420. lua_error(state);
  421. break;
  422. }
  423. default:
  424. {
  425. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  426. lua_error(state);
  427. break;
  428. }
  429. }
  430. return 0;
  431. }
  432. int lua_FileSystem_static_setResourcePath(lua_State* state)
  433. {
  434. // Get the number of parameters.
  435. int paramCount = lua_gettop(state);
  436. // Attempt to match the parameters to a valid binding.
  437. switch (paramCount)
  438. {
  439. case 1:
  440. {
  441. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
  442. {
  443. // Get parameter 1 off the stack.
  444. const char* param1 = gameplay::ScriptUtil::getString(1, false);
  445. FileSystem::setResourcePath(param1);
  446. return 0;
  447. }
  448. lua_pushstring(state, "lua_FileSystem_static_setResourcePath - Failed to match the given parameters to a valid function signature.");
  449. lua_error(state);
  450. break;
  451. }
  452. default:
  453. {
  454. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  455. lua_error(state);
  456. break;
  457. }
  458. }
  459. return 0;
  460. }
  461. }