XMLFile.pkg 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. $#include "Resource/XMLFile.h"
  2. class XMLFile : public Resource
  3. {
  4. XMLFile();
  5. ~XMLFile();
  6. bool FromString(const String source);
  7. XMLElement CreateRoot(const String name = String::EMPTY);
  8. XMLElement GetOrCreateRoot(const String name = String::EMPTY);
  9. XMLElement GetRoot(const String name = String::EMPTY);
  10. String ToString(const String indentation = "\t") const;
  11. void Patch(XMLFile* patchFile);
  12. void Patch(XMLElement patchElement);
  13. tolua_outside bool XMLFileSave @ Save(const String fileName, const String indentation = "\t") const;
  14. };
  15. ${
  16. #define TOLUA_DISABLE_tolua_ResourceLuaAPI_XMLFile_new00
  17. static int tolua_ResourceLuaAPI_XMLFile_new00(lua_State* tolua_S)
  18. {
  19. return ToluaNewObject<XMLFile>(tolua_S);
  20. }
  21. #define TOLUA_DISABLE_tolua_ResourceLuaAPI_XMLFile_new00_local
  22. static int tolua_ResourceLuaAPI_XMLFile_new00_local(lua_State* tolua_S)
  23. {
  24. return ToluaNewObjectGC<XMLFile>(tolua_S);
  25. }
  26. $}
  27. ${
  28. static bool XMLFileSave(const XMLFile* resource, const String& fileName, const String& indentation)
  29. {
  30. if (!resource)
  31. return false;
  32. File file(resource->GetContext());
  33. return file.Open(fileName, FILE_WRITE) && resource->Save(file, indentation);
  34. }
  35. $}