Skip to content

Commit

Permalink
parse std::map of replay action info elements
Browse files Browse the repository at this point in the history
  • Loading branch information
NQNStudios committed Jul 4, 2024
1 parent 04b6b44 commit c2bffbe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/tools/replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,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();
Expand Down
1 change: 1 addition & 0 deletions src/tools/replay.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,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);

Expand Down

0 comments on commit c2bffbe

Please sign in to comment.