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

Function ParseLoadStyle

Modules/SceneSerialization/src/mitkSceneJsonReader.cpp:220–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218 }
219
220 LoadStyle ParseLoadStyle(const json &propertyMap, const std::string &context)
221 {
222 if (!propertyMap.is_object())
223 return LoadStyle::Modify;
224 const auto it = propertyMap.find(META_LOADSTYLE);
225 if (it == propertyMap.end() || it->is_null())
226 return LoadStyle::Modify;
227 if (!it->is_string())
228 {
229 mitkThrow() << "Invalid '_loadstyle' in " << context << ": expected string ('modify' or 'replace').";
230 }
231 const std::string value = it->get<std::string>();
232 if (value == LOADSTYLE_MODIFY)
233 return LoadStyle::Modify;
234 if (value == LOADSTYLE_REPLACE)
235 return LoadStyle::Replace;
236 mitkThrow() << "Invalid '_loadstyle' value '" << value << "' in " << context
237 << ". Expected 'modify' or 'replace'.";
238 }
239
240 /**
241 * \brief Resolve `_file` indirection in a property-map JSON object.

Callers 2

ApplyPropertyMapFunction · 0.85
LoadSceneMethod · 0.85

Calls 2

findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected