changeset 2237:403d92d8df83

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 16 Dec 2016 14:45:40 +0100
parents 55843d0139d3
children 4f0a9a61d905
files Plugins/Samples/Common/DicomDatasetReader.cpp Plugins/Samples/Common/DicomPath.cpp Plugins/Samples/Common/DicomTag.cpp Plugins/Samples/Common/FullOrthancDataset.cpp Plugins/Samples/Common/IOrthancConnection.cpp Plugins/Samples/Common/OrthancPluginConnection.cpp Plugins/Samples/Common/SimplifiedOrthancDataset.cpp
diffstat 7 files changed, 31 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Samples/Common/DicomDatasetReader.cpp	Fri Dec 16 14:36:27 2016 +0100
+++ b/Plugins/Samples/Common/DicomDatasetReader.cpp	Fri Dec 16 14:45:40 2016 +0100
@@ -32,7 +32,7 @@
 
 #include "DicomDatasetReader.h"
 
-#include "OrthancPluginCppWrapper.h"
+#include "OrthancPluginException.h"
 
 #include <boost/lexical_cast.hpp>
 
@@ -73,7 +73,7 @@
   {
     if (dataset == NULL)
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_ParameterOutOfRange);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(ParameterOutOfRange);
     }
   }
   
@@ -87,7 +87,7 @@
     }
     else
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_InexistentTag);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(InexistentTag);
     }
   }
 
@@ -101,7 +101,7 @@
     }
     catch (boost::bad_lexical_cast&)
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_BadFileFormat);        
+      ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);        
     }
   }
 
@@ -116,7 +116,7 @@
     }
     else
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_ParameterOutOfRange);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(ParameterOutOfRange);
     }
   }
 }
--- a/Plugins/Samples/Common/DicomPath.cpp	Fri Dec 16 14:36:27 2016 +0100
+++ b/Plugins/Samples/Common/DicomPath.cpp	Fri Dec 16 14:45:40 2016 +0100
@@ -32,7 +32,7 @@
 
 #include "DicomPath.h"
 
-#include "OrthancPluginCppWrapper.h"
+#include "OrthancPluginException.h"
 
 namespace OrthancPlugins
 {
@@ -40,7 +40,7 @@
   {
     if (depth >= prefix_.size())
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_ParameterOutOfRange);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(ParameterOutOfRange);
     }
     else
     {
--- a/Plugins/Samples/Common/DicomTag.cpp	Fri Dec 16 14:36:27 2016 +0100
+++ b/Plugins/Samples/Common/DicomTag.cpp	Fri Dec 16 14:45:40 2016 +0100
@@ -32,7 +32,7 @@
 
 #include "DicomTag.h"
 
-#include "OrthancPluginCppWrapper.h"
+#include "OrthancPluginException.h"
 
 namespace OrthancPlugins
 {
@@ -104,7 +104,7 @@
     }
     else
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_NotImplemented);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(NotImplemented);
     }
   }
 }
--- a/Plugins/Samples/Common/FullOrthancDataset.cpp	Fri Dec 16 14:36:27 2016 +0100
+++ b/Plugins/Samples/Common/FullOrthancDataset.cpp	Fri Dec 16 14:45:40 2016 +0100
@@ -32,7 +32,10 @@
 
 #include "FullOrthancDataset.h"
 
-#include "OrthancPluginCppWrapper.h"
+#include "OrthancPluginException.h"
+
+#include <stdio.h>
+#include <cassert>
 
 namespace OrthancPlugins
 {
@@ -41,7 +44,7 @@
   {
     if (dataset.type() != Json::objectValue)
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_BadFileFormat);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
     }
 
     char name[16];
@@ -60,7 +63,7 @@
         value["Name"].type() != Json::stringValue ||
         value["Type"].type() != Json::stringValue)
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_BadFileFormat);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
     }
 
     return &value;
@@ -78,7 +81,7 @@
     if (sequence["Type"].asString() != "Sequence" ||
         value.type() != Json::arrayValue)
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_BadFileFormat);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
     }
     else
     {
@@ -99,7 +102,7 @@
     if (tag["Type"].asString() != "String" ||
         value.type() != Json::stringValue)
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_BadFileFormat);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
     }
     else
     {
@@ -142,7 +145,7 @@
   {
     if (root_.type() != Json::objectValue)
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_BadFileFormat);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
     }
   }
 
--- a/Plugins/Samples/Common/IOrthancConnection.cpp	Fri Dec 16 14:36:27 2016 +0100
+++ b/Plugins/Samples/Common/IOrthancConnection.cpp	Fri Dec 16 14:45:40 2016 +0100
@@ -32,7 +32,7 @@
 
 #include "IOrthancConnection.h"
 
-#include "OrthancPluginCppWrapper.h"
+#include "OrthancPluginException.h"
 
 #include <json/reader.h>
 
@@ -45,7 +45,7 @@
     
     if (!reader.parse(content, result))
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_BadFileFormat);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
     }
   }
 
--- a/Plugins/Samples/Common/OrthancPluginConnection.cpp	Fri Dec 16 14:36:27 2016 +0100
+++ b/Plugins/Samples/Common/OrthancPluginConnection.cpp	Fri Dec 16 14:45:40 2016 +0100
@@ -47,7 +47,7 @@
     }
     else
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_UnknownResource);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(UnknownResource);
     }
   }
 
@@ -64,7 +64,7 @@
     }
     else
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_UnknownResource);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(UnknownResource);
     }
   }
 
@@ -81,7 +81,7 @@
     }
     else
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_UnknownResource);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(UnknownResource);
     }
   }
 
@@ -92,7 +92,7 @@
 
     if (!::OrthancPlugins::RestApiDelete(context_, uri, false))
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_UnknownResource);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(UnknownResource);
     }
   }
 }
--- a/Plugins/Samples/Common/SimplifiedOrthancDataset.cpp	Fri Dec 16 14:36:27 2016 +0100
+++ b/Plugins/Samples/Common/SimplifiedOrthancDataset.cpp	Fri Dec 16 14:45:40 2016 +0100
@@ -32,7 +32,7 @@
 
 #include "SimplifiedOrthancDataset.h"
 
-#include "OrthancPluginCppWrapper.h"
+#include "OrthancPluginException.h"
 
 namespace OrthancPlugins
 {
@@ -45,7 +45,7 @@
       const char* name = path.GetPrefixTag(depth).GetName();
       if (content->type() != Json::objectValue)
       {
-        ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_BadFileFormat);
+        ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
       }
 
       if (!content->isMember(name))
@@ -56,7 +56,7 @@
       const Json::Value& sequence = (*content) [name];
       if (sequence.type() != Json::arrayValue)
       {
-        ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_BadFileFormat);
+        ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
       }
 
       size_t index = path.GetPrefixIndex(depth);
@@ -74,7 +74,7 @@
 
     if (content->type() != Json::objectValue)
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_BadFileFormat);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
     }
     if (!content->isMember(name))
     {
@@ -91,7 +91,7 @@
   {
     if (root_.type() != Json::objectValue)
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_BadFileFormat);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
     }
   }
 
@@ -122,7 +122,7 @@
     }
     else if (value->type() != Json::stringValue)
     {
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_BadFileFormat);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
     }
     else
     {
@@ -145,7 +145,7 @@
     else if (sequence->type() != Json::arrayValue)
     {
       // Not a sequence
-      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_BadFileFormat);
+      ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
     }
     else
     {