Program: crea
Module: $RCSfile: creaException.h,v $
Language: C++
- Date: $Date: 2008/09/26 14:09:55 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2009/06/04 14:24:07 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#define __creaException_h__
#include "creaSystem.h"
+#include "creaMessageManager.h"
#include <exception>
namespace crea
{
-
inline std::string bbGetObjectDescription() { return(""); }
class CREA_EXPORT Exception : public std::exception
: mObject(object),
mSourceFile(source_file),
mMessage(message)
- {}
+ {
+ mWhatMessage = " * ERROR : " + mMessage
+ + " * OBJECT : " + mObject
+ + " * FILE " + mSourceFile;
+ }
~Exception() throw() {}
+ virtual const char* what() const throw()
+ {
+ return mWhatMessage.c_str();
+ }
+
void Print() throw()
{
std::cerr << "* ERROR : " << mMessage <<std::endl;
std::cerr << "* FILE : " <<mSourceFile<<std::endl;
}
}
- const std::string& GetObject() const { return mObject; }
+ const std::string& GetObject() const { return mObject; }
const std::string& GetSourceFile() const { return mSourceFile; }
- const std::string& GetMessage() const { return mMessage; }
+ const std::string& GetMessage() const { return mMessage; }
private:
std::string mObject;
std::string mSourceFile;
std::string mMessage;
+ std::string mWhatMessage;
};
}//namespace
// In Visual C++ 6 (7 should be similar), to create an application that is both a console application
// (cout's to the console are visible) and has a wxWidgets GUI,
// you need to use the linker option "/subsystem:console" and the following code:
+
#define CREA_WXMAIN_WITH_CONSOLE \
int main(int argc, char* argv[]) \
{ \