| 140 | } |
| 141 | |
| 142 | void ScriptConfig::StringToSettings(std::string_view value) |
| 143 | { |
| 144 | std::string_view to_process = value; |
| 145 | for (;;) { |
| 146 | /* Analyze the string ('name=value,name=value\0') */ |
| 147 | size_t pos = to_process.find_first_of('='); |
| 148 | if (pos == std::string_view::npos) return; |
| 149 | |
| 150 | std::string_view item_name = to_process.substr(0, pos); |
| 151 | |
| 152 | to_process.remove_prefix(pos + 1); |
| 153 | pos = to_process.find_first_of(','); |
| 154 | int item_value = 0; |
| 155 | std::from_chars(to_process.data(), to_process.data() + std::min(pos, to_process.size()), item_value); |
| 156 | |
| 157 | this->SetSetting(item_name, item_value); |
| 158 | |
| 159 | if (pos == std::string_view::npos) return; |
| 160 | to_process.remove_prefix(pos + 1); |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | std::string ScriptConfig::SettingsToString() const |
| 165 | { |
no test coverage detected