JSONFile.pkg 1.0 KB

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