Library: Allow loading xml data from memory

This commit is contained in:
Daniel Marjamäki 2014-01-09 21:58:56 +01:00
parent 752e9d0fb7
commit a26c5736da
2 changed files with 7 additions and 0 deletions

View File

@ -89,6 +89,12 @@ bool Library::load(const char exename[], const char path[])
return (error == tinyxml2::XML_NO_ERROR) && load(doc); return (error == tinyxml2::XML_NO_ERROR) && load(doc);
} }
bool Library::loadxmldata(const char xmldata[], std::size_t len)
{
tinyxml2::XMLDocument doc;
return (tinyxml2::XML_NO_ERROR == doc.Parse(xmldata, len)) && load(doc);
}
bool Library::load(const tinyxml2::XMLDocument &doc) bool Library::load(const tinyxml2::XMLDocument &doc)
{ {
const tinyxml2::XMLElement * const rootnode = doc.FirstChildElement(); const tinyxml2::XMLElement * const rootnode = doc.FirstChildElement();

View File

@ -47,6 +47,7 @@ public:
Library(); Library();
bool load(const char exename [], const char path []); bool load(const char exename [], const char path []);
bool loadxmldata(const char xmldata[], std::size_t len);
bool load(const tinyxml2::XMLDocument &doc); bool load(const tinyxml2::XMLDocument &doc);
/** get allocation id for function (by name) */ /** get allocation id for function (by name) */