| 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. |
no test coverage detected