MCPcopy Create free account
hub / github.com/HailToDodongo/pyrite64 / parseBitmask

Function parseBitmask

src/utils/codeParser.cpp:61–73  ·  view source on GitHub ↗

Parses a "bit=name" comma separated list (e.g. "0=Fire, 1=Water") into (bit, name) pairs.

Source from the content-addressed store, hash-verified

59
60 // Parses a "bit=name" comma separated list (e.g. "0=Fire, 1=Water") into (bit, name) pairs.
61 std::vector<std::pair<int, std::string>> parseBitmask(const std::string& meta) {
62 std::vector<std::pair<int, std::string>> result;
63 std::stringstream ss(meta);
64 std::string part;
65 while (std::getline(ss, part, ',')) {
66 auto eq = part.find('=');
67 if (eq == std::string::npos) continue;
68 try {
69 result.push_back({std::stoi(trim(part.substr(0, eq))), trim(part.substr(eq + 1))});
70 } catch (...) {}
71 }
72 return result;
73 }
74
75 std::unordered_map<std::string, std::string> parseAttributes(const std::string& attrText) {
76 std::unordered_map<std::string, std::string> result;

Callers 1

parseDataStructMethod · 0.85

Calls 1

trimFunction · 0.85

Tested by

no test coverage detected