| 123456789101112131415161718192021222324252627282930313233343536373839 |
- // Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
- // All rights reserved.
- // Code licensed under the BSD License.
- // http://www.anki3d.org/LICENSE
- #include <AnKi/Resource/ResourceObject.h>
- #include <AnKi/Resource/ResourceManager.h>
- #include <AnKi/Util/Xml.h>
- namespace anki {
- Error ResourceObject::openFile(const CString& filename, ResourceFilePtr& file)
- {
- return ResourceFilesystem::getSingleton().openFile(filename, file);
- }
- Error ResourceObject::openFileReadAllText(const CString& filename, ResourceString& text)
- {
- // Load file
- ResourceFilePtr file;
- ANKI_CHECK(ResourceFilesystem::getSingleton().openFile(filename, file));
- // Read string
- ANKI_CHECK(file->readAllText(text));
- return Error::kNone;
- }
- Error ResourceObject::openFileParseXml(const CString& filename, ResourceXmlDocument& xml)
- {
- ResourceString txt;
- ANKI_CHECK(openFileReadAllText(filename, txt));
- ANKI_CHECK(xml.parse(txt.toCString()));
- return Error::kNone;
- }
- } // end namespace anki
|