From: jean-pierre roux Date: Wed, 27 May 2009 12:45:22 +0000 (+0000) Subject: first try for exception X-Git-Tag: CREATOOLS.2-0-3~46 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=47f6f95499caee9a0807c1c6ed7514979bb9ca65;p=creaBruker.git first try for exception --- diff --git a/lib/src1/brukerexception.cxx b/lib/src1/brukerexception.cxx new file mode 100644 index 0000000..9929942 --- /dev/null +++ b/lib/src1/brukerexception.cxx @@ -0,0 +1 @@ +#include "brukerexception.h" diff --git a/lib/src1/brukerexception.h b/lib/src1/brukerexception.h new file mode 100644 index 0000000..94f8375 --- /dev/null +++ b/lib/src1/brukerexception.h @@ -0,0 +1,41 @@ +// +#ifndef BRUKEREXCEPTION_H +#define BRUKEREXCEPTION_H + +#include "brukerSystem.h" +#include +#include + + +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