JSONFile.pkg 918 B

12345678910111213141516171819202122232425262728293031323334
  1. $#include "Resource/JSONFile.h"
  2. class JSONFile : Resource
  3. {
  4. JSONFile();
  5. ~JSONFile();
  6. const JSONValue& GetRoot() const;
  7. tolua_outside bool JSONFileSave @ Save(const String fileName, const String indentation = "\t") const;
  8. };
  9. ${
  10. #define TOLUA_DISABLE_tolua_ResourceLuaAPI_JSONFile_new00
  11. static int tolua_ResourceLuaAPI_JSONFile_new00(lua_State* tolua_S)
  12. {
  13. return ToluaNewObject<JSONFile>(tolua_S);
  14. }
  15. #define TOLUA_DISABLE_tolua_ResourceLuaAPI_JSONFile_new00_local
  16. static int tolua_ResourceLuaAPI_JSONFile_new00_local(lua_State* tolua_S)
  17. {
  18. return ToluaNewObjectGC<JSONFile>(tolua_S);
  19. }
  20. static bool JSONFileSave(const JSONFile* resource, const String& fileName, const String& indentation)
  21. {
  22. if (!resource)
  23. return false;
  24. File file(resource->GetContext());
  25. return file.Open(fileName, FILE_WRITE) && resource->Save(file, indentation);
  26. }
  27. $}