parse std::map of replay action info elements

This commit is contained in:
2024-07-03 22:15:53 -06:00
committed by Celtic Minstrel
parent b81974d915
commit 51986ef981
2 changed files with 11 additions and 0 deletions

View File

@@ -105,6 +105,16 @@ Element* pop_next_action(std::string expected_action_type) {
return clone;
}
std::map<std::string,std::string> info_from_action(Element* action) {
std::map<std::string,std::string> info = {};
Element* next_child = action->FirstChildElement(false);
while(next_child){
info[next_child->Value()] = next_child->GetText();
next_child = next_child->NextSiblingElement(false);
}
return info;
}
std::string encode_file(fs::path file) {
std::ifstream ifs(file.string(), std::ios::binary|std::ios::ate);
std::ifstream::pos_type pos = ifs.tellg();

View File

@@ -19,6 +19,7 @@ extern void record_action(std::string action_type, std::map<std::string,std::str
extern bool has_next_action();
extern std::string next_action_type();
extern Element* pop_next_action(std::string expected_action_type="");
extern std::map<std::string,std::string> info_from_action(Element* action);
extern std::string encode_file(fs::path file);
extern void decode_file(std::string data, fs::path file);