summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2016-07-22 17:09:25 -0400
committerBernard Normier <bernard@zeroc.com>2016-07-22 17:09:25 -0400
commit752e06b4eb63abb8a30bb958802eaedda72d3806 (patch)
tree7c2348544d202c310a55a62629abc4025daa03a5 /cpp/src
parentDisable VS 2015 update 3 optimizer (diff)
downloadice-752e06b4eb63abb8a30bb958802eaedda72d3806.tar.bz2
ice-752e06b4eb63abb8a30bb958802eaedda72d3806.tar.xz
ice-752e06b4eb63abb8a30bb958802eaedda72d3806.zip
Added ICE_BUILDING_SRC to make builds
Ice::Dispatcher and Ice::LocalObject are now hidden with C++11 Reworked C++11 exception ice_clone, added ExceptionHelper + other C++ cleanups
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Glacier2Lib/Application.cpp6
-rw-r--r--cpp/src/Glacier2Lib/SessionHelper.cpp15
-rw-r--r--cpp/src/Ice/BatchRequestQueue.h4
-rw-r--r--cpp/src/Ice/ConnectRequestHandler.cpp13
-rw-r--r--cpp/src/Ice/ConnectRequestHandler.h4
-rw-r--r--cpp/src/Ice/ConnectionI.cpp20
-rw-r--r--cpp/src/Ice/ConnectionI.h4
-rw-r--r--cpp/src/Ice/Exception.cpp26
-rw-r--r--cpp/src/Ice/LocatorInfo.cpp22
-rw-r--r--cpp/src/Ice/LocatorInfo.h4
-rw-r--r--cpp/src/Ice/Outgoing.cpp11
-rw-r--r--cpp/src/Ice/OutgoingAsync.cpp14
-rw-r--r--cpp/src/Ice/Reference.cpp4
-rw-r--r--cpp/src/Ice/RequestHandler.cpp25
-rw-r--r--cpp/src/Ice/RequestHandler.h16
-rw-r--r--cpp/src/Ice/RouterInfo.h2
-rw-r--r--cpp/src/Ice/TcpTransceiver.cpp4
-rw-r--r--cpp/src/Ice/TcpTransceiver.h5
-rw-r--r--cpp/src/Ice/Transceiver.h5
-rwxr-xr-xcpp/src/Ice/UdpTransceiver.cpp4
-rw-r--r--cpp/src/Ice/UdpTransceiver.h4
-rw-r--r--cpp/src/Ice/WSTransceiver.cpp38
-rw-r--r--cpp/src/Ice/WSTransceiver.h4
-rw-r--r--cpp/src/Ice/ios/StreamTransceiver.cpp4
-rw-r--r--cpp/src/Ice/ios/StreamTransceiver.h4
-rw-r--r--cpp/src/IceBT/TransceiverI.cpp4
-rw-r--r--cpp/src/IceBT/TransceiverI.h5
-rw-r--r--cpp/src/IceIAP/Transceiver.h5
-rw-r--r--cpp/src/IceIAP/Transceiver.mm4
-rwxr-xr-xcpp/src/IceSSL/Certificate.cpp26
-rw-r--r--cpp/src/IceSSL/OpenSSLTransceiverI.cpp4
-rw-r--r--cpp/src/IceSSL/OpenSSLTransceiverI.h4
-rw-r--r--cpp/src/IceSSL/SChannelTransceiverI.cpp4
-rw-r--r--cpp/src/IceSSL/SChannelTransceiverI.h4
-rw-r--r--cpp/src/IceSSL/SecureTransportEngine.cpp1
-rw-r--r--cpp/src/IceSSL/SecureTransportTransceiverI.cpp4
-rw-r--r--cpp/src/IceSSL/SecureTransportTransceiverI.h4
-rwxr-xr-xcpp/src/IceSSL/WinRTTransceiverI.cpp4
-rwxr-xr-xcpp/src/IceSSL/WinRTTransceiverI.h4
-rw-r--r--cpp/src/IceSSL/uwp/TransceiverI.cpp4
-rw-r--r--cpp/src/IceSSL/uwp/TransceiverI.h5
-rw-r--r--cpp/src/IceUtil/CtrlCHandler.cpp21
-rw-r--r--cpp/src/IceUtil/Options.cpp16
-rw-r--r--cpp/src/IceUtil/ThreadException.cpp60
-rw-r--r--cpp/src/IceUtil/UtilException.cpp109
-rw-r--r--cpp/src/IceXML/Parser.cpp10
-rw-r--r--cpp/src/IceXML/Parser.h3
47 files changed, 98 insertions, 469 deletions
diff --git a/cpp/src/Glacier2Lib/Application.cpp b/cpp/src/Glacier2Lib/Application.cpp
index b9598c21ceb..c1a531c21b7 100644
--- a/cpp/src/Glacier2Lib/Application.cpp
+++ b/cpp/src/Glacier2Lib/Application.cpp
@@ -58,12 +58,6 @@ Glacier2::RestartSessionException::ice_clone() const
}
#endif
-void
-Glacier2::RestartSessionException::ice_throw() const
-{
- throw *this;
-}
-
Ice::ObjectAdapterPtr
Glacier2::Application::objectAdapter()
{
diff --git a/cpp/src/Glacier2Lib/SessionHelper.cpp b/cpp/src/Glacier2Lib/SessionHelper.cpp
index 6204bd89126..b5b07f57d6a 100644
--- a/cpp/src/Glacier2Lib/SessionHelper.cpp
+++ b/cpp/src/Glacier2Lib/SessionHelper.cpp
@@ -525,30 +525,15 @@ public:
virtual void
run()
{
-#ifdef ICE_CPP11_MAPPING
- try
- {
- rethrow_exception(_ex);
- }
- catch(const Ice::Exception& ex)
- {
- _callback->connectFailed(_session, ex);
- }
-#else
const Ice::Exception* ex(_ex.get());
_callback->connectFailed(_session, *ex);
-#endif
}
private:
const Glacier2::SessionCallbackPtr _callback;
const Glacier2::SessionHelperPtr _session;
-#ifdef ICE_CPP11_MAPPING
- std::exception_ptr _ex;
-#else
IceUtil::UniquePtr<Ice::Exception> _ex;
-#endif
};
class CreatedCommunicator : public Ice::DispatcherCall
diff --git a/cpp/src/Ice/BatchRequestQueue.h b/cpp/src/Ice/BatchRequestQueue.h
index c7e30c6bd65..c8cb3090e7a 100644
--- a/cpp/src/Ice/BatchRequestQueue.h
+++ b/cpp/src/Ice/BatchRequestQueue.h
@@ -54,11 +54,7 @@ private:
bool _batchStreamCanFlush;
int _batchRequestNum;
size_t _batchMarker;
-#ifdef ICE_CPP11_MAPPING
- std::exception_ptr _exception;
-#else
IceUtil::UniquePtr<Ice::LocalException> _exception;
-#endif
size_t _maxSize;
};
diff --git a/cpp/src/Ice/ConnectRequestHandler.cpp b/cpp/src/Ice/ConnectRequestHandler.cpp
index ee1ed2376a6..dcfd582fde3 100644
--- a/cpp/src/Ice/ConnectRequestHandler.cpp
+++ b/cpp/src/Ice/ConnectRequestHandler.cpp
@@ -166,11 +166,7 @@ ConnectRequestHandler::waitForConnection()
Lock sync(*this);
if(ICE_EXCEPTION_ISSET(_exception))
{
-#ifdef ICE_CPP11_MAPPING
- throw RetryException(_exception);
-#else
throw RetryException(*_exception.get());
-#endif
}
//
// Wait for the connection establishment to complete or fail.
@@ -332,7 +328,7 @@ ConnectRequestHandler::flushRequests()
}
#ifdef ICE_CPP11_MAPPING
- std::exception_ptr exception;
+ std::unique_ptr<Ice::LocalException> exception;
#else
IceUtil::UniquePtr<Ice::LocalException> exception;
#endif
@@ -352,11 +348,8 @@ ConnectRequestHandler::flushRequests()
}
catch(const RetryException& ex)
{
-#ifdef ICE_CPP11_MAPPING
- exception = ex.get();
-#else
- exception.reset(ex.get()->ice_clone());
-#endif
+ ICE_RESET_EXCEPTION(exception, ex.get()->ice_clone());
+
try
{
ICE_RETHROW_EXCEPTION(exception);
diff --git a/cpp/src/Ice/ConnectRequestHandler.h b/cpp/src/Ice/ConnectRequestHandler.h
index 771d682ac7a..222021469f1 100644
--- a/cpp/src/Ice/ConnectRequestHandler.h
+++ b/cpp/src/Ice/ConnectRequestHandler.h
@@ -75,11 +75,7 @@ private:
Ice::ConnectionIPtr _connection;
bool _compress;
-#ifdef ICE_CPP11_MAPPING
- std::exception_ptr _exception;
-#else
IceUtil::UniquePtr<Ice::LocalException> _exception;
-#endif
bool _initialized;
bool _flushing;
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp
index d75a0dd2222..82e1b48d6aa 100644
--- a/cpp/src/Ice/ConnectionI.cpp
+++ b/cpp/src/Ice/ConnectionI.cpp
@@ -624,11 +624,7 @@ Ice::ConnectionI::sendRequest(OutgoingBase* out, bool compress, bool response, i
//
if(ICE_EXCEPTION_ISSET(_exception))
{
-#ifdef ICE_CPP11_MAPPING
- throw RetryException(_exception);
-#else
throw RetryException(*_exception.get());
-#endif
}
assert(_state > StateNotValidated);
@@ -716,11 +712,7 @@ Ice::ConnectionI::sendAsyncRequest(const OutgoingAsyncBasePtr& out, bool compres
//
if(ICE_EXCEPTION_ISSET(_exception))
{
-#ifdef ICE_CPP11_MAPPING
- throw RetryException(_exception);
-#else
throw RetryException(*_exception.get());
-#endif
}
assert(_state > StateNotValidated);
assert(_state < StateClosing);
@@ -2579,11 +2571,7 @@ Ice::ConnectionI::initiateShutdown()
//
// Notify the the transceiver of the graceful connection closure.
//
-#ifdef ICE_CPP11_MAPPING
- SocketOperation op = _transceiver->closing(true, _exception);
-#else
SocketOperation op = _transceiver->closing(true, *_exception.get());
-#endif
if(op)
{
scheduleTimeout(op);
@@ -2929,11 +2917,7 @@ Ice::ConnectionI::sendNextMessage(vector<OutgoingMessage>& callbacks)
if(_state == StateClosing && _shutdownInitiated)
{
setState(StateClosingPending);
-#ifdef ICE_CPP11_MAPPING
- SocketOperation op = _transceiver->closing(true, _exception);
-#else
SocketOperation op = _transceiver->closing(true, *_exception.get());
-#endif
if(op)
{
return op;
@@ -3314,11 +3298,7 @@ Ice::ConnectionI::parseMessage(InputStream& stream, Int& invokeNum, Int& request
//
// Notify the the transceiver of the graceful connection closure.
//
-#ifdef ICE_CPP11_MAPPING
- SocketOperation op = _transceiver->closing(false, _exception);
-#else
SocketOperation op = _transceiver->closing(false, *_exception.get());
-#endif
if(op)
{
return op;
diff --git a/cpp/src/Ice/ConnectionI.h b/cpp/src/Ice/ConnectionI.h
index 023ac044e5b..a0a6cae89a1 100644
--- a/cpp/src/Ice/ConnectionI.h
+++ b/cpp/src/Ice/ConnectionI.h
@@ -368,11 +368,7 @@ private:
std::map<Int, IceInternal::OutgoingAsyncBasePtr> _asyncRequests;
std::map<Int, IceInternal::OutgoingAsyncBasePtr>::iterator _asyncRequestsHint;
-#ifdef ICE_CPP11_MAPPING
- std::exception_ptr _exception;
-#else
IceUtil::UniquePtr<LocalException> _exception;
-#endif
const size_t _messageSizeMax;
IceInternal::BatchRequestQueuePtr _batchRequestQueue;
diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp
index d9d1f929fc1..848d7260502 100644
--- a/cpp/src/Ice/Exception.cpp
+++ b/cpp/src/Ice/Exception.cpp
@@ -116,7 +116,15 @@ const std::string&
Ice::UserException::ice_staticId()
{
return __Ice__UserException_ids[0];
-};
+}
+
+#ifdef ICE_CPP11_MAPPING
+unique_ptr<Ice::UserException>
+Ice::UserException::ice_clone() const
+{
+ return unique_ptr<UserException>(static_cast<UserException*>(ice_cloneImpl()));
+}
+#endif
void
Ice::UserException::__write(::Ice::OutputStream* os) const
@@ -153,6 +161,14 @@ Ice::LocalException::~LocalException()
// Out of line to avoid weak vtable
}
+#ifdef ICE_CPP11_MAPPING
+unique_ptr<Ice::LocalException>
+Ice::LocalException::ice_clone() const
+{
+ return unique_ptr<LocalException>(static_cast<LocalException*>(ice_cloneImpl()));
+}
+#endif
+
namespace
{
@@ -181,6 +197,14 @@ Ice::SystemException::~SystemException()
{
}
+#ifdef ICE_CPP11_MAPPING
+unique_ptr<Ice::SystemException>
+Ice::SystemException::ice_clone() const
+{
+ return unique_ptr<SystemException>(static_cast<SystemException*>(ice_cloneImpl()));
+}
+#endif
+
namespace
{
diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp
index e768b442330..c570cd3702a 100644
--- a/cpp/src/Ice/LocatorInfo.cpp
+++ b/cpp/src/Ice/LocatorInfo.cpp
@@ -442,18 +442,7 @@ IceInternal::LocatorInfo::Request::addCallback(const ReferencePtr& ref,
else
{
assert(ICE_EXCEPTION_ISSET(_exception));
-#ifdef ICE_CPP11_MAPPING
- try
- {
- rethrow_exception(_exception);
- }
- catch(const Ice::Exception& ex)
- {
- callback->exception(_locatorInfo, ex);
- }
-#else
callback->exception(_locatorInfo, *_exception.get());
-#endif
}
}
@@ -486,18 +475,7 @@ IceInternal::LocatorInfo::Request::getEndpoints(const ReferencePtr& ref,
if(ICE_EXCEPTION_ISSET(_exception))
{
-#ifdef ICE_CPP11_MAPPING
- try
- {
- rethrow_exception(_exception);
- }
- catch(const Ice::Exception& ex)
- {
- _locatorInfo->getEndpointsException(ref, ex); // This throws.
- }
-#else
_locatorInfo->getEndpointsException(ref, *_exception.get()); // This throws.
-#endif
}
assert(_response);
diff --git a/cpp/src/Ice/LocatorInfo.h b/cpp/src/Ice/LocatorInfo.h
index b3f445b3f22..25b116913c3 100644
--- a/cpp/src/Ice/LocatorInfo.h
+++ b/cpp/src/Ice/LocatorInfo.h
@@ -132,11 +132,7 @@ public:
bool _sent;
bool _response;
Ice::ObjectPrxPtr _proxy;
-#ifdef ICE_CPP11_MAPPING
- std::exception_ptr _exception;
-#else
IceUtil::UniquePtr<Ice::Exception> _exception;
-#endif
};
typedef IceUtil::Handle<Request> RequestPtr;
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp
index 3c1ad6bfd14..66965b23332 100644
--- a/cpp/src/Ice/Outgoing.cpp
+++ b/cpp/src/Ice/Outgoing.cpp
@@ -561,18 +561,7 @@ Outgoing::completed(InputStream& is)
default:
{
-#ifdef ICE_CPP11_MAPPING
- try
- {
- throw UnknownReplyStatusException(__FILE__, __LINE__);
- }
- catch(...)
- {
- _exception = current_exception();
- }
-#else
_exception.reset(new UnknownReplyStatusException(__FILE__, __LINE__));
-#endif
_state = StateLocalException;
break;
}
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp
index 24691b9f755..507311ce3f8 100644
--- a/cpp/src/Ice/OutgoingAsync.cpp
+++ b/cpp/src/Ice/OutgoingAsync.cpp
@@ -1282,24 +1282,10 @@ ConnectionFlushBatchAsync::invoke(const string& operation)
}
catch(const RetryException& ex)
{
-#ifdef ICE_CPP11_MAPPING
- try
- {
- rethrow_exception(ex.get());
- }
- catch(const Ice::LocalException& ee)
- {
- if(exception(ee))
- {
- invokeExceptionAsync();
- }
- }
-#else
if(exception(*ex.get()))
{
invokeExceptionAsync();
}
-#endif
}
catch(const Exception& ex)
{
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index 772af952742..4e28f98dac7 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -1818,11 +1818,7 @@ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& all
const vector<EndpointIPtr> _endpoints;
const GetConnectionCallbackPtr _callback;
size_t _i;
-#ifdef ICE_CPP11_MAPPING
- std::exception_ptr _exception;
-#else
IceUtil::UniquePtr<Ice::LocalException> _exception;
-#endif
};
//
diff --git a/cpp/src/Ice/RequestHandler.cpp b/cpp/src/Ice/RequestHandler.cpp
index bca8cbb84eb..35e67a41864 100644
--- a/cpp/src/Ice/RequestHandler.cpp
+++ b/cpp/src/Ice/RequestHandler.cpp
@@ -13,34 +13,20 @@
using namespace std;
using namespace IceInternal;
-#ifdef ICE_CPP11_MAPPING
-RetryException::RetryException(std::exception_ptr ex) : _ex(ex)
-{
-}
-
-RetryException::RetryException(const RetryException& ex) : _ex(ex.get())
-{
-}
-
-exception_ptr
-RetryException::get() const
-{
- assert(_ex);
- return _ex;
-}
-
-#else
+#ifndef ICE_CPP11_MAPPING
IceUtil::Shared* IceInternal::upCast(RequestHandler* p) { return p; }
IceUtil::Shared* IceInternal::upCast(CancellationHandler* p) { return p; }
+#endif
+
RetryException::RetryException(const Ice::LocalException& ex)
{
- _ex.reset(ex.ice_clone());
+ ICE_RESET_EXCEPTION(_ex, ex.ice_clone());
}
RetryException::RetryException(const RetryException& ex)
{
- _ex.reset(ex.get()->ice_clone());
+ ICE_RESET_EXCEPTION(_ex, ex.get()->ice_clone());
}
const Ice::LocalException*
@@ -49,7 +35,6 @@ RetryException::get() const
assert(_ex.get());
return _ex.get();
}
-#endif
RequestHandler::RequestHandler(const ReferencePtr& reference) :
_reference(reference),
diff --git a/cpp/src/Ice/RequestHandler.h b/cpp/src/Ice/RequestHandler.h
index dcad80c2c35..c1ce9446f0e 100644
--- a/cpp/src/Ice/RequestHandler.h
+++ b/cpp/src/Ice/RequestHandler.h
@@ -36,21 +36,6 @@ class ProxyOutgoingBase;
// An exception wrapper, which is used to notify that the request
// handler should be cleared and the invocation retried.
//
-#ifdef ICE_CPP11_MAPPING
-class RetryException
-{
-public:
-
- RetryException(std::exception_ptr);
- RetryException(const RetryException&);
-
- std::exception_ptr get() const;
-
-private:
-
- std::exception_ptr _ex;
-};
-#else
class RetryException
{
public:
@@ -64,7 +49,6 @@ private:
IceUtil::UniquePtr<Ice::LocalException> _ex;
};
-#endif
class CancellationHandler
diff --git a/cpp/src/Ice/RouterInfo.h b/cpp/src/Ice/RouterInfo.h
index b7f7821d13d..acd24af3476 100644
--- a/cpp/src/Ice/RouterInfo.h
+++ b/cpp/src/Ice/RouterInfo.h
@@ -45,7 +45,7 @@ private:
#ifdef ICE_CPP11_MAPPING
using RouterTableMap = std::map<std::shared_ptr<Ice::RouterPrx>,
- RouterInfoPtr,
+ RouterInfoPtr,
Ice::TargetLess<std::shared_ptr<::Ice::RouterPrx>>>;
#else
typedef std::map<Ice::RouterPrxPtr, RouterInfoPtr> RouterTableMap;
diff --git a/cpp/src/Ice/TcpTransceiver.cpp b/cpp/src/Ice/TcpTransceiver.cpp
index be280be0476..808ac140443 100644
--- a/cpp/src/Ice/TcpTransceiver.cpp
+++ b/cpp/src/Ice/TcpTransceiver.cpp
@@ -31,11 +31,7 @@ IceInternal::TcpTransceiver::initialize(Buffer& readBuffer, Buffer& writeBuffer)
}
SocketOperation
-#ifdef ICE_CPP11_MAPPING
-IceInternal::TcpTransceiver::closing(bool initiator, exception_ptr)
-#else
IceInternal::TcpTransceiver::closing(bool initiator, const Ice::LocalException&)
-#endif
{
// If we are initiating the connection closure, wait for the peer
// to close the TCP/IP connection. Otherwise, close immediately.
diff --git a/cpp/src/Ice/TcpTransceiver.h b/cpp/src/Ice/TcpTransceiver.h
index 198b4aeab77..dc3d279d6dc 100644
--- a/cpp/src/Ice/TcpTransceiver.h
+++ b/cpp/src/Ice/TcpTransceiver.h
@@ -28,11 +28,8 @@ public:
virtual NativeInfoPtr getNativeInfo();
virtual SocketOperation initialize(Buffer&, Buffer&);
-#ifdef ICE_CPP11_MAPPING
- virtual SocketOperation closing(bool, std::exception_ptr);
-#else
virtual SocketOperation closing(bool, const Ice::LocalException&);
-#endif
+
virtual void close();
virtual SocketOperation write(Buffer&);
virtual SocketOperation read(Buffer&);
diff --git a/cpp/src/Ice/Transceiver.h b/cpp/src/Ice/Transceiver.h
index a0f14ce7ad7..f21e3a27aaf 100644
--- a/cpp/src/Ice/Transceiver.h
+++ b/cpp/src/Ice/Transceiver.h
@@ -28,11 +28,8 @@ public:
virtual NativeInfoPtr getNativeInfo() = 0;
virtual SocketOperation initialize(Buffer&, Buffer&) = 0;
-#ifdef ICE_CPP11_MAPPING
- virtual SocketOperation closing(bool, std::exception_ptr) = 0;
-#else
virtual SocketOperation closing(bool, const Ice::LocalException&) = 0;
-#endif
+
virtual void close() = 0;
virtual EndpointIPtr bind();
virtual SocketOperation write(Buffer&) = 0;
diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp
index 3ec0db137e2..c6a6b6352f7 100755
--- a/cpp/src/Ice/UdpTransceiver.cpp
+++ b/cpp/src/Ice/UdpTransceiver.cpp
@@ -97,11 +97,7 @@ IceInternal::UdpTransceiver::initialize(Buffer& /*readBuffer*/, Buffer& /*writeB
}
SocketOperation
-#ifdef ICE_CPP11_MAPPING
-IceInternal::UdpTransceiver::closing(bool, exception_ptr)
-#else
IceInternal::UdpTransceiver::closing(bool, const Ice::LocalException&)
-#endif
{
// Nothing to do.
return SocketOperationNone;
diff --git a/cpp/src/Ice/UdpTransceiver.h b/cpp/src/Ice/UdpTransceiver.h
index 84b600d68c2..fa81553eb3c 100644
--- a/cpp/src/Ice/UdpTransceiver.h
+++ b/cpp/src/Ice/UdpTransceiver.h
@@ -43,11 +43,7 @@ public:
#endif
virtual SocketOperation initialize(Buffer&, Buffer&);
-#ifdef ICE_CPP11_MAPPING
- virtual SocketOperation closing(bool, std::exception_ptr);
-#else
virtual SocketOperation closing(bool, const Ice::LocalException&);
-#endif
virtual void close();
virtual EndpointIPtr bind();
virtual SocketOperation write(Buffer&);
diff --git a/cpp/src/Ice/WSTransceiver.cpp b/cpp/src/Ice/WSTransceiver.cpp
index 24d97b89920..0c33cfe8d8f 100644
--- a/cpp/src/Ice/WSTransceiver.cpp
+++ b/cpp/src/Ice/WSTransceiver.cpp
@@ -410,11 +410,7 @@ IceInternal::WSTransceiver::initialize(Buffer& readBuffer, Buffer& writeBuffer)
}
SocketOperation
-#ifdef ICE_CPP11_MAPPING
-IceInternal::WSTransceiver::closing(bool initiator, exception_ptr reason)
-#else
IceInternal::WSTransceiver::closing(bool initiator, const Ice::LocalException& reason)
-#endif
{
if(_instance->traceLevel() >= 1)
{
@@ -444,38 +440,7 @@ IceInternal::WSTransceiver::closing(bool initiator, const Ice::LocalException& r
}
_closingInitiator = initiator;
-#ifdef ICE_CPP11_MAPPING
- if(reason)
- {
- try
- {
- rethrow_exception(reason);
- }
- catch(const Ice::CloseConnectionException&)
- {
- _closingReason = CLOSURE_NORMAL;
- }
- catch(const Ice::ObjectAdapterDeactivatedException&)
- {
- _closingReason = CLOSURE_SHUTDOWN;
- }
- catch(Ice::CommunicatorDestroyedException&)
- {
- _closingReason = CLOSURE_SHUTDOWN;
- }
- catch(const Ice::MemoryLimitException&)
- {
- _closingReason = CLOSURE_TOO_BIG;
- }
- catch(const Ice::ProtocolException&)
- {
- _closingReason = CLOSURE_PROTOCOL_ERROR;
- }
- catch(...)
- {
- }
- }
-#else
+
if(dynamic_cast<const Ice::CloseConnectionException*>(&reason))
{
_closingReason = CLOSURE_NORMAL;
@@ -493,7 +458,6 @@ IceInternal::WSTransceiver::closing(bool initiator, const Ice::LocalException& r
{
_closingReason = CLOSURE_TOO_BIG;
}
-#endif
if(_state == StateOpened)
{
diff --git a/cpp/src/Ice/WSTransceiver.h b/cpp/src/Ice/WSTransceiver.h
index 7b6a7ffe5e6..c34a8438c7e 100644
--- a/cpp/src/Ice/WSTransceiver.h
+++ b/cpp/src/Ice/WSTransceiver.h
@@ -34,11 +34,7 @@ public:
#endif
virtual SocketOperation initialize(Buffer&, Buffer&);
-#ifdef ICE_CPP11_MAPPING
- virtual SocketOperation closing(bool, std::exception_ptr);
-#else
virtual SocketOperation closing(bool, const Ice::LocalException&);
-#endif
virtual void close();
virtual SocketOperation write(Buffer&);
virtual SocketOperation read(Buffer&);
diff --git a/cpp/src/Ice/ios/StreamTransceiver.cpp b/cpp/src/Ice/ios/StreamTransceiver.cpp
index 4fcbec4f400..8c9305f4031 100644
--- a/cpp/src/Ice/ios/StreamTransceiver.cpp
+++ b/cpp/src/Ice/ios/StreamTransceiver.cpp
@@ -297,11 +297,7 @@ IceObjC::StreamTransceiver::initialize(Buffer& readBuffer, Buffer& writeBuffer)
}
SocketOperation
-#ifdef ICE_CPP11_MAPPING
-IceObjC::StreamTransceiver::closing(bool initiator, exception_ptr)
-#else
IceObjC::StreamTransceiver::closing(bool initiator, const Ice::LocalException&)
-#endif
{
// If we are initiating the connection closure, wait for the peer
// to close the TCP/IP connection. Otherwise, close immediately.
diff --git a/cpp/src/Ice/ios/StreamTransceiver.h b/cpp/src/Ice/ios/StreamTransceiver.h
index e38285451f8..c6ba084b64b 100644
--- a/cpp/src/Ice/ios/StreamTransceiver.h
+++ b/cpp/src/Ice/ios/StreamTransceiver.h
@@ -52,11 +52,7 @@ public:
virtual void closeStreams();
virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&);
-#ifdef ICE_CPP11_MAPPING
- virtual IceInternal::SocketOperation closing(bool initiator, std::exception_ptr);
-#else
virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&);
-#endif
virtual void close();
virtual IceInternal::SocketOperation write(IceInternal::Buffer&);
diff --git a/cpp/src/IceBT/TransceiverI.cpp b/cpp/src/IceBT/TransceiverI.cpp
index 4a3f4005803..327c96d9ef3 100644
--- a/cpp/src/IceBT/TransceiverI.cpp
+++ b/cpp/src/IceBT/TransceiverI.cpp
@@ -35,11 +35,7 @@ IceBT::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal::Bu
}
IceInternal::SocketOperation
-#ifdef ICE_CPP11_MAPPING
-IceBT::TransceiverI::closing(bool initiator, exception_ptr)
-#else
IceBT::TransceiverI::closing(bool initiator, const Ice::LocalException&)
-#endif
{
//
// If we are initiating the connection closure, wait for the peer
diff --git a/cpp/src/IceBT/TransceiverI.h b/cpp/src/IceBT/TransceiverI.h
index dee886dffb3..04170a52327 100644
--- a/cpp/src/IceBT/TransceiverI.h
+++ b/cpp/src/IceBT/TransceiverI.h
@@ -28,11 +28,8 @@ public:
virtual IceInternal::NativeInfoPtr getNativeInfo();
virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&);
-#ifdef ICE_CPP11_MAPPING
- virtual IceInternal::SocketOperation closing(bool, std::exception_ptr);
-#else
+
virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&);
-#endif
virtual void close();
virtual IceInternal::SocketOperation write(IceInternal::Buffer&);
virtual IceInternal::SocketOperation read(IceInternal::Buffer&);
diff --git a/cpp/src/IceIAP/Transceiver.h b/cpp/src/IceIAP/Transceiver.h
index b82ed27c395..ee625845713 100644
--- a/cpp/src/IceIAP/Transceiver.h
+++ b/cpp/src/IceIAP/Transceiver.h
@@ -45,11 +45,8 @@ public:
virtual IceInternal::NativeInfoPtr getNativeInfo();
virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&);
-#ifdef ICE_CPP11_MAPPING
- virtual IceInternal::SocketOperation closing(bool, std::exception_ptr);
-#else
+
virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&);
-#endif
virtual void close();
virtual IceInternal::SocketOperation write(IceInternal::Buffer&);
virtual IceInternal::SocketOperation read(IceInternal::Buffer&);
diff --git a/cpp/src/IceIAP/Transceiver.mm b/cpp/src/IceIAP/Transceiver.mm
index 23496965421..0d7c332120d 100644
--- a/cpp/src/IceIAP/Transceiver.mm
+++ b/cpp/src/IceIAP/Transceiver.mm
@@ -254,11 +254,7 @@ IceObjC::iAPTransceiver::initialize(Buffer& readBuffer, Buffer& writeBuffer)
}
SocketOperation
-#ifdef ICE_CPP11_MAPPING
-IceObjC::iAPTransceiver::closing(bool initiator, exception_ptr)
-#else
IceObjC::iAPTransceiver::closing(bool initiator, const Ice::LocalException&)
-#endif
{
// If we are initiating the connection closure, wait for the peer
// to close the TCP/IP connection. Otherwise, close immediately.
diff --git a/cpp/src/IceSSL/Certificate.cpp b/cpp/src/IceSSL/Certificate.cpp
index 7fb39540760..1d1a545e7a4 100755
--- a/cpp/src/IceSSL/Certificate.cpp
+++ b/cpp/src/IceSSL/Certificate.cpp
@@ -597,7 +597,7 @@ certificateAltNames(Windows::Security::Cryptography::Certificates::SubjectAltern
#endif
CertificateReadException::CertificateReadException(const char* file, int line, const string& r) :
- Exception(file, line),
+ ExceptionHelper<CertificateReadException>(file, line),
reason(r)
{
}
@@ -622,15 +622,9 @@ CertificateReadException::ice_clone() const
}
#endif
-void
-CertificateReadException::ice_throw() const
-{
- throw *this;
-}
-
#ifdef ICE_USE_SECURE_TRANSPORT
CertificateEncodingException::CertificateEncodingException(const char* file, int line, CFErrorRef err) :
- Exception(file, line)
+ ExceptionHelper<CertificateEncodingException>(file, line)
{
assert(err);
reason = "certificate error:\n" + errorToString(err);
@@ -639,7 +633,7 @@ CertificateEncodingException::CertificateEncodingException(const char* file, int
#endif
CertificateEncodingException::CertificateEncodingException(const char* file, int line, const string& r) :
- Exception(file, line),
+ ExceptionHelper<CertificateEncodingException>(file, line),
reason(r)
{
}
@@ -664,12 +658,6 @@ CertificateEncodingException::ice_clone() const
}
#endif
-void
-CertificateEncodingException::ice_throw() const
-{
- throw *this;
-}
-
#ifdef ICE_USE_OPENSSL
namespace
@@ -843,7 +831,7 @@ convertGeneralNames(GENERAL_NAMES* gens)
#endif
ParseException::ParseException(const char* file, int line, const string& r) :
- Exception(file, line),
+ ExceptionHelper<ParseException>(file, line),
reason(r)
{
}
@@ -868,12 +856,6 @@ ParseException::ice_clone() const
}
#endif
-void
-ParseException::ice_throw() const
-{
- throw *this;
-}
-
#ifdef ICE_USE_OPENSSL
DistinguishedName::DistinguishedName(X509NAME* name) : _rdns(RFC2253::parseStrict(convertX509NameToString(name)))
{
diff --git a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp
index de7fbb3ade6..75bc146e14f 100644
--- a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp
+++ b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp
@@ -307,11 +307,7 @@ IceSSL::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal::B
}
IceInternal::SocketOperation
-#ifdef ICE_CPP11_MAPPING
-IceSSL::TransceiverI::closing(bool initiator, exception_ptr)
-#else
IceSSL::TransceiverI::closing(bool initiator, const Ice::LocalException&)
-#endif
{
// If we are initiating the connection closure, wait for the peer
// to close the TCP/IP connection. Otherwise, close immediately.
diff --git a/cpp/src/IceSSL/OpenSSLTransceiverI.h b/cpp/src/IceSSL/OpenSSLTransceiverI.h
index 58459e804b9..539c531355f 100644
--- a/cpp/src/IceSSL/OpenSSLTransceiverI.h
+++ b/cpp/src/IceSSL/OpenSSLTransceiverI.h
@@ -39,11 +39,7 @@ public:
virtual IceInternal::NativeInfoPtr getNativeInfo();
virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&);
-#ifdef ICE_CPP11_MAPPING
- virtual IceInternal::SocketOperation closing(bool, std::exception_ptr);
-#else
virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&);
-#endif
virtual void close();
virtual IceInternal::SocketOperation write(IceInternal::Buffer&);
virtual IceInternal::SocketOperation read(IceInternal::Buffer&);
diff --git a/cpp/src/IceSSL/SChannelTransceiverI.cpp b/cpp/src/IceSSL/SChannelTransceiverI.cpp
index 87505808cd3..9409467e0ab 100644
--- a/cpp/src/IceSSL/SChannelTransceiverI.cpp
+++ b/cpp/src/IceSSL/SChannelTransceiverI.cpp
@@ -756,11 +756,7 @@ IceSSL::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal::B
}
IceInternal::SocketOperation
-#ifdef ICE_CPP11_MAPPING
-IceSSL::TransceiverI::closing(bool initiator, exception_ptr)
-#else
IceSSL::TransceiverI::closing(bool initiator, const Ice::LocalException&)
-#endif
{
// If we are initiating the connection closure, wait for the peer
// to close the TCP/IP connection. Otherwise, close immediately.
diff --git a/cpp/src/IceSSL/SChannelTransceiverI.h b/cpp/src/IceSSL/SChannelTransceiverI.h
index dc9d8030b61..c70ade9a7e5 100644
--- a/cpp/src/IceSSL/SChannelTransceiverI.h
+++ b/cpp/src/IceSSL/SChannelTransceiverI.h
@@ -50,11 +50,7 @@ public:
virtual IceInternal::NativeInfoPtr getNativeInfo();
virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&);
-#ifdef ICE_CPP11_MAPPING
- virtual IceInternal::SocketOperation closing(bool, std::exception_ptr);
-#else
virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&);
-#endif
virtual void close();
virtual IceInternal::SocketOperation write(IceInternal::Buffer&);
virtual IceInternal::SocketOperation read(IceInternal::Buffer&);
diff --git a/cpp/src/IceSSL/SecureTransportEngine.cpp b/cpp/src/IceSSL/SecureTransportEngine.cpp
index 1876477794c..6dd7e82b233 100644
--- a/cpp/src/IceSSL/SecureTransportEngine.cpp
+++ b/cpp/src/IceSSL/SecureTransportEngine.cpp
@@ -11,6 +11,7 @@
#include <IceUtil/FileUtil.h>
#include <IceUtil/StringUtil.h>
+#include <IceUtil/MutexPtrLock.h>
#include <Ice/LocalException.h>
#include <Ice/Properties.h>
diff --git a/cpp/src/IceSSL/SecureTransportTransceiverI.cpp b/cpp/src/IceSSL/SecureTransportTransceiverI.cpp
index f407e008913..9471070bfea 100644
--- a/cpp/src/IceSSL/SecureTransportTransceiverI.cpp
+++ b/cpp/src/IceSSL/SecureTransportTransceiverI.cpp
@@ -318,11 +318,7 @@ IceSSL::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal::B
}
IceInternal::SocketOperation
-#ifdef ICE_CPP11_MAPPING
-IceSSL::TransceiverI::closing(bool initiator, exception_ptr)
-#else
IceSSL::TransceiverI::closing(bool initiator, const Ice::LocalException&)
-#endif
{
// If we are initiating the connection closure, wait for the peer
// to close the TCP/IP connection. Otherwise, close immediately.
diff --git a/cpp/src/IceSSL/SecureTransportTransceiverI.h b/cpp/src/IceSSL/SecureTransportTransceiverI.h
index 71a2a6c5f34..59ac94b8584 100644
--- a/cpp/src/IceSSL/SecureTransportTransceiverI.h
+++ b/cpp/src/IceSSL/SecureTransportTransceiverI.h
@@ -37,11 +37,7 @@ public:
virtual IceInternal::NativeInfoPtr getNativeInfo();
virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&);
-#ifdef ICE_CPP11_MAPPING
- virtual IceInternal::SocketOperation closing(bool, std::exception_ptr);
-#else
virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&);
-#endif
virtual void close();
virtual IceInternal::SocketOperation write(IceInternal::Buffer&);
virtual IceInternal::SocketOperation read(IceInternal::Buffer&);
diff --git a/cpp/src/IceSSL/WinRTTransceiverI.cpp b/cpp/src/IceSSL/WinRTTransceiverI.cpp
index 5c7058a3d31..d9bca2912a9 100755
--- a/cpp/src/IceSSL/WinRTTransceiverI.cpp
+++ b/cpp/src/IceSSL/WinRTTransceiverI.cpp
@@ -55,11 +55,7 @@ IceSSL::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal::B
}
IceInternal::SocketOperation
-#ifdef ICE_CPP11_MAPPING
-IceSSL::TransceiverI::closing(bool initiator, exception_ptr ex)
-#else
IceSSL::TransceiverI::closing(bool initiator, const Ice::LocalException& ex)
-#endif
{
return _delegate->closing(initiator, ex);
}
diff --git a/cpp/src/IceSSL/WinRTTransceiverI.h b/cpp/src/IceSSL/WinRTTransceiverI.h
index d3994eb359a..29d285175a6 100755
--- a/cpp/src/IceSSL/WinRTTransceiverI.h
+++ b/cpp/src/IceSSL/WinRTTransceiverI.h
@@ -34,11 +34,7 @@ public:
virtual IceInternal::NativeInfoPtr getNativeInfo();
virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&);
-#ifdef ICE_CPP11_MAPPING
- virtual IceInternal::SocketOperation closing(bool, std::exception_ptr);
-#else
virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&);
-#endif
virtual void close();
virtual IceInternal::SocketOperation write(IceInternal::Buffer&);
virtual IceInternal::SocketOperation read(IceInternal::Buffer&);
diff --git a/cpp/src/IceSSL/uwp/TransceiverI.cpp b/cpp/src/IceSSL/uwp/TransceiverI.cpp
index 06ef9f8a6e1..0ec28120a7f 100644
--- a/cpp/src/IceSSL/uwp/TransceiverI.cpp
+++ b/cpp/src/IceSSL/uwp/TransceiverI.cpp
@@ -88,11 +88,7 @@ IceSSL::TransceiverI::initialize(IceInternal::Buffer&, IceInternal::Buffer&)
}
IceInternal::SocketOperation
-#ifdef ICE_CPP11_MAPPING
-IceSSL::TransceiverI::closing(bool initiator, exception_ptr)
-#else
IceSSL::TransceiverI::closing(bool initiator, const Ice::LocalException&)
-#endif
{
// If we are initiating the connection closure, wait for the peer
// to close the TCP/IP connection. Otherwise, close immediately.
diff --git a/cpp/src/IceSSL/uwp/TransceiverI.h b/cpp/src/IceSSL/uwp/TransceiverI.h
index ef7a51fb7af..4e8b7e6c620 100644
--- a/cpp/src/IceSSL/uwp/TransceiverI.h
+++ b/cpp/src/IceSSL/uwp/TransceiverI.h
@@ -38,11 +38,8 @@ public:
virtual void setCompletedHandler(IceInternal::SocketOperationCompletedHandler^);
virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&);
-#ifdef ICE_CPP11_MAPPING
- virtual IceInternal::SocketOperation closing(bool, std::exception_ptr);
-#else
+
virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&);
-#endif
virtual void close();
virtual IceInternal::SocketOperation write(IceInternal::Buffer&);
virtual IceInternal::SocketOperation read(IceInternal::Buffer&);
diff --git a/cpp/src/IceUtil/CtrlCHandler.cpp b/cpp/src/IceUtil/CtrlCHandler.cpp
index 6eac2e7e05a..4fd8fe406fd 100644
--- a/cpp/src/IceUtil/CtrlCHandler.cpp
+++ b/cpp/src/IceUtil/CtrlCHandler.cpp
@@ -51,7 +51,7 @@ Init init;
}
CtrlCHandlerException::CtrlCHandlerException(const char* file, int line) :
- Exception(file, line)
+ ExceptionHelper<CtrlCHandlerException>(file, line)
{
}
@@ -70,19 +70,13 @@ CtrlCHandlerException::ice_clone() const
#endif
void
-CtrlCHandlerException::ice_throw() const
-{
- throw *this;
-}
-
-void
CtrlCHandler::setCallback(CtrlCHandlerCallback callback)
{
IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(globalMutex);
_callback = callback;
}
-CtrlCHandlerCallback
+CtrlCHandlerCallback
CtrlCHandler::getCallback() const
{
IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(globalMutex);
@@ -140,10 +134,10 @@ CtrlCHandler::~CtrlCHandler()
#else
-extern "C"
+extern "C"
{
-static void*
+static void*
sigwaitThread(void*)
{
sigset_t ctrlCLikeSignals;
@@ -168,7 +162,7 @@ sigwaitThread(void*)
continue;
}
assert(rc == 0);
-
+
CtrlCHandlerCallback callback;
{
IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(globalMutex);
@@ -211,11 +205,11 @@ CtrlCHandler::CtrlCHandler(CtrlCHandlerCallback callback)
_handler = this;
lock.release();
-
+
// We block these CTRL+C like signals in the main thread,
// and by default all other threads will inherit this signal
// mask.
-
+
sigset_t ctrlCLikeSignals;
sigemptyset(&ctrlCLikeSignals);
sigaddset(&ctrlCLikeSignals, SIGHUP);
@@ -265,4 +259,3 @@ CtrlCHandler::~CtrlCHandler()
}
#endif
-
diff --git a/cpp/src/IceUtil/Options.cpp b/cpp/src/IceUtil/Options.cpp
index 55615665a11..88626de2d9a 100644
--- a/cpp/src/IceUtil/Options.cpp
+++ b/cpp/src/IceUtil/Options.cpp
@@ -16,7 +16,7 @@ using namespace std;
using namespace IceUtil;
IceUtilInternal::APIException::APIException(const char* file, int line, const string& r)
- : IceUtil::Exception(file, line), reason(r)
+ : IceUtil::ExceptionHelper<APIException>(file, line), reason(r)
{
}
@@ -50,12 +50,6 @@ IceUtilInternal::APIException::ice_clone() const
}
#endif
-void
-IceUtilInternal::APIException::ice_throw() const
-{
- throw *this;
-}
-
ostream&
IceUtilInternal::operator<<(ostream& out, const IceUtilInternal::APIException& ex)
{
@@ -64,7 +58,7 @@ IceUtilInternal::operator<<(ostream& out, const IceUtilInternal::APIException& e
}
IceUtilInternal::BadOptException::BadOptException(const char* file, int line, const string& r)
- : IceUtil::Exception(file, line), reason(r)
+ : IceUtil::ExceptionHelper<BadOptException>(file, line), reason(r)
{
}
@@ -98,12 +92,6 @@ IceUtilInternal::BadOptException::ice_clone() const
}
#endif
-void
-IceUtilInternal::BadOptException::ice_throw() const
-{
- throw *this;
-}
-
ostream&
IceUtilInternal::operator<<(ostream& out, const IceUtilInternal::BadOptException& ex)
{
diff --git a/cpp/src/IceUtil/ThreadException.cpp b/cpp/src/IceUtil/ThreadException.cpp
index c41106820ce..ec75cc19bb5 100644
--- a/cpp/src/IceUtil/ThreadException.cpp
+++ b/cpp/src/IceUtil/ThreadException.cpp
@@ -11,8 +11,8 @@
using namespace std;
-IceUtil::ThreadSyscallException::ThreadSyscallException(const char* file, int line, int err ):
- SyscallException(file, line, err)
+IceUtil::ThreadSyscallException::ThreadSyscallException(const char* file, int line, int err ):
+ SyscallExceptionHelper<ThreadSyscallException>(file, line, err)
{
}
@@ -30,14 +30,8 @@ IceUtil::ThreadSyscallException::ice_clone() const
}
#endif
-void
-IceUtil::ThreadSyscallException::ice_throw() const
-{
- throw *this;
-}
-
IceUtil::ThreadLockedException::ThreadLockedException(const char* file, int line) :
- Exception(file, line)
+ ExceptionHelper<ThreadLockedException>(file, line)
{
}
@@ -55,14 +49,9 @@ IceUtil::ThreadLockedException::ice_clone() const
}
#endif
-void
-IceUtil::ThreadLockedException::ice_throw() const
-{
- throw *this;
-}
IceUtil::ThreadStartedException::ThreadStartedException(const char* file, int line) :
- Exception(file, line)
+ ExceptionHelper<ThreadStartedException>(file, line)
{
}
@@ -80,14 +69,8 @@ IceUtil::ThreadStartedException::ice_clone() const
}
#endif
-void
-IceUtil::ThreadStartedException::ice_throw() const
-{
- throw *this;
-}
-
IceUtil::ThreadNotStartedException::ThreadNotStartedException(const char* file, int line) :
- Exception(file, line)
+ ExceptionHelper<ThreadNotStartedException>(file, line)
{
}
@@ -97,6 +80,7 @@ IceUtil::ThreadNotStartedException::ice_id() const
return "::IceUtil::ThreadNotStartedException";
}
+
#ifndef ICE_CPP11_MAPPING
IceUtil::ThreadNotStartedException*
IceUtil::ThreadNotStartedException::ice_clone() const
@@ -105,15 +89,9 @@ IceUtil::ThreadNotStartedException::ice_clone() const
}
#endif
-void
-IceUtil::ThreadNotStartedException::ice_throw() const
-{
- throw *this;
-}
-
IceUtil::BadThreadControlException::BadThreadControlException(const char* file, int line) :
- Exception(file, line)
+ ExceptionHelper<BadThreadControlException>(file, line)
{
}
@@ -131,15 +109,9 @@ IceUtil::BadThreadControlException::ice_clone() const
}
#endif
-void
-IceUtil::BadThreadControlException::ice_throw() const
-{
- throw *this;
-}
-
-IceUtil::InvalidTimeoutException::InvalidTimeoutException(const char* file, int line,
- const IceUtil::Time& timeout) :
- Exception(file, line),
+IceUtil::InvalidTimeoutException::InvalidTimeoutException(const char* file, int line,
+ const IceUtil::Time& timeout) :
+ ExceptionHelper<InvalidTimeoutException>(file, line),
_timeout(timeout)
{
}
@@ -150,13 +122,6 @@ IceUtil::InvalidTimeoutException::ice_id() const
return "::IceUtil::InvalidTimeoutException";
}
-void
-IceUtil::InvalidTimeoutException::ice_print(ostream& os) const
-{
- Exception::ice_print(os);
- os << ":\ninvalid timeout: " << _timeout << " seconds";
-}
-
#ifndef ICE_CPP11_MAPPING
IceUtil::InvalidTimeoutException*
IceUtil::InvalidTimeoutException::ice_clone() const
@@ -166,7 +131,8 @@ IceUtil::InvalidTimeoutException::ice_clone() const
#endif
void
-IceUtil::InvalidTimeoutException::ice_throw() const
+IceUtil::InvalidTimeoutException::ice_print(ostream& os) const
{
- throw *this;
+ Exception::ice_print(os);
+ os << ":\ninvalid timeout: " << _timeout << " seconds";
}
diff --git a/cpp/src/IceUtil/UtilException.cpp b/cpp/src/IceUtil/UtilException.cpp
index 734ae013e9d..50b5b7ce0f6 100644
--- a/cpp/src/IceUtil/UtilException.cpp
+++ b/cpp/src/IceUtil/UtilException.cpp
@@ -616,23 +616,7 @@ IceUtil::Exception::what() const ICE_NOEXCEPT
return "";
}
-#ifdef ICE_CPP11_MAPPING
-exception_ptr
-IceUtil::Exception::ice_clone() const
-{
- try
- {
- ice_throw();
- }
- catch(...)
- {
- return current_exception();
- }
- assert(false);
- return nullptr; // Make compilers happy
-}
-#else
-
+#ifndef ICE_CPP11_MAPPING
string
IceUtil::Exception::ice_name() const
{
@@ -658,6 +642,14 @@ IceUtil::Exception::ice_stackTrace() const
return getStackTrace(_stackFrames);
}
+#ifdef ICE_CPP11_MAPPING
+unique_ptr<IceUtil::Exception>
+IceUtil::Exception::ice_clone() const
+{
+ return unique_ptr<Exception>(ice_cloneImpl());
+}
+#endif
+
ostream&
IceUtil::operator<<(ostream& out, const IceUtil::Exception& ex)
{
@@ -666,7 +658,7 @@ IceUtil::operator<<(ostream& out, const IceUtil::Exception& ex)
}
IceUtil::NullHandleException::NullHandleException(const char* file, int line) :
- Exception(file, line)
+ ExceptionHelper<NullHandleException>(file, line)
{
if(IceUtilInternal::nullHandleAbort)
{
@@ -674,12 +666,6 @@ IceUtil::NullHandleException::NullHandleException(const char* file, int line) :
}
}
-#ifndef ICE_CPP11_COMPILER
-IceUtil::NullHandleException::~NullHandleException() throw()
-{
-}
-#endif
-
string
IceUtil::NullHandleException::ice_id() const
{
@@ -694,19 +680,14 @@ IceUtil::NullHandleException::ice_clone() const
}
#endif
-void
-IceUtil::NullHandleException::ice_throw() const
-{
- throw *this;
-}
IceUtil::IllegalArgumentException::IllegalArgumentException(const char* file, int line) :
- Exception(file, line)
+ ExceptionHelper<IllegalArgumentException>(file, line)
{
}
IceUtil::IllegalArgumentException::IllegalArgumentException(const char* file, int line, const string& r) :
- Exception(file, line),
+ ExceptionHelper<IllegalArgumentException>(file, line),
_reason(r)
{
}
@@ -738,12 +719,6 @@ IceUtil::IllegalArgumentException::ice_clone() const
}
#endif
-void
-IceUtil::IllegalArgumentException::ice_throw() const
-{
- throw *this;
-}
-
string
IceUtil::IllegalArgumentException::reason() const
{
@@ -754,14 +729,16 @@ IceUtil::IllegalArgumentException::reason() const
// IllegalConversionException
//
IceUtil::IllegalConversionException::IllegalConversionException(const char* file, int line):
- Exception(file, line)
-{}
+ ExceptionHelper<IllegalConversionException>(file, line)
+{
+}
IceUtil::IllegalConversionException::IllegalConversionException(const char* file, int line,
const string& reason):
- Exception(file, line),
+ ExceptionHelper<IllegalConversionException>(file, line),
_reason(reason)
-{}
+{
+}
#ifndef ICE_CPP11_COMPILER
IceUtil::IllegalConversionException::~IllegalConversionException() throw()
@@ -791,12 +768,6 @@ IceUtil::IllegalConversionException::ice_clone() const
}
#endif
-void
-IceUtil::IllegalConversionException::ice_throw() const
-{
- throw *this;
-}
-
string
IceUtil::IllegalConversionException::reason() const
{
@@ -806,11 +777,17 @@ IceUtil::IllegalConversionException::reason() const
IceUtil::SyscallException::SyscallException(const char* file, int line, int err ):
- Exception(file, line),
+ ExceptionHelper<SyscallException>(file, line),
_error(err)
{
}
+#ifndef ICE_CPP11_COMPILER
+IceUtil::SyscallException::~SyscallException() throw()
+{
+}
+#endif
+
void
IceUtil::SyscallException::ice_print(ostream& os) const
{
@@ -835,12 +812,6 @@ IceUtil::SyscallException::ice_clone() const
}
#endif
-void
-IceUtil::SyscallException::ice_throw() const
-{
- throw *this;
-}
-
int
IceUtil::SyscallException::error() const
{
@@ -849,7 +820,7 @@ IceUtil::SyscallException::error() const
IceUtil::FileLockException::FileLockException(const char* file, int line, int err, const string& path):
- Exception(file, line),
+ ExceptionHelper<FileLockException>(file, line),
_error(err),
_path(path)
{
@@ -886,12 +857,6 @@ IceUtil::FileLockException::ice_clone() const
}
#endif
-void
-IceUtil::FileLockException::ice_throw() const
-{
- throw *this;
-}
-
int
IceUtil::FileLockException::error() const
{
@@ -899,7 +864,7 @@ IceUtil::FileLockException::error() const
}
IceUtil::OptionalNotSetException::OptionalNotSetException(const char* file, int line) :
- Exception(file, line)
+ ExceptionHelper<OptionalNotSetException>(file, line)
{
if(IceUtilInternal::nullHandleAbort)
{
@@ -907,12 +872,6 @@ IceUtil::OptionalNotSetException::OptionalNotSetException(const char* file, int
}
}
-#ifndef ICE_CPP11_COMPILER
-IceUtil::OptionalNotSetException::~OptionalNotSetException() throw()
-{
-}
-#endif
-
string
IceUtil::OptionalNotSetException::ice_id() const
{
@@ -927,15 +886,9 @@ IceUtil::OptionalNotSetException::ice_clone() const
}
#endif
-void
-IceUtil::OptionalNotSetException::ice_throw() const
-{
- throw *this;
-}
-
#ifndef _WIN32
IceUtil::IconvInitializationException::IconvInitializationException(const char* file, int line, const string& reason) :
- Exception(file, line),
+ ExceptionHelper<IconvInitializationException>(file, line),
_reason(reason)
{
}
@@ -967,12 +920,6 @@ IceUtil::IconvInitializationException::ice_clone() const
}
#endif
-void
-IceUtil::IconvInitializationException::ice_throw() const
-{
- throw *this;
-}
-
string
IceUtil::IconvInitializationException::reason() const
{
diff --git a/cpp/src/IceXML/Parser.cpp b/cpp/src/IceXML/Parser.cpp
index c10b6061557..180545bea67 100644
--- a/cpp/src/IceXML/Parser.cpp
+++ b/cpp/src/IceXML/Parser.cpp
@@ -20,12 +20,12 @@ using namespace IceXML;
// ParserException
//
IceXML::ParserException::ParserException(const string& reason) :
- IceUtil::Exception(), _reason(reason)
+ _reason(reason)
{
}
IceXML::ParserException::ParserException(const char* file, int line, const string& reason) :
- IceUtil::Exception(file, line), _reason(reason)
+ IceUtil::ExceptionHelper<ParserException>(file, line), _reason(reason)
{
}
@@ -63,12 +63,6 @@ IceXML::ParserException::ice_clone() const
}
#endif
-void
-IceXML::ParserException::ice_throw() const
-{
- throw *this;
-}
-
string
IceXML::ParserException::reason() const
{
diff --git a/cpp/src/IceXML/Parser.h b/cpp/src/IceXML/Parser.h
index b44b3cac897..d6c7c43331d 100644
--- a/cpp/src/IceXML/Parser.h
+++ b/cpp/src/IceXML/Parser.h
@@ -42,7 +42,7 @@
namespace IceXML
{
-class ICE_XML_API ParserException : public IceUtil::Exception
+class ICE_XML_API ParserException : public IceUtil::ExceptionHelper<ParserException>
{
public:
@@ -57,7 +57,6 @@ public:
#ifndef ICE_CPP11_MAPPING
virtual ParserException* ice_clone() const;
#endif
- virtual void ice_throw() const;
std::string reason() const;