ResourceObject.cpp 1002 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #include <AnKi/Resource/ResourceObject.h>
  6. #include <AnKi/Resource/ResourceManager.h>
  7. #include <AnKi/Util/Xml.h>
  8. namespace anki {
  9. Error ResourceObject::openFile(const CString& filename, ResourceFilePtr& file)
  10. {
  11. return ResourceFilesystem::getSingleton().openFile(filename, file);
  12. }
  13. Error ResourceObject::openFileReadAllText(const CString& filename, ResourceString& text)
  14. {
  15. // Load file
  16. ResourceFilePtr file;
  17. ANKI_CHECK(ResourceFilesystem::getSingleton().openFile(filename, file));
  18. // Read string
  19. ANKI_CHECK(file->readAllText(text));
  20. return Error::kNone;
  21. }
  22. Error ResourceObject::openFileParseXml(const CString& filename, ResourceXmlDocument& xml)
  23. {
  24. ResourceString txt;
  25. ANKI_CHECK(openFileReadAllText(filename, txt));
  26. ANKI_CHECK(xml.parse(txt.toCString()));
  27. return Error::kNone;
  28. }
  29. } // end namespace anki