| 321 | } |
| 322 | |
| 323 | void mitk::Forms::to_json(nlohmann::ordered_json& j, const Form& f) |
| 324 | { |
| 325 | j["FileFormat"] = "MITK Form"; |
| 326 | j["Version"] = 1; |
| 327 | |
| 328 | const int numberOfSections = f.GetNumberOfSections(); |
| 329 | |
| 330 | for (int index = 0; index < numberOfSections; ++index) |
| 331 | { |
| 332 | const auto& section = f.GetSection(index); |
| 333 | ordered_json jSection; |
| 334 | |
| 335 | if (auto title = section.GetTitle(); !title.empty()) |
| 336 | jSection["Title"] = title; |
| 337 | |
| 338 | if (auto description = section.GetDescription(); !description.empty()) |
| 339 | jSection["Description"] = description; |
| 340 | |
| 341 | for (const auto* question : section.GetQuestions()) |
| 342 | { |
| 343 | ordered_json jQuestion; |
| 344 | question->ToJSON(jQuestion); |
| 345 | |
| 346 | jSection["Questions"].push_back(jQuestion); |
| 347 | } |
| 348 | |
| 349 | j["Sections"].push_back(jSection); |
| 350 | } |
| 351 | } |
nothing calls this directly
no test coverage detected