XMLFile.pkg 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 GetRoot(const String name = String::EMPTY);
  9. String ToString(const String indentation = "\t") const;
  10. void Patch(XMLFile* patchFile);
  11. void Patch(XMLElement patchElement);
  12. tolua_outside bool XMLFileSave @ Save(const String fileName, const String indentation = "\t") const;
  13. };
  14. ${
  15. #define TOLUA_DISABLE_tolua_ResourceLuaAPI_XMLFile_new00
  16. static int tolua_ResourceLuaAPI_XMLFile_new00(lua_State* tolua_S)
  17. {
  18. return ToluaNewObject<XMLFile>(tolua_S);
  19. }
  20. #define TOLUA_DISABLE_tolua_ResourceLuaAPI_XMLFile_new00_local
  21. static int tolua_ResourceLuaAPI_XMLFile_new00_local(lua_State* tolua_S)
  22. {
  23. return ToluaNewObjectGC<XMLFile>(tolua_S);
  24. }
  25. $}
  26. ${
  27. static bool XMLFileSave(const XMLFile* resource, const String& fileName, const String& indentation)
  28. {
  29. if (!resource)
  30. return false;
  31. File file(resource->GetContext());
  32. return file.Open(fileName, FILE_WRITE) && resource->Save(file, indentation);
  33. }
  34. $}