mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-19 17:01:36 +03:00
fee4095624
synergy.cpp and server.cpp into cmd/synergyd as synergyd.cpp. Moved and renamed related files. Moved remaining source files into lib/.... Modified and added makefiles as appropriate. Result is that library files are under lib with each library in its own directory and program files are under cmd with each command in its own directory.
69 lines
1.3 KiB
C++
69 lines
1.3 KiB
C++
#ifndef XBASE_H
|
|
#define XBASE_H
|
|
|
|
#include "CString.h"
|
|
#include "stdpre.h"
|
|
#include <exception>
|
|
#include "stdpost.h"
|
|
|
|
//! Exception base class
|
|
/*!
|
|
This is the base class of most exception types.
|
|
*/
|
|
class XBase : public std::exception {
|
|
public:
|
|
//! Use getWhat() as the result of what()
|
|
XBase();
|
|
//! Use \c msg as the result of what()
|
|
XBase(const CString& msg);
|
|
virtual ~XBase();
|
|
|
|
// std::exception overrides
|
|
virtual const char* what() const;
|
|
|
|
protected:
|
|
//! Get a human readable string describing the exception
|
|
virtual CString getWhat() const throw() = 0;
|
|
|
|
//! Format a string
|
|
/*!
|
|
Looks up a message format using \c id, using \c defaultFormat if
|
|
no format can be found, then replaces positional parameters in
|
|
the format string and returns the result.
|
|
*/
|
|
virtual CString format(const char* id,
|
|
const char* defaultFormat, ...) const throw();
|
|
|
|
private:
|
|
mutable CString m_what;
|
|
};
|
|
|
|
//! Mix-in for handling \c errno
|
|
/*!
|
|
This mix-in class for exception classes provides storage and query of
|
|
\c errno.
|
|
*/
|
|
class MXErrno {
|
|
public:
|
|
//! Save \c errno as the error code
|
|
MXErrno();
|
|
//! Save \c err as the error code
|
|
MXErrno(int err);
|
|
|
|
//! @name accessors
|
|
//@{
|
|
|
|
//! Get the error code
|
|
int getErrno() const;
|
|
|
|
//! Get the human readable string for the error code
|
|
const char* getErrstr() const;
|
|
|
|
//@}
|
|
|
|
private:
|
|
int m_errno;
|
|
};
|
|
|
|
#endif
|