comparison OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp @ 4297:785a2713323e

abi continued
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 05 Nov 2020 17:20:49 +0100
parents 7112a8af0b63
children 50b0c69b653a
comparison
equal deleted inserted replaced
4296:3b70a2e6a06c 4297:785a2713323e
334 // (e.g. infinity) 334 // (e.g. infinity)
335 return Json::Value(value); 335 return Json::Value(value);
336 } 336 }
337 } 337 }
338 338
339 DicomWebJsonVisitor::DicomWebJsonVisitor() :
340 formatter_(NULL)
341 {
342 Clear();
343 }
344
345 void DicomWebJsonVisitor::SetFormatter(DicomWebJsonVisitor::IBinaryFormatter &formatter)
346 {
347 formatter_ = &formatter;
348 }
349
350 void DicomWebJsonVisitor::Clear()
351 {
352 result_ = Json::objectValue;
353 }
354
355 const Json::Value &DicomWebJsonVisitor::GetResult() const
356 {
357 return result_;
358 }
359
339 360
340 #if ORTHANC_ENABLE_PUGIXML == 1 361 #if ORTHANC_ENABLE_PUGIXML == 1
341 void DicomWebJsonVisitor::FormatXml(std::string& target) const 362 void DicomWebJsonVisitor::FormatXml(std::string& target) const
342 { 363 {
343 pugi::xml_document doc; 364 pugi::xml_document doc;
344 DicomWebJsonToXml(doc, result_); 365 DicomWebJsonToXml(doc, result_);
345 Toolbox::XmlToString(target, doc); 366 Toolbox::XmlToString(target, doc);
346 } 367 }
347 #endif 368 #endif
369
370
371 void DicomWebJsonVisitor::VisitNotSupported(const std::vector<DicomTag> &parentTags,
372 const std::vector<size_t> &parentIndexes,
373 const DicomTag &tag,
374 ValueRepresentation vr)
375 {
376 }
348 377
349 378
350 void DicomWebJsonVisitor::VisitEmptySequence(const std::vector<DicomTag>& parentTags, 379 void DicomWebJsonVisitor::VisitEmptySequence(const std::vector<DicomTag>& parentTags,
351 const std::vector<size_t>& parentIndexes, 380 const std::vector<size_t>& parentIndexes,
352 const DicomTag& tag) 381 const DicomTag& tag)
595 * ("Error Exception while invoking plugin service 624 * ("Error Exception while invoking plugin service
596 * 32: Bad file format"): 625 * 32: Bad file format"):
597 * https://groups.google.com/d/msg/orthanc-users/T32FovWPcCE/-hKFbfRJBgAJ 626 * https://groups.google.com/d/msg/orthanc-users/T32FovWPcCE/-hKFbfRJBgAJ
598 **/ 627 **/
599 628
600 std::string t = Orthanc::Toolbox::StripSpaces(tokens[i]); 629 std::string t = Toolbox::StripSpaces(tokens[i]);
601 if (t.empty()) 630 if (t.empty())
602 { 631 {
603 node[KEY_VALUE].append(Json::nullValue); 632 node[KEY_VALUE].append(Json::nullValue);
604 } 633 }
605 else 634 else
611 break; 640 break;
612 } 641 }
613 642
614 case ValueRepresentation_DecimalString: 643 case ValueRepresentation_DecimalString:
615 { 644 {
616 std::string t = Orthanc::Toolbox::StripSpaces(tokens[i]); 645 std::string t = Toolbox::StripSpaces(tokens[i]);
617 if (t.empty()) 646 if (t.empty())
618 { 647 {
619 node[KEY_VALUE].append(Json::nullValue); 648 node[KEY_VALUE].append(Json::nullValue);
620 } 649 }
621 else 650 else