diff Plugins/Samples/Common/DicomPath.cpp @ 3580:46a8050583a1

OrthancPlugins::DicomPath::Format()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 20 Nov 2019 17:59:53 +0100
parents a6c590cb8181
children 94f4a18a79cc
line wrap: on
line diff
--- a/Plugins/Samples/Common/DicomPath.cpp	Wed Nov 20 09:44:46 2019 +0100
+++ b/Plugins/Samples/Common/DicomPath.cpp	Wed Nov 20 17:59:53 2019 +0100
@@ -35,6 +35,8 @@
 
 #include "OrthancPluginException.h"
 
+#include <boost/lexical_cast.hpp>
+
 namespace OrthancPlugins
 {
   const DicomPath::Prefix& DicomPath::GetPrefixItem(size_t depth) const
@@ -97,4 +99,18 @@
     AddToPrefix(sequence2, index2);
     AddToPrefix(sequence3, index3);
   }
+
+
+  std::string DicomPath::Format() const
+  {
+    std::string s;
+      
+    for (size_t i = 0; i < GetPrefixLength(); i++)
+    {
+      s += (GetPrefixTag(i).FormatHexadecimal() + " / " +
+            boost::lexical_cast<std::string>(i) + " / ");
+    }
+
+    return s + GetFinalTag().FormatHexadecimal();
+  }
 }