Translate actions into a list of = setting strings.
| 846 | |
| 847 | //! Translate actions into a list of <key>=<value> setting strings. |
| 848 | std::vector<std::string> GetValues(const ActionList& actions, |
| 849 | const std::string& section, |
| 850 | const std::string& name, |
| 851 | const std::string& value_prefix) |
| 852 | { |
| 853 | std::vector<std::string> values; |
| 854 | int suffix = 0; |
| 855 | for (Action action : actions) { |
| 856 | if (action == NONE) break; |
| 857 | std::string prefix; |
| 858 | if (action == SECTION_SET || action == SECTION_NEGATE) prefix = section + "."; |
| 859 | if (action == SET || action == SECTION_SET) { |
| 860 | for (int i = 0; i < 2; ++i) { |
| 861 | values.push_back(prefix + name + "=" + value_prefix + ToString(++suffix)); |
| 862 | } |
| 863 | } |
| 864 | if (action == NEGATE || action == SECTION_NEGATE) { |
| 865 | values.push_back(prefix + "no" + name + "=1"); |
| 866 | } |
| 867 | } |
| 868 | return values; |
| 869 | } |
| 870 | }; |
| 871 | |
| 872 | // Regression test covering different ways config settings can be merged. The |