Revision 1 (by moose, 2006/03/06 10:00:33) Initial Import
#ifndef __MADEXCEPTION_H__
#define __MADEXCEPTION_H__

#include <exception>

#define mad_throw(exception, what) throw exception(#exception, __FUNCTION__, __FILE__, __LINE__, what)

class MadException : public std::exception {
	public:
		MadException() :
			_what(0), _who(0), _func(0), _file(0), _line(0) {}
		MadException(const char *str) :
			_what(str), _who(0), _func(0), _file(0), _line(0) {}
		MadException(const char *w, const char *fu, const char *fi, const int l, const char *str) :
			_what(str), _who(w), _func(fu), _file(fi), _line(l) {}
			
		~MadException() throw() { }
		
		const char *what() const throw() { return _what; }
		const char *who() const throw() { return _who; }
		const char *func() const throw() { return _func; }
		const char *file() const throw() { return _file; }
		const int   line() const throw() { return _line; }
		
	private:
		const char *_what;
		const char *_who;
		const char *_func;
		const char *_file;
		const int _line;
};

#endif /* __MADEXCEPTION_H__ */