2001-10-06 18:13:28 +04:00
|
|
|
#ifndef XBASE_H
|
|
|
|
#define XBASE_H
|
|
|
|
|
|
|
|
#include "CString.h"
|
2002-06-01 23:26:11 +04:00
|
|
|
#include "stdpre.h"
|
2001-10-06 18:13:28 +04:00
|
|
|
#include <exception>
|
2002-06-01 23:26:11 +04:00
|
|
|
#include "stdpost.h"
|
2001-10-06 18:13:28 +04:00
|
|
|
|
|
|
|
class XBase : public std::exception {
|
2002-04-29 18:40:01 +04:00
|
|
|
public:
|
2001-10-06 18:13:28 +04:00
|
|
|
XBase();
|
|
|
|
XBase(const CString& msg);
|
|
|
|
virtual ~XBase();
|
|
|
|
|
|
|
|
// std::exception overrides
|
|
|
|
virtual const char* what() const;
|
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
protected:
|
2001-10-06 18:13:28 +04:00
|
|
|
// returns a human readable string describing the exception
|
|
|
|
virtual CString getWhat() const throw() = 0;
|
|
|
|
|
|
|
|
// look up a message and format it
|
|
|
|
virtual CString format(const char* id,
|
2002-06-11 02:06:45 +04:00
|
|
|
const char* defaultFormat, ...) const throw();
|
2001-10-06 18:13:28 +04:00
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
private:
|
2001-10-06 18:13:28 +04:00
|
|
|
mutable CString m_what;
|
|
|
|
};
|
|
|
|
|
|
|
|
class MXErrno {
|
2002-04-29 18:40:01 +04:00
|
|
|
public:
|
2001-10-06 18:13:28 +04:00
|
|
|
MXErrno();
|
|
|
|
MXErrno(int);
|
|
|
|
|
|
|
|
// manipulators
|
|
|
|
|
|
|
|
// accessors
|
|
|
|
|
|
|
|
int getErrno() const;
|
|
|
|
const char* getErrstr() const;
|
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
private:
|
2001-10-06 18:13:28 +04:00
|
|
|
int m_errno;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|