comparison Core/Toolbox.cpp @ 3203:810772486249

URI "/instances/.../file" can return DICOMweb JSON or XML, depending on Accept header
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 06 Feb 2019 15:45:16 +0100
parents 4e43e67f8ecf
children cf8cbeb35f33
comparison
equal deleted inserted replaced
3202:ef4d86d05503 3203:810772486249
97 #endif 97 #endif
98 98
99 99
100 #if ORTHANC_ENABLE_PUGIXML == 1 100 #if ORTHANC_ENABLE_PUGIXML == 1
101 # include "ChunkedBuffer.h" 101 # include "ChunkedBuffer.h"
102 # include <pugixml.hpp>
103 #endif 102 #endif
104 103
105 104
106 // Inclusions for UUID 105 // Inclusions for UUID
107 // http://stackoverflow.com/a/1626302 106 // http://stackoverflow.com/a/1626302
1021 1020
1022 pugi::xml_node decl = doc.prepend_child(pugi::node_declaration); 1021 pugi::xml_node decl = doc.prepend_child(pugi::node_declaration);
1023 decl.append_attribute("version").set_value("1.0"); 1022 decl.append_attribute("version").set_value("1.0");
1024 decl.append_attribute("encoding").set_value("utf-8"); 1023 decl.append_attribute("encoding").set_value("utf-8");
1025 1024
1025 XmlToString(target, doc);
1026 }
1027
1028 void Toolbox::XmlToString(std::string& target,
1029 const pugi::xml_document& source)
1030 {
1026 ChunkedBufferWriter writer; 1031 ChunkedBufferWriter writer;
1027 doc.save(writer, " ", pugi::format_default, pugi::encoding_utf8); 1032 source.save(writer, " ", pugi::format_default, pugi::encoding_utf8);
1028 writer.Flatten(target); 1033 writer.Flatten(target);
1029 } 1034 }
1030
1031 #endif 1035 #endif
1032 1036
1033 1037
1034 1038
1035 bool Toolbox::IsInteger(const std::string& str) 1039 bool Toolbox::IsInteger(const std::string& str)