MCPcopy Create free account
hub / github.com/MITK/MITK / ResolvePreferencesXMLFromCLIArg

Function ResolvePreferencesXMLFromCLIArg

Modules/AppUtil/src/mitkBaseApplication.cpp:158–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156 }
157
158 std::string ResolvePreferencesXMLFromCLIArg(const QString& arg, const char* kind)
159 {
160 if (arg.startsWith('@'))
161 {
162 const auto filePath = arg.mid(1).toStdString();
163 if (filePath.empty())
164 mitkThrow() << "Cannot open preferences " << kind << " file. \"@\" indicates file reference, but has no file path following.";
165
166 std::ifstream file(filePath);
167
168 if (!file.is_open())
169 mitkThrow() << "Cannot open preferences " << kind << " file: \"" << filePath << "\".";
170
171 std::ostringstream buffer;
172 buffer << file.rdbuf();
173 return buffer.str();
174 }
175
176 return arg.toStdString();
177 }
178
179 void ApplyPreferencesOverridesFromCLI(const QStringList& overrides, mitk::IPreferences* rootPrefs)
180 {

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected