GameList: Support exporting XML snippets for compatibility info

This commit is contained in:
Connor McLaughlin 2020-05-16 20:24:25 +10:00
parent f671840a18
commit 669934eb1a
2 changed files with 18 additions and 0 deletions

View file

@ -1149,3 +1149,19 @@ bool GameList::SaveCompatibilityDatabaseForEntry(const GameListCompatibilityEntr
Log_InfoPrintf("Updated compatibility list '%s'", m_compatibility_list_filename.c_str());
return true;
}
std::string GameList::ExportCompatibilityEntry(const GameListCompatibilityEntry* entry)
{
tinyxml2::XMLDocument doc;
tinyxml2::XMLElement* root_elem = doc.NewElement("compatibility-list");
doc.InsertEndChild(root_elem);
tinyxml2::XMLElement* entry_elem = doc.NewElement("entry");
root_elem->InsertEndChild(entry_elem);
InitElementForCompatibilityEntry(&doc, entry_elem, entry);
tinyxml2::XMLPrinter printer;
//doc.Print(&printer);
entry_elem->Accept(&printer);
return std::string(printer.CStr(), printer.CStrSize());
}

View file

@ -110,6 +110,8 @@ public:
void UpdateCompatibilityEntry(GameListCompatibilityEntry new_entry, bool save_to_list = true);
static std::string ExportCompatibilityEntry(const GameListCompatibilityEntry* entry);
private:
enum : u32
{