From 9aeb9ad7391a5ec9a6b8865b00cb653e8a2a930f Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 17 Apr 2020 15:06:42 -0700 Subject: [PATCH] Add tag finder functions To find each individual tag quickly, to optimize levels list loading. I opted to not read the tags , , and as they're actually pretty useless. Also I've added a tag finder for but it's not meant to be used directly, it's only used to check that the tag exists. --- desktop_version/src/editor.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index 01411836..62ac6799 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -153,6 +153,23 @@ std::string find_tag(const std::string& buf, const std::string& start, const std return value; } +#define TAG_FINDER(NAME, TAG) \ +std::string NAME(const std::string& buf) \ +{ \ + return find_tag(buf, "<" TAG ">", ""); \ +} + +TAG_FINDER(find_metadata, "MetaData"); //only for checking that it exists + +TAG_FINDER(find_creator, "Creator"); +TAG_FINDER(find_title, "Title"); +TAG_FINDER(find_desc1, "Desc1"); +TAG_FINDER(find_desc2, "Desc2"); +TAG_FINDER(find_desc3, "Desc3"); +TAG_FINDER(find_website, "website"); + +#undef TAG_FINDER + void editorclass::getDirectoryData() {