MCPcopy Create free account
hub / github.com/amwatson/CitraVR / Serialize

Method Serialize

src/common/param_package.cpp:52–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50ParamPackage::ParamPackage(std::initializer_list<DataType::value_type> list) : data(list) {}
51
52std::string ParamPackage::Serialize() const {
53 if (data.empty())
54 return EMPTY_PLACEHOLDER;
55
56 std::string result;
57
58 for (const auto& pair : data) {
59 std::array<std::string, 2> key_value{{pair.first, pair.second}};
60 for (std::string& part : key_value) {
61 part = Common::ReplaceAll(part, {ESCAPE_CHARACTER}, ESCAPE_CHARACTER_ESCAPE);
62 part = Common::ReplaceAll(part, {PARAM_SEPARATOR}, PARAM_SEPARATOR_ESCAPE);
63 part = Common::ReplaceAll(part, {KEY_VALUE_SEPARATOR}, KEY_VALUE_SEPARATOR_ESCAPE);
64 }
65 result += key_value[0] + KEY_VALUE_SEPARATOR + key_value[1] + PARAM_SEPARATOR;
66 }
67
68 result.pop_back(); // discard the trailing PARAM_SEPARATOR
69 return result;
70}
71
72std::string ParamPackage::Get(const std::string& key, const std::string& default_value) const {
73 auto pair = data.find(key);

Callers 13

ApplyConfigurationMethod · 0.45
SetAnalogButtonFunction · 0.45
ApplyConfigurationMethod · 0.45
SaveCurrentMappingMethod · 0.45
GetButtonInputMethod · 0.45
GetCurrentValueMethod · 0.45
param_package.cppFile · 0.45
CreateMethod · 0.45
GenerateKeyboardParamFunction · 0.45

Calls 2

ReplaceAllFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected