MCPcopy Create free account
hub / github.com/ElementsProject/elements / GetValues

Method GetValues

src/test/util_tests.cpp:949–970  ·  view source on GitHub ↗

Translate actions into a list of = setting strings.

Source from the content-addressed store, hash-verified

947
948 //! Translate actions into a list of <key>=<value> setting strings.
949 std::vector<std::string> GetValues(const ActionList& actions,
950 const std::string& section,
951 const std::string& name,
952 const std::string& value_prefix)
953 {
954 std::vector<std::string> values;
955 int suffix = 0;
956 for (Action action : actions) {
957 if (action == NONE) break;
958 std::string prefix;
959 if (action == SECTION_SET || action == SECTION_NEGATE) prefix = section + ".";
960 if (action == SET || action == SECTION_SET) {
961 for (int i = 0; i < 2; ++i) {
962 values.push_back(prefix + name + "=" + value_prefix + ToString(++suffix));
963 }
964 }
965 if (action == NEGATE || action == SECTION_NEGATE) {
966 values.push_back(prefix + "no" + name + "=1");
967 }
968 }
969 return values;
970 }
971};
972
973// Regression test covering different ways config settings can be merged. The

Callers

nothing calls this directly

Calls 2

ToStringFunction · 0.50
push_backMethod · 0.45

Tested by

no test coverage detected