diff OrthancFramework/Sources/DicomFormat/DicomPath.cpp @ 4682:d38a7040474a

FromDcmtkBridge::RemovePath() and FromDcmtkBridge::ReplacePath()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 07 Jun 2021 18:35:46 +0200
parents c5528c7847a6
children 7182f5732480
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomPath.cpp	Mon Jun 07 17:05:48 2021 +0200
+++ b/OrthancFramework/Sources/DicomFormat/DicomPath.cpp	Mon Jun 07 18:35:46 2021 +0200
@@ -154,6 +154,20 @@
   }
   
 
+  bool DicomPath::HasUniversal() const
+  {
+    for (size_t i = 0; i < prefix_.size(); i++)
+    {
+      if (prefix_[i].IsUniversal())
+      {
+        return true;
+      }
+    }
+
+    return false;
+  }
+
+
   std::string DicomPath::Format() const
   {
     std::string s;
@@ -176,8 +190,7 @@
   }
 
   
-  DicomPath DicomPath::Parse(const std::string& s,
-                             bool allowUniversal)
+  DicomPath DicomPath::Parse(const std::string& s)
   {
     std::vector<std::string> tokens;
     Toolbox::TokenizeString(tokens, s, '.');
@@ -221,14 +234,7 @@
             std::string s = Toolbox::StripSpaces(right.substr(0, right.size() - 1));
             if (s == "*")
             {
-              if (allowUniversal)
-              {
-                path.AddUniversalTagToPrefix(tag);
-              }
-              else
-              {
-                throw OrthancException(ErrorCode_ParameterOutOfRange, "Cannot create an universal parent path");
-              }
+              path.AddUniversalTagToPrefix(tag);
             }
             else
             {