Wexus2 0.20
wexus2.src/wexus/Exception.h
00001 
00002 /*
00003  * Copyright (c) 2011 Aleksander B. Demko
00004  * This source code is distributed under the MIT license.
00005  * See the accompanying file LICENSE.MIT.txt for details.
00006  */
00007 
00008 #ifndef __INCLUDED_WEXUS_EXCEPTION_H__
00009 #define __INCLUDED_WEXUS_EXCEPTION_H__
00010 
00011 #include <exception>
00012 
00013 #include <QString>
00014 
00015 namespace wexus
00016 {
00017   class Exception;
00018 }
00019 
00020 /**
00021  * A helper class for many types of exceptions.
00022  * This has a buffer to store the contents of a pasted
00023  * QString suitable for what()
00024  *
00025  * @author Aleksander Demko
00026  */ 
00027 class wexus::Exception : public std::exception
00028 {
00029   public:
00030     /// usermessage constructor
00031     Exception(const QString &_what) throw();
00032 
00033     virtual ~Exception() throw();
00034 
00035     virtual const char* what() const throw() { return dm_whatbuf; }
00036 
00037   protected:
00038     // cant be a QString as then what() will return a * to a temporary
00039     QByteArray dm_whatbuf;
00040 };
00041 
00042 #endif
00043 
 All Classes Namespaces Functions Variables Enumerations Enumerator