Forráskód Böngészése

Fixed rethrow method to work polymorphically.

Sascha Zelzer 13 éve
szülő
commit
7ac22e9716

+ 7 - 1
Libs/Core/ctkException.h

@@ -118,7 +118,8 @@ public:
   /**
    * @brief (Re)Throws this exception.
    */
-  void rethrow() const;
+  virtual void rethrow() const;
+
 
 private:
 
@@ -152,6 +153,7 @@ CTK_CORE_EXPORT QDebug operator<<(QDebug dbg, const ctkException& exc);
     CLS& operator = (const CLS& exc);                 \
     const char* name() const throw();                 \
     CLS* clone() const;                               \
+    void rethrow() const ;                            \
   };
 
 //---------------------------------------------------------------------------
@@ -184,6 +186,10 @@ CTK_CORE_EXPORT QDebug operator<<(QDebug dbg, const ctkException& exc);
   CLS* CLS::clone() const                                                \
   {                                                                      \
     return new CLS(*this);                                               \
+  }                                                                      \
+  void CLS::rethrow() const                                              \
+  {                                                                      \
+    throw *this;                                                         \
   }
 
 CTK_DECLARE_EXCEPTION(CTK_CORE_EXPORT, ctkRuntimeException, ctkException)

+ 6 - 0
Libs/PluginFramework/ctkPluginDatabaseException.cpp

@@ -83,6 +83,12 @@ ctkPluginDatabaseException* ctkPluginDatabaseException::clone() const
 }
 
 //----------------------------------------------------------------------------
+void ctkPluginDatabaseException::rethrow() const
+{
+  throw *this;
+}
+
+//----------------------------------------------------------------------------
 ctkPluginDatabaseException::Type ctkPluginDatabaseException::getType() const
 {
   return type;

+ 5 - 0
Libs/PluginFramework/ctkPluginDatabaseException.h

@@ -63,6 +63,11 @@ public:
    */
   ctkPluginDatabaseException* clone() const;
 
+  /**
+   * @see ctkException::rethrow()
+   */
+  void rethrow() const;
+
   Type getType() const;
 
 private:

+ 6 - 0
Libs/PluginFramework/ctkPluginException.cpp

@@ -80,6 +80,12 @@ ctkPluginException* ctkPluginException::clone() const
 }
 
 //----------------------------------------------------------------------------
+void ctkPluginException::rethrow() const
+{
+  throw *this;
+}
+
+//----------------------------------------------------------------------------
 ctkPluginException::Type ctkPluginException::getType() const
 {
   return type;

+ 5 - 0
Libs/PluginFramework/ctkPluginException.h

@@ -137,6 +137,11 @@ public:
   ctkPluginException* clone() const;
 
   /**
+   * @see ctkException::rethrow()
+   */
+  void rethrow() const;
+
+  /**
    * Returns the type for this exception or <code>UNSPECIFIED</code> if the
    * type was unspecified or unknown.
    *

+ 6 - 0
Libs/PluginFramework/ctkServiceException.cpp

@@ -82,6 +82,12 @@ ctkServiceException* ctkServiceException::clone() const
 }
 
 //----------------------------------------------------------------------------
+void ctkServiceException::rethrow() const
+{
+  throw *this;
+}
+
+//----------------------------------------------------------------------------
 ctkServiceException::Type ctkServiceException::getType() const
 {
   return type;

+ 5 - 0
Libs/PluginFramework/ctkServiceException.h

@@ -116,6 +116,11 @@ public:
   ctkServiceException* clone() const;
 
   /**
+   * @see ctkException::rethrow()
+   */
+  void rethrow() const;
+
+  /**
    * Returns the type for this exception or <code>UNSPECIFIED</code> if the
    * type was unspecified or unknown.
    *

+ 6 - 0
Libs/PluginFramework/service/cm/ctkConfigurationException.cpp

@@ -75,6 +75,12 @@ ctkConfigurationException* ctkConfigurationException::clone() const
 }
 
 //----------------------------------------------------------------------------
+void ctkConfigurationException::rethrow() const
+{
+  throw *this;
+}
+
+//----------------------------------------------------------------------------
 QString ctkConfigurationException::getProperty() const
 {
   return property;

+ 5 - 0
Libs/PluginFramework/service/cm/ctkConfigurationException.h

@@ -74,6 +74,11 @@ public:
   ctkConfigurationException* clone() const;
 
   /**
+   * @see ctkException::rethrow()
+   */
+  void rethrow() const;
+
+  /**
    * Return the property name that caused the failure or a null QString.
    *
    * @return name of property or null if no specific property caused the

+ 5 - 0
Plugins/org.commontk.eventadmin/dispatch/ctkEAInterruptedException.cpp

@@ -41,3 +41,8 @@ ctkEAInterruptedException *ctkEAInterruptedException::clone() const
 {
   return new ctkEAInterruptedException(*this);
 }
+
+void ctkEAInterruptedException::rethrow() const
+{
+  throw *this;
+}

+ 2 - 0
Plugins/org.commontk.eventadmin/dispatch/ctkEAInterruptedException_p.h

@@ -46,6 +46,8 @@ public:
   const char* name() const throw();
 
   ctkEAInterruptedException* clone() const;
+
+  void rethrow() const;
 };
 
 #endif // CTKEAINTERRUPTEDEXCEPTION_P_H

+ 5 - 0
Plugins/org.commontk.eventadmin/util/ctkEABrokenBarrierException.cpp

@@ -41,3 +41,8 @@ ctkEABrokenBarrierException *ctkEABrokenBarrierException::clone() const
 {
   return new ctkEABrokenBarrierException(*this);
 }
+
+void ctkEABrokenBarrierException::rethrow() const
+{
+  throw *this;
+}

+ 5 - 0
Plugins/org.commontk.eventadmin/util/ctkEABrokenBarrierException_p.h

@@ -56,6 +56,11 @@ public:
    * @see ctkException::clone()
    */
   ctkEABrokenBarrierException* clone() const;
+
+  /**
+   * @see ctkException::rethrow()
+   */
+  void rethrow() const;
 };
 
 #endif // CTKEABROKENBARRIEREXCEPTION_P_H

+ 5 - 0
Plugins/org.commontk.eventadmin/util/ctkEATimeoutException.cpp

@@ -41,3 +41,8 @@ ctkEATimeoutException *ctkEATimeoutException::clone() const
 {
   return new ctkEATimeoutException(*this);
 }
+
+void ctkEATimeoutException::rethrow() const
+{
+  throw *this;
+}

+ 5 - 0
Plugins/org.commontk.eventadmin/util/ctkEATimeoutException_p.h

@@ -57,6 +57,11 @@ public:
    * @see ctkException::clone()
    */
   ctkEATimeoutException* clone() const;
+
+  /**
+   * @see ctkException::rethrow()
+   */
+  void rethrow() const;
 };
 
 #endif // CTKEATIMEOUTEXCEPTION_P_H