JSONFile.pkg 961 B

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