TcpLib
Loading...
Searching...
No Matches
EuException.h
Go to the documentation of this file.
1#ifndef INC_EUEXCEPTION_H
2#define INC_EUEXCEPTION_H
3//-----------------------------------------------------------------------------
51//-----------------------------------------------------------------------------
52#include "EuToolTypes.h"
53#include <stdexcept>
54//-----------------------------------------------------------------------------
55namespace eut
56{
57 //---------------------------------------------------------------------------
72 class ErrorNException : public std::runtime_error
73 {
74 private:
75 //============== Attribute
76 //-----------------------------------------------------------------------
87 //-----------------------------------------------------------------------
97 char const * m_FileName;
98 //-----------------------------------------------------------------------
109 //-----------------------------------------------------------------------
110
111 public:
112 //============== De- & Konstruktoren
113 //-----------------------------------------------------------------------
131 inline ErrorNException( const std::string & _Message, int iError, char const * chFileName, int iLine );
132 //-----------------------------------------------------------------------
150 inline ErrorNException( const char *_Message, int iError, char const * chFileName, int iLine );
151 //-----------------------------------------------------------------------
163 inline ErrorNException( const ErrorNException & rT );
164 //-----------------------------------------------------------------------
165
166 //============== Methoden
167 //-----------------------------------------------------------------------
179 inline int error() const;
180 //-----------------------------------------------------------------------
192 inline char const * fileName() const;
193 //-----------------------------------------------------------------------
205 inline int lineNumber() const;
206 //-----------------------------------------------------------------------
207
208 //-----------------------------------------------------------------------
220 inline ErrorNException & operator= ( const ErrorNException & rT );
221 //-----------------------------------------------------------------------
222 };
223
224 //---------------------------------------------------------------------------
225 #ifdef _MSC_VER
226 /* warning C4189: "t_iDEBUG_XXX": Lokale Variable ist initialisiert aber nicht referenziert */
227 #pragma warning( disable : 4189 )
228 #endif
229 //---------------------------------------------------------------------------
230 #if defined(__GNUC__)
231 /* Warnung: unused variable 't_iDEBUG_XXX' [-Wunused-variable] */
232 #pragma GCC diagnostic push
233 #pragma GCC diagnostic ignored "-Wunused-variable"
234 #endif
235 //---------------------------------------------------------------------------
236 inline ErrorNException::ErrorNException( const std::string& _Message, int iError, char const * chFileName, int iLine )
237 : std::runtime_error( _Message ),
238 m_iError( iError ),
239 m_FileName( chFileName ),
240 m_iLineNumber( iLine )
241 {
242 #ifdef _DEBUG
243 int t_iDEBUG_BreakPoint = 1;
244 #endif
245 }
246 //---------------------------------------------------------------------------
247 inline ErrorNException::ErrorNException( const char *_Message, int iError, char const * chFileName, int iLine )
248 : std::runtime_error( _Message ),
249 m_iError( iError ),
250 m_FileName( chFileName ),
251 m_iLineNumber( iLine )
252 {
253 #ifdef _DEBUG
254 int t_iDEBUG_BreakPoint = 1;
255 #endif
256 }
257 //---------------------------------------------------------------------------
258 #ifdef _MSC_VER
259 /* warning C4189: "t_iDEBUG_XXX": Lokale Variable ist initialisiert aber nicht referenziert */
260 #pragma warning( default : 4189 )
261 #endif
262 //---------------------------------------------------------------------------
263 #if defined(__GNUC__)
264 /* Warnung: unused variable 't_iDEBUG_XXX' [-Wunused-variable] */
265 #pragma GCC diagnostic pop
266 #endif
267 //---------------------------------------------------------------------------
269 : std::runtime_error( rT ),
270 m_iError( rT.m_iError ),
271 m_FileName( rT.m_FileName ),
272 m_iLineNumber( rT.m_iLineNumber )
273 {
274 }
275 //---------------------------------------------------------------------------
276 inline int ErrorNException::error() const
277 {
278 return m_iError;
279 }
280 //---------------------------------------------------------------------------
281 inline char const * ErrorNException::fileName() const
282 {
283 return m_FileName;
284 }
285 //---------------------------------------------------------------------------
287 {
288 return m_iLineNumber;
289 }
290 //---------------------------------------------------------------------------
292 {
293 if( this != & rT )
294 {
295 m_iError = rT.m_iError;
298 std::runtime_error::operator=( rT );
299 }
300 return *this;
301 }
302 //---------------------------------------------------------------------------
303} // namespace eut
304#endif
This exception class has an integer attribute for an error number in addition to the message.
Definition EuException.h:73
char const * fileName() const
Definition EuException.h:281
char const * m_FileName
Definition EuException.h:97
int m_iLineNumber
Definition EuException.h:108
int error() const
Definition EuException.h:276
ErrorNException & operator=(const ErrorNException &rT)
Definition EuException.h:291
int lineNumber() const
Definition EuException.h:286
int m_iError
Definition EuException.h:86
ErrorNException(const std::string &_Message, int iError, char const *chFileName, int iLine)
Definition EuException.h:236
Definition EuCriticalSection.h:56