JSONFile.pkg 1022 B

123456789101112131415161718192021222324252627282930313233343536
  1. $#include "Resource/JSONFile.h"
  2. class JSONFile : Resource
  3. {
  4. JSONFile();
  5. ~JSONFile();
  6. bool FromString(const String source);
  7. String ToString(const String indendation = "\t") const;
  8. const JSONValue& GetRoot() const;
  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. static bool JSONFileSave(const JSONFile* resource, const String& fileName, const String& indentation)
  23. {
  24. if (!resource)
  25. return false;
  26. File file(resource->GetContext());
  27. return file.Open(fileName, FILE_WRITE) && resource->Save(file, indentation);
  28. }
  29. $}