diff Core/DicomFormat/DicomValue.h @ 1738:15a788a63846

DicomToJsonFlags_IncludeBinary
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 22 Oct 2015 09:28:08 +0200
parents ec66a16aa398
children f4286d99ee0a
line wrap: on
line diff
--- a/Core/DicomFormat/DicomValue.h	Thu Oct 22 07:52:24 2015 +0200
+++ b/Core/DicomFormat/DicomValue.h	Thu Oct 22 09:28:08 2015 +0200
@@ -32,8 +32,6 @@
 
 #pragma once
 
-#include "../OrthancException.h"
-
 #include <string>
 #include <boost/noncopyable.hpp>
 
@@ -52,11 +50,7 @@
     Type         type_;
     std::string  content_;
 
-    DicomValue(const DicomValue& other) : 
-      type_(other.type_),
-      content_(other.content_)
-    {
-    }
+    DicomValue(const DicomValue& other);
 
   public:
     DicomValue() : type_(Type_Null)
@@ -64,31 +58,13 @@
     }
     
     DicomValue(const std::string& content,
-               bool isBinary) :
-      type_(isBinary ? Type_Binary : Type_String),
-      content_(content)
-    {
-    }
+               bool isBinary);
     
     DicomValue(const char* data,
                size_t size,
-               bool isBinary) :
-      type_(isBinary ? Type_Binary : Type_String)
-    {
-      content_.assign(data, size);
-    }
+               bool isBinary);
     
-    const std::string& GetContent() const
-    {
-      if (type_ == Type_Null)
-      {
-        throw OrthancException(ErrorCode_BadParameterType);
-      }
-      else
-      {
-        return content_;
-      }
-    }
+    const std::string& GetContent() const;
 
     bool IsNull() const
     {
@@ -100,9 +76,14 @@
       return type_ == Type_Binary;
     }
     
-    DicomValue* Clone() const
+    DicomValue* Clone() const;
+
+    void FormatDataUriScheme(std::string& target,
+                             const std::string& mime) const;
+
+    void FormatDataUriScheme(std::string& target) const
     {
-      return new DicomValue(*this);
+      FormatDataUriScheme(target, "application/octet-stream");
     }
   };
 }