MCPcopy Create free account
hub / github.com/LunarG/VulkanTools / Save

Method Save

vkconfig_core/executable_manager.cpp:235–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235bool ExecutableManager::Save(QJsonObject& json_root_object) const {
236 QJsonObject json_executables_object;
237 json_executables_object.insert("active_executable", this->active_executable.RelativePath().c_str());
238 json_executables_object.insert("last_path_executable", this->last_path_executable.RelativePath().c_str());
239 json_executables_object.insert("clear_on_launch", this->launcher_clear_on_launch);
240
241 QJsonObject json_executables_list_object;
242 for (std::size_t i = 0, n = this->data.size(); i < n; ++i) {
243 const Executable& executable = this->data[i];
244
245 QJsonObject json_executable_object;
246 json_executable_object.insert("enabled", executable.enabled);
247 json_executable_object.insert("removable", executable.removable);
248 json_executable_object.insert("configuration", executable.configuration.c_str());
249 json_executable_object.insert("active_option", executable.GetActiveOptionsName().c_str());
250
251 QJsonArray json_options_array;
252 const std::vector<ExecutableOptions>& options_list = executable.GetOptions();
253
254 for (std::size_t j = 0, o = options_list.size(); j < o; ++j) {
255 const ExecutableOptions& options = options_list[j];
256
257 QJsonArray json_arg_array;
258 for (std::size_t k = 0, p = options.args.size(); k < p; ++k) {
259 json_arg_array.append(options.args[k].c_str());
260 }
261
262 QJsonArray json_env_array;
263 for (std::size_t k = 0, p = options.envs.size(); k < p; ++k) {
264 json_env_array.append(TrimSurroundingWhitespace(options.envs[k], " \t\n\r").c_str());
265 }
266
267 QJsonObject json_option_object;
268 json_option_object.insert("label", options.label.c_str());
269 json_option_object.insert("working_folder", options.working_folder.RelativePath().c_str());
270 json_option_object.insert("arguments", json_arg_array);
271 json_option_object.insert("environment_variables", json_env_array);
272 json_option_object.insert("log_file", options.log_file.RelativePath().c_str());
273
274 json_options_array.append(json_option_object);
275 }
276 json_executable_object.insert("options", json_options_array);
277
278 json_executables_list_object.insert(executable.path.RelativePath().c_str(), json_executable_object);
279 }
280
281 json_executables_object.insert("list", json_executables_list_object);
282
283 json_root_object.insert("executables", json_executables_object);
284
285 return true;
286}
287
288void ExecutableManager::SetActiveExecutable(int executable_index) {
289 assert(executable_index < static_cast<int>(this->data.size()));

Callers

nothing calls this directly

Calls 3

RelativePathMethod · 0.80
GetActiveOptionsNameMethod · 0.80

Tested by

no test coverage detected