fixed: extending std::runtime_error instead, as std::exception ctor is undefined. also fixed some mac warnings from inheriting runtime_error.
This commit is contained in:
parent
ab529fae41
commit
d5b25069be
|
@ -23,15 +23,16 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
XArch::what() const throw()
|
XArch::what() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
|
const char* what = std::runtime_error::what();
|
||||||
try {
|
try {
|
||||||
if (m_what.empty() && m_eval != NULL) {
|
if (strlen(what) == 0 && m_eval != NULL) {
|
||||||
m_what = m_eval->eval();
|
return m_eval->eval().c_str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
return m_what.c_str();
|
return what;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "common/common.h"
|
#include "common/common.h"
|
||||||
#include "common/stdstring.h"
|
#include "common/stdstring.h"
|
||||||
|
#include "common/stdexcept.h"
|
||||||
|
|
||||||
//! Generic thread exception
|
//! Generic thread exception
|
||||||
/*!
|
/*!
|
||||||
|
@ -63,19 +64,17 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Generic exception architecture dependent library
|
//! Generic exception architecture dependent library
|
||||||
class XArch : public std::exception {
|
class XArch : public std::runtime_error {
|
||||||
public:
|
public:
|
||||||
XArch(XArchEval* adoptedEvaluator) : m_eval(adoptedEvaluator) { }
|
XArch(XArchEval* adoptedEvaluator) : std::runtime_error(""), m_eval(adoptedEvaluator) { }
|
||||||
XArch(const std::string& msg) : m_eval(NULL), m_what(msg) { }
|
XArch(const std::string& msg) : std::runtime_error(msg), m_eval(NULL) { }
|
||||||
XArch(const XArch& e) : m_eval(e.m_eval != NULL ? e.m_eval->clone() : NULL),
|
XArch(const XArch& e) : std::runtime_error(e.what()), m_eval(e.m_eval != NULL ? e.m_eval->clone() : NULL) { }
|
||||||
m_what(e.m_what) { }
|
~XArch() _NOEXCEPT { delete m_eval; }
|
||||||
~XArch() { delete m_eval; }
|
|
||||||
|
|
||||||
const char* what() const throw();
|
virtual const char* what() const _NOEXCEPT;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
XArchEval* m_eval;
|
XArchEval* m_eval;
|
||||||
mutable std::string m_what;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Macro to declare XArch derived types
|
// Macro to declare XArch derived types
|
||||||
|
|
|
@ -27,29 +27,30 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
XBase::XBase() :
|
XBase::XBase() :
|
||||||
m_what()
|
std::runtime_error("")
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
XBase::XBase(const CString& msg) :
|
XBase::XBase(const CString& msg) :
|
||||||
m_what(msg)
|
std::runtime_error(msg)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
XBase::~XBase()
|
XBase::~XBase() _NOEXCEPT
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
XBase::what() const
|
XBase::what() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
if (m_what.empty()) {
|
const char* what = std::runtime_error::what();
|
||||||
m_what = getWhat();
|
if (strlen(what) == 0) {
|
||||||
|
return getWhat().c_str();
|
||||||
}
|
}
|
||||||
return m_what.c_str();
|
return what;
|
||||||
}
|
}
|
||||||
|
|
||||||
CString
|
CString
|
||||||
|
|
|
@ -19,21 +19,22 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "base/String.h"
|
#include "base/String.h"
|
||||||
|
#include "common/stdexcept.h"
|
||||||
|
|
||||||
//! Exception base class
|
//! Exception base class
|
||||||
/*!
|
/*!
|
||||||
This is the base class of most exception types.
|
This is the base class of most exception types.
|
||||||
*/
|
*/
|
||||||
class XBase : public std::exception {
|
class XBase : public std::runtime_error {
|
||||||
public:
|
public:
|
||||||
//! Use getWhat() as the result of what()
|
//! Use getWhat() as the result of what()
|
||||||
XBase();
|
XBase();
|
||||||
//! Use \c msg as the result of what()
|
//! Use \c msg as the result of what()
|
||||||
XBase(const CString& msg);
|
XBase(const CString& msg);
|
||||||
virtual ~XBase();
|
virtual ~XBase() _NOEXCEPT;
|
||||||
|
|
||||||
//! Reason for exception
|
//! Reason for exception
|
||||||
virtual const char* what() const;
|
virtual const char* what() const _NOEXCEPT;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Get a human readable string describing the exception
|
//! Get a human readable string describing the exception
|
||||||
|
@ -47,9 +48,6 @@ protected:
|
||||||
*/
|
*/
|
||||||
virtual CString format(const char* id,
|
virtual CString format(const char* id,
|
||||||
const char* defaultFormat, ...) const throw();
|
const char* defaultFormat, ...) const throw();
|
||||||
|
|
||||||
private:
|
|
||||||
mutable CString m_what;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -63,6 +61,7 @@ class name_ : public super_ { \
|
||||||
public: \
|
public: \
|
||||||
name_() : super_() { } \
|
name_() : super_() { } \
|
||||||
name_(const CString& msg) : super_(msg) { } \
|
name_(const CString& msg) : super_(msg) { } \
|
||||||
|
virtual ~name_() _NOEXCEPT { } \
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -76,6 +75,7 @@ class name_ : public super_ { \
|
||||||
public: \
|
public: \
|
||||||
name_() : super_() { } \
|
name_() : super_() { } \
|
||||||
name_(const CString& msg) : super_(msg) { } \
|
name_(const CString& msg) : super_(msg) { } \
|
||||||
|
virtual ~name_() _NOEXCEPT { } \
|
||||||
\
|
\
|
||||||
protected: \
|
protected: \
|
||||||
virtual CString getWhat() const throw(); \
|
virtual CString getWhat() const throw(); \
|
||||||
|
@ -97,8 +97,9 @@ private: \
|
||||||
public: \
|
public: \
|
||||||
name_() : super_(), m_state(kDone) { } \
|
name_() : super_(), m_state(kDone) { } \
|
||||||
name_(const CString& msg) : super_(msg), m_state(kFirst) { } \
|
name_(const CString& msg) : super_(msg), m_state(kFirst) { } \
|
||||||
|
virtual ~name_() _NOEXCEPT { } \
|
||||||
\
|
\
|
||||||
virtual const char* what() const \
|
virtual const char* what() const _NOEXCEPT \
|
||||||
{ \
|
{ \
|
||||||
if (m_state == kFirst) { \
|
if (m_state == kFirst) { \
|
||||||
m_state = kFormat; \
|
m_state = kFormat; \
|
||||||
|
|
|
@ -37,12 +37,12 @@
|
||||||
#include "base/IEventQueue.h"
|
#include "base/IEventQueue.h"
|
||||||
#include "base/TMethodEventJob.h"
|
#include "base/TMethodEventJob.h"
|
||||||
#include "base/TMethodJob.h"
|
#include "base/TMethodJob.h"
|
||||||
|
#include "common/stdexcept.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// CClient
|
// CClient
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* synergy -- mouse and keyboard sharing utility
|
||||||
|
* Copyright (C) 2014 Bolton Software Ltd.
|
||||||
|
*
|
||||||
|
* This package is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* found in the file COPYING that should have accompanied this file.
|
||||||
|
*
|
||||||
|
* This package is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
// apple declares _NOEXCEPT
|
||||||
|
#ifndef _NOEXCEPT
|
||||||
|
# define _NOEXCEPT throw()
|
||||||
|
#endif
|
|
@ -24,7 +24,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
XSocketAddress::XSocketAddress(EError error,
|
XSocketAddress::XSocketAddress(EError error,
|
||||||
const CString& hostname, int port) throw() :
|
const CString& hostname, int port) _NOEXCEPT :
|
||||||
m_error(error),
|
m_error(error),
|
||||||
m_hostname(hostname),
|
m_hostname(hostname),
|
||||||
m_port(port)
|
m_port(port)
|
||||||
|
|
|
@ -41,7 +41,8 @@ public:
|
||||||
kBadPort //!< The port is invalid
|
kBadPort //!< The port is invalid
|
||||||
};
|
};
|
||||||
|
|
||||||
XSocketAddress(EError, const CString& hostname, int port) throw();
|
XSocketAddress(EError, const CString& hostname, int port) _NOEXCEPT;
|
||||||
|
virtual ~XSocketAddress() _NOEXCEPT { }
|
||||||
|
|
||||||
//! @name accessors
|
//! @name accessors
|
||||||
//@{
|
//@{
|
||||||
|
|
|
@ -2313,7 +2313,7 @@ XConfigRead::XConfigRead(const CConfigReadContext& context,
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
XConfigRead::~XConfigRead()
|
XConfigRead::~XConfigRead() _NOEXCEPT
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
|
@ -534,7 +534,7 @@ public:
|
||||||
XConfigRead(const CConfigReadContext& context, const CString&);
|
XConfigRead(const CConfigReadContext& context, const CString&);
|
||||||
XConfigRead(const CConfigReadContext& context,
|
XConfigRead(const CConfigReadContext& context,
|
||||||
const char* errorFmt, const CString& arg);
|
const char* errorFmt, const CString& arg);
|
||||||
~XConfigRead();
|
virtual ~XConfigRead() _NOEXCEPT;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// XBase overrides
|
// XBase overrides
|
||||||
|
|
|
@ -38,12 +38,12 @@
|
||||||
#include "base/IEventQueue.h"
|
#include "base/IEventQueue.h"
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
#include "base/TMethodEventJob.h"
|
#include "base/TMethodEventJob.h"
|
||||||
|
#include "common/stdexcept.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// CServer
|
// CServer
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
#include "base/EventTypes.h"
|
#include "base/EventTypes.h"
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
#include "base/Stopwatch.h"
|
#include "base/Stopwatch.h"
|
||||||
|
#include "common/stdexcept.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
#define PAUSE_TIME_HACK 0.1
|
#define PAUSE_TIME_HACK 0.1
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,10 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "synergy/IPlatformScreen.h"
|
#include "synergy/IPlatformScreen.h"
|
||||||
|
#include "common/stdexcept.h"
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
//! Base screen implementation
|
//! Base screen implementation
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -50,7 +50,7 @@ XScreenUnavailable::XScreenUnavailable(double timeUntilRetry) :
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
XScreenUnavailable::~XScreenUnavailable()
|
XScreenUnavailable::~XScreenUnavailable() _NOEXCEPT
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
trying to open the screen again.
|
trying to open the screen again.
|
||||||
*/
|
*/
|
||||||
XScreenUnavailable(double timeUntilRetry);
|
XScreenUnavailable(double timeUntilRetry);
|
||||||
virtual ~XScreenUnavailable();
|
virtual ~XScreenUnavailable() _NOEXCEPT;
|
||||||
|
|
||||||
//! @name manipulators
|
//! @name manipulators
|
||||||
//@{
|
//@{
|
||||||
|
|
|
@ -63,6 +63,7 @@ a client that is already connected.
|
||||||
class XDuplicateClient : public XSynergy {
|
class XDuplicateClient : public XSynergy {
|
||||||
public:
|
public:
|
||||||
XDuplicateClient(const CString& name);
|
XDuplicateClient(const CString& name);
|
||||||
|
virtual ~XDuplicateClient() _NOEXCEPT { }
|
||||||
|
|
||||||
//! @name accessors
|
//! @name accessors
|
||||||
//@{
|
//@{
|
||||||
|
@ -88,6 +89,7 @@ unknown to the server.
|
||||||
class XUnknownClient : public XSynergy {
|
class XUnknownClient : public XSynergy {
|
||||||
public:
|
public:
|
||||||
XUnknownClient(const CString& name);
|
XUnknownClient(const CString& name);
|
||||||
|
virtual ~XUnknownClient() _NOEXCEPT { }
|
||||||
|
|
||||||
//! @name accessors
|
//! @name accessors
|
||||||
//@{
|
//@{
|
||||||
|
@ -114,6 +116,7 @@ exit(int).
|
||||||
class XExitApp : public XSynergy {
|
class XExitApp : public XSynergy {
|
||||||
public:
|
public:
|
||||||
XExitApp(int code);
|
XExitApp(int code);
|
||||||
|
virtual ~XExitApp() _NOEXCEPT { }
|
||||||
|
|
||||||
//! Get the exit code
|
//! Get the exit code
|
||||||
int getCode() const throw();
|
int getCode() const throw();
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
#include "base/TMethodEventJob.h"
|
#include "base/TMethodEventJob.h"
|
||||||
#include "base/SimpleEventQueueBuffer.h"
|
#include "base/SimpleEventQueueBuffer.h"
|
||||||
|
#include "common/stdexcept.h"
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CTestEventQueue::raiseQuitEvent()
|
CTestEventQueue::raiseQuitEvent()
|
||||||
|
|
|
@ -37,9 +37,9 @@
|
||||||
#include "base/TMethodEventJob.h"
|
#include "base/TMethodEventJob.h"
|
||||||
#include "base/TMethodJob.h"
|
#include "base/TMethodJob.h"
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
|
#include "common/stdexcept.h"
|
||||||
|
|
||||||
#include "test/global/gtest.h"
|
#include "test/global/gtest.h"
|
||||||
#include <stdexcept>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
Loading…
Reference in New Issue