]> Creatis software - creaBruker.git/commitdiff
first try for exception
authorjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Wed, 27 May 2009 12:45:22 +0000 (12:45 +0000)
committerjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Wed, 27 May 2009 12:45:22 +0000 (12:45 +0000)
lib/src1/brukerexception.cxx [new file with mode: 0644]
lib/src1/brukerexception.h [new file with mode: 0644]

diff --git a/lib/src1/brukerexception.cxx b/lib/src1/brukerexception.cxx
new file mode 100644 (file)
index 0000000..9929942
--- /dev/null
@@ -0,0 +1 @@
+#include "brukerexception.h"
diff --git a/lib/src1/brukerexception.h b/lib/src1/brukerexception.h
new file mode 100644 (file)
index 0000000..94f8375
--- /dev/null
@@ -0,0 +1,41 @@
+//
+#ifndef BRUKEREXCEPTION_H
+#define BRUKEREXCEPTION_H
+
+#include "brukerSystem.h"
+#include <exception>
+#include <string>
+
+
+class creaBruker_EXPORT BrukerSizeException: public std::exception
+{
+public:
+    BrukerSizeException( const std::string& message,
+                     int lgt,
+                     int expected_lgt
+                     )
+      : m_message(message), m_lgt(lgt), m_expected_lgt(expected_lgt)
+    {}
+
+    ~BrukerSizeException() throw() {}
+    
+    virtual const char* what() const throw() {
+        return m_message.c_str();
+    }
+    
+   int getFoundLgt() const throw() {
+        return m_lgt;
+   }
+   
+   int getExpectedLgt() const throw() {
+        return m_expected_lgt;
+   }
+     
+private:
+   std::string m_message;
+   int m_lgt;
+   int m_expected_lgt;
+
+};
+
+#endif