From 47f6f95499caee9a0807c1c6ed7514979bb9ca65 Mon Sep 17 00:00:00 2001 From: jean-pierre roux Date: Wed, 27 May 2009 12:45:22 +0000 Subject: [PATCH] first try for exception --- lib/src1/brukerexception.cxx | 1 + lib/src1/brukerexception.h | 41 ++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 lib/src1/brukerexception.cxx create mode 100644 lib/src1/brukerexception.h 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 -- 2.45.0