ugh, this is still very messy. Calling this is quite verbose, hence the wrapper below.
| 3749 | // ugh, this is still very messy. Calling this is quite verbose, hence the |
| 3750 | // wrapper below. |
| 3751 | static void _base_split_parse(const string &s, |
| 3752 | const string &separator, |
| 3753 | function<void(const string &, bool)> modify, |
| 3754 | bool prepend=false) |
| 3755 | { |
| 3756 | // Lots of things use split parse, for some ^= and += should do different things, |
| 3757 | // for others they should not. Split parse just passes them along. |
| 3758 | // this does not allow escaping `separator`, because it doesn't seem like |
| 3759 | // any of the callers currently should need it |
| 3760 | const vector<string> defs = split_string(separator, s); |
| 3761 | if (prepend) |
| 3762 | { |
| 3763 | for (auto it = defs.rbegin(); it != defs.rend(); ++it) |
| 3764 | modify(*it, prepend); |
| 3765 | } |
| 3766 | else |
| 3767 | { |
| 3768 | for (auto it = defs.begin(); it != defs.end(); ++it) |
| 3769 | modify(*it, prepend); |
| 3770 | } |
| 3771 | } |
| 3772 | |
| 3773 | void game_options::split_parse(const opt_parse_state &state, |
| 3774 | const string &separator, |
no test coverage detected