diff options
Diffstat (limited to 'cpp/include')
-rw-r--r-- | cpp/include/Glacier2/Application.h | 3 | ||||
-rw-r--r-- | cpp/include/Ice/CommunicatorAsync.h | 3 | ||||
-rw-r--r-- | cpp/include/Ice/ConnectionAsync.h | 5 | ||||
-rw-r--r-- | cpp/include/Ice/DispatchInterceptor.h | 2 | ||||
-rw-r--r-- | cpp/include/Ice/Dispatcher.h | 7 | ||||
-rw-r--r-- | cpp/include/Ice/Exception.h | 23 | ||||
-rw-r--r-- | cpp/include/Ice/ExceptionHelpers.h | 22 | ||||
-rw-r--r-- | cpp/include/Ice/GCObject.h | 4 | ||||
-rw-r--r-- | cpp/include/Ice/LocalObject.h | 7 | ||||
-rw-r--r-- | cpp/include/Ice/Outgoing.h | 4 | ||||
-rw-r--r-- | cpp/include/Ice/OutgoingAsync.h | 9 | ||||
-rw-r--r-- | cpp/include/Ice/ProxyHandle.h | 3 | ||||
-rw-r--r-- | cpp/include/IceSSL/Plugin.h | 9 | ||||
-rw-r--r-- | cpp/include/IceUtil/Config.h | 4 | ||||
-rw-r--r-- | cpp/include/IceUtil/CtrlCHandler.h | 4 | ||||
-rw-r--r-- | cpp/include/IceUtil/Exception.h | 137 | ||||
-rw-r--r-- | cpp/include/IceUtil/Options.h | 7 | ||||
-rw-r--r-- | cpp/include/IceUtil/ThreadException.h | 25 | ||||
-rw-r--r-- | cpp/include/IceUtil/UniquePtr.h | 16 |
19 files changed, 197 insertions, 97 deletions
diff --git a/cpp/include/Glacier2/Application.h b/cpp/include/Glacier2/Application.h index c7ad39a0d7e..109a07e732e 100644 --- a/cpp/include/Glacier2/Application.h +++ b/cpp/include/Glacier2/Application.h @@ -23,7 +23,7 @@ namespace Glacier2 * This exception is raised if the session should be restarted. * **/ -class GLACIER2_API RestartSessionException : public IceUtil::Exception +class GLACIER2_API RestartSessionException : public IceUtil::ExceptionHelper<RestartSessionException> { public: @@ -31,7 +31,6 @@ public: #ifndef ICE_CPP11_MAPPING virtual RestartSessionException* ice_clone() const; #endif - virtual void ice_throw() const; }; /** diff --git a/cpp/include/Ice/CommunicatorAsync.h b/cpp/include/Ice/CommunicatorAsync.h index f93b9b9b960..549542567dd 100644 --- a/cpp/include/Ice/CommunicatorAsync.h +++ b/cpp/include/Ice/CommunicatorAsync.h @@ -10,9 +10,10 @@ #ifndef ICE_COMMUNICATOR_ASYNC_H #define ICE_COMMUNICATOR_ASYNC_H +#ifndef ICE_CPP11_MAPPING + #include <Ice/Communicator.h> -#ifndef ICE_CPP11_MAPPING namespace Ice { diff --git a/cpp/include/Ice/ConnectionAsync.h b/cpp/include/Ice/ConnectionAsync.h index cd1588191f7..ce9fd85e7af 100644 --- a/cpp/include/Ice/ConnectionAsync.h +++ b/cpp/include/Ice/ConnectionAsync.h @@ -10,13 +10,14 @@ #ifndef ICE_CONNECTION_ASYNC_H #define ICE_CONNECTION_ASYNC_H +#ifndef ICE_CPP11_MAPPING + #include <Ice/Connection.h> #include <Ice/Proxy.h> namespace Ice { -#ifndef ICE_CPP11_MAPPING template<class T> class CallbackNC_Connection_flushBatchRequests : public Callback_Connection_flushBatchRequests_Base, public ::IceInternal::OnewayCallbackNC<T> @@ -110,8 +111,8 @@ newCallback_Connection_flushBatchRequests(T* instance, void (T::*excb)(const ::I { return new Callback_Connection_flushBatchRequests<T, CT>(instance, excb, sentcb); } -#endif } #endif +#endif diff --git a/cpp/include/Ice/DispatchInterceptor.h b/cpp/include/Ice/DispatchInterceptor.h index 37051ef400e..63a0a5e96e2 100644 --- a/cpp/include/Ice/DispatchInterceptor.h +++ b/cpp/include/Ice/DispatchInterceptor.h @@ -26,7 +26,7 @@ public: __dispatch(IceInternal::Incoming&, const Current&); }; -typedef IceInternal::Handle<DispatchInterceptor> DispatchInterceptorPtr; +ICE_DEFINE_PTR(DispatchInterceptorPtr, DispatchInterceptor); } diff --git a/cpp/include/Ice/Dispatcher.h b/cpp/include/Ice/Dispatcher.h index 51dceba00c7..cb9a25c124e 100644 --- a/cpp/include/Ice/Dispatcher.h +++ b/cpp/include/Ice/Dispatcher.h @@ -10,6 +10,12 @@ #ifndef ICE_DISPATCHER_H #define ICE_DISPATCHER_H +#if !defined(ICE_CPP11_MAPPING) || defined(ICE_BUILDING_SRC) +// +// Part of the C++98 mapping, and "internal" definitions when building Ice +// with the C++11 mapping +// + #include <IceUtil/Config.h> #include <IceUtil/Shared.h> #include <IceUtil/Handle.h> @@ -43,3 +49,4 @@ typedef IceUtil::Handle<Dispatcher> DispatcherPtr; } #endif +#endif diff --git a/cpp/include/Ice/Exception.h b/cpp/include/Ice/Exception.h index d06f576aae3..b957a91be0c 100644 --- a/cpp/include/Ice/Exception.h +++ b/cpp/include/Ice/Exception.h @@ -51,28 +51,32 @@ public: virtual ~LocalException() throw(); #endif - static const std::string& ice_staticId(); - -#ifndef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_MAPPING + std::unique_ptr<LocalException> ice_clone() const; +#else virtual LocalException* ice_clone() const = 0; #endif + + static const std::string& ice_staticId(); }; class ICE_API UserException : public IceUtil::Exception { public: - static const std::string& ice_staticId(); - virtual void __write(::Ice::OutputStream*) const; virtual void __read(::Ice::InputStream*); virtual bool __usesClasses() const; -#ifndef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_MAPPING + std::unique_ptr<UserException> ice_clone() const; +#else virtual UserException* ice_clone() const = 0; #endif + static const std::string& ice_staticId(); + protected: virtual void __writeImpl(::Ice::OutputStream*) const {}; @@ -90,12 +94,13 @@ public: virtual ~SystemException() throw(); #endif - static const std::string& ice_staticId(); - -#ifndef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_MAPPING + std::unique_ptr<SystemException> ice_clone() const; +#else virtual SystemException* ice_clone() const = 0; #endif + static const std::string& ice_staticId(); }; } diff --git a/cpp/include/Ice/ExceptionHelpers.h b/cpp/include/Ice/ExceptionHelpers.h index e4dfa076f34..04c37669f07 100644 --- a/cpp/include/Ice/ExceptionHelpers.h +++ b/cpp/include/Ice/ExceptionHelpers.h @@ -20,43 +20,29 @@ namespace Ice class LocalException; -template<typename T, typename B> class LocalExceptionHelper : public B +template<typename T, typename B> class LocalExceptionHelper : public IceUtil::ExceptionHelper<T, B> { public: - using B::B; - - LocalExceptionHelper() = default; + using IceUtil::ExceptionHelper<T, B>::ExceptionHelper; virtual std::string ice_id() const override { return T::ice_staticId(); } - - virtual void ice_throw() const override - { - throw static_cast<const T&>(*this); - } }; -template<typename T, typename B> class UserExceptionHelper : public B +template<typename T, typename B> class UserExceptionHelper : public IceUtil::ExceptionHelper<T, B> { public: - using B::B; - - UserExceptionHelper() = default; + using IceUtil::ExceptionHelper<T, B>::ExceptionHelper; virtual std::string ice_id() const override { return T::ice_staticId(); } - virtual void ice_throw() const override - { - throw static_cast<const T&>(*this); - } - protected: virtual void __writeImpl(Ice::OutputStream* os) const override diff --git a/cpp/include/Ice/GCObject.h b/cpp/include/Ice/GCObject.h index 2e407ee32c9..e115795be20 100644 --- a/cpp/include/Ice/GCObject.h +++ b/cpp/include/Ice/GCObject.h @@ -10,13 +10,13 @@ #ifndef ICE_GC_OBJECT_H #define ICE_GC_OBJECT_H +#ifndef ICE_CPP11_MAPPING + #include <Ice/Object.h> #include <IceUtil/MutexPtrLock.h> #include <IceUtil/Mutex.h> -#ifndef ICE_CPP11_MAPPING - namespace IceInternal { diff --git a/cpp/include/Ice/LocalObject.h b/cpp/include/Ice/LocalObject.h index fd765e04f0a..01f17caf60f 100644 --- a/cpp/include/Ice/LocalObject.h +++ b/cpp/include/Ice/LocalObject.h @@ -10,6 +10,12 @@ #ifndef ICE_LOCAL_OBJECT_H #define ICE_LOCAL_OBJECT_H +#if !defined(ICE_CPP11_MAPPING) || defined(ICE_BUILDING_SRC) +// +// Part of the C++98 mapping, and "internal" definitions when building Ice +// with the C++11 mapping +// + #include <IceUtil/Shared.h> #include <Ice/LocalObjectF.h> @@ -27,3 +33,4 @@ public: } #endif +#endif diff --git a/cpp/include/Ice/Outgoing.h b/cpp/include/Ice/Outgoing.h index 5c03011e699..9bb0810e38f 100644 --- a/cpp/include/Ice/Outgoing.h +++ b/cpp/include/Ice/Outgoing.h @@ -66,11 +66,7 @@ protected: OutgoingBase(Instance*); Ice::OutputStream _os; -#ifdef ICE_CPP11_MAPPING - std::exception_ptr _exception; -#else IceUtil::UniquePtr<Ice::Exception> _exception; -#endif bool _sent; InvocationObserver _observer; ObserverHelperT<Ice::Instrumentation::ChildInvocationObserver> _childObserver; diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h index df204b6a350..0a2edead961 100644 --- a/cpp/include/Ice/OutgoingAsync.h +++ b/cpp/include/Ice/OutgoingAsync.h @@ -23,10 +23,10 @@ #include <Ice/InputStream.h> #include <Ice/ObserverHelper.h> #include <Ice/LocalException.h> +#include <IceUtil/UniquePtr.h> #ifndef ICE_CPP11_MAPPING # include <Ice/AsyncResult.h> -# include <IceUtil/UniquePtr.h> #endif #include <exception> @@ -163,16 +163,15 @@ protected: #ifdef ICE_CPP11_MAPPING std::mutex _m; using Lock = std::lock_guard<std::mutex>; - std::exception_ptr _ex; - std::exception_ptr _cancellationException; #else IceUtil::Monitor<IceUtil::Mutex> _m; typedef IceUtil::Monitor<IceUtil::Mutex>::Lock Lock; - IceUtil::UniquePtr<Ice::Exception> _ex; - IceUtil::UniquePtr<Ice::LocalException> _cancellationException; Ice::LocalObjectPtr _cookie; #endif + IceUtil::UniquePtr<Ice::Exception> _ex; + IceUtil::UniquePtr<Ice::LocalException> _cancellationException; + InvocationObserver _observer; ObserverHelperT<Ice::Instrumentation::ChildInvocationObserver> _childObserver; diff --git a/cpp/include/Ice/ProxyHandle.h b/cpp/include/Ice/ProxyHandle.h index 22b29213839..628fb2b460b 100644 --- a/cpp/include/Ice/ProxyHandle.h +++ b/cpp/include/Ice/ProxyHandle.h @@ -10,12 +10,13 @@ #ifndef ICE_PROXY_HANDLE_H #define ICE_PROXY_HANDLE_H +#ifndef ICE_CPP11_MAPPING // C++98 mapping + #include <IceUtil/Handle.h> #include <Ice/Config.h> #include <iosfwd> -#ifndef ICE_CPP11_MAPPING // C++98 mapping namespace IceInternal { diff --git a/cpp/include/IceSSL/Plugin.h b/cpp/include/IceSSL/Plugin.h index 3f15974a556..75cfa266d8b 100644 --- a/cpp/include/IceSSL/Plugin.h +++ b/cpp/include/IceSSL/Plugin.h @@ -81,7 +81,7 @@ namespace IceSSL // // This exception is thrown if the certificate cannot be read. // -class ICE_SSL_API CertificateReadException : public IceUtil::Exception +class ICE_SSL_API CertificateReadException : public IceUtil::ExceptionHelper<CertificateReadException> { public: @@ -93,7 +93,6 @@ public: #ifndef ICE_CPP11_MAPPING virtual CertificateReadException* ice_clone() const; #endif - virtual void ice_throw() const; std::string reason; @@ -105,7 +104,7 @@ private: // // This exception is thrown if the certificate cannot be encoded. // -class ICE_SSL_API CertificateEncodingException : public IceUtil::Exception +class ICE_SSL_API CertificateEncodingException : public IceUtil::ExceptionHelper<CertificateEncodingException> { public: @@ -120,7 +119,6 @@ public: #ifndef ICE_CPP11_MAPPING virtual CertificateEncodingException* ice_clone() const; #endif - virtual void ice_throw() const; std::string reason; @@ -132,7 +130,7 @@ private: // // This exception is thrown if a distinguished name cannot be parsed. // -class ICE_SSL_API ParseException : public IceUtil::Exception +class ICE_SSL_API ParseException : public IceUtil::ExceptionHelper<ParseException> { public: @@ -144,7 +142,6 @@ public: #ifndef ICE_CPP11_MAPPING virtual ParseException* ice_clone() const; #endif - virtual void ice_throw() const; std::string reason; diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index 6e8a2ea0b0c..a53cd04abd1 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -375,7 +375,7 @@ typedef long long Int64; # define ICE_HEARTBEAT_CALLBACK ::std::function<void(const ::std::shared_ptr<::Ice::Connection>&)> # define ICE_IN(...) __VA_ARGS__ # define ICE_EXCEPTION_ISSET(T) T -# define ICE_RETHROW_EXCEPTION(T) ::std::rethrow_exception(T) +# define ICE_RETHROW_EXCEPTION(T) T->ice_throw() # define ICE_RESET_EXCEPTION(T, V) T = V #else // C++98 mapping # define ICE_HANDLE ::IceUtil::Handle @@ -394,7 +394,7 @@ typedef long long Int64; # define ICE_CLOSE_CALLBACK ::Ice::CloseCallbackPtr # define ICE_HEARTBEAT_CALLBACK ::Ice::HeartbeatCallbackPtr # define ICE_IN(...) const __VA_ARGS__& -# define ICE_EXCEPTION_ISSET(T) (T.get() != 0) +# define ICE_EXCEPTION_ISSET(T) T # define ICE_RETHROW_EXCEPTION(T) T->ice_throw() # define ICE_RESET_EXCEPTION(T,V) T.reset(V) #endif diff --git a/cpp/include/IceUtil/CtrlCHandler.h b/cpp/include/IceUtil/CtrlCHandler.h index e5692d96990..0659033303a 100644 --- a/cpp/include/IceUtil/CtrlCHandler.h +++ b/cpp/include/IceUtil/CtrlCHandler.h @@ -55,16 +55,16 @@ public: CtrlCHandlerCallback getCallback() const; }; -class ICE_API CtrlCHandlerException : public Exception +class ICE_API CtrlCHandlerException : public ExceptionHelper<CtrlCHandlerException> { public: CtrlCHandlerException(const char*, int); virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual CtrlCHandlerException* ice_clone() const; #endif - virtual void ice_throw() const; }; } diff --git a/cpp/include/IceUtil/Exception.h b/cpp/include/IceUtil/Exception.h index 2e9dd34af3f..e7e6a21a52f 100644 --- a/cpp/include/IceUtil/Exception.h +++ b/cpp/include/IceUtil/Exception.h @@ -25,13 +25,13 @@ public: Exception(); Exception(const char*, int); #ifndef ICE_CPP11_COMPILER - virtual ~Exception() throw(); + virtual ~Exception() throw() = 0; #endif virtual std::string ice_id() const = 0; virtual void ice_print(std::ostream&) const; virtual const char* what() const ICE_NOEXCEPT; #ifdef ICE_CPP11_MAPPING - std::exception_ptr ice_clone() const; + std::unique_ptr<Exception> ice_clone() const; #else virtual Exception* ice_clone() const = 0; ICE_DEPRECATED_API("ice_name() is deprecated, use ice_id() instead.") @@ -43,6 +43,12 @@ public: int ice_line() const; std::string ice_stackTrace() const; +protected: + +#ifdef ICE_CPP11_MAPPING + virtual Exception* ice_cloneImpl() const = 0; +#endif + private: const char* _file; @@ -53,36 +59,87 @@ private: ICE_API std::ostream& operator<<(std::ostream&, const Exception&); -class ICE_API NullHandleException : public Exception + +#ifdef ICE_CPP11_MAPPING + +template<typename E, typename B = Exception> +class ExceptionHelper : public B { public: - NullHandleException(const char*, int); -#ifndef ICE_CPP11_COMPILER - virtual ~NullHandleException() throw(); + using B::B; + + std::unique_ptr<E> ice_clone() const + { + return std::unique_ptr<E>(static_cast<E*>(ice_cloneImpl())); + } + + virtual void ice_throw() const override + { + throw static_cast<const E&>(*this); + } + +protected: + + virtual Exception* ice_cloneImpl() const override + { + return new E(static_cast<const E&>(*this)); + } +}; + +#else // C++98 mapping + +template<typename E> +class ExceptionHelper : public Exception +{ +public: + + ExceptionHelper() + { + } + + ExceptionHelper(const char* file, int line) : Exception(file, line) + { + } + + virtual void ice_throw() const + { + throw static_cast<const E&>(*this); + } +}; + #endif + + +class ICE_API NullHandleException : public ExceptionHelper<NullHandleException> +{ +public: + + NullHandleException(const char*, int); virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual NullHandleException* ice_clone() const; #endif - virtual void ice_throw() const; }; -class ICE_API IllegalArgumentException : public Exception +class ICE_API IllegalArgumentException : public ExceptionHelper<IllegalArgumentException> { public: IllegalArgumentException(const char*, int); IllegalArgumentException(const char*, int, const std::string&); + #ifndef ICE_CPP11_COMPILER virtual ~IllegalArgumentException() throw(); #endif + virtual std::string ice_id() const; virtual void ice_print(std::ostream&) const; + #ifndef ICE_CPP11_MAPPING virtual IllegalArgumentException* ice_clone() const; #endif - virtual void ice_throw() const; std::string reason() const; @@ -94,40 +151,48 @@ private: // // IllegalConversionException is raised to report a string conversion error // -class ICE_API IllegalConversionException : public Exception +class ICE_API IllegalConversionException : public ExceptionHelper<IllegalConversionException> { public: IllegalConversionException(const char*, int); IllegalConversionException(const char*, int, const std::string&); + #ifndef ICE_CPP11_COMPILER virtual ~IllegalConversionException() throw(); #endif + virtual std::string ice_id() const; virtual void ice_print(std::ostream&) const; + #ifndef ICE_CPP11_MAPPING virtual IllegalConversionException* ice_clone() const; #endif - virtual void ice_throw() const; std::string reason() const; + private: const std::string _reason; }; -class ICE_API SyscallException : public Exception +class ICE_API SyscallException : public ExceptionHelper<SyscallException> { public: SyscallException(const char*, int, int); + +#ifndef ICE_CPP11_COMPILER + virtual ~SyscallException() throw(); +#endif + virtual std::string ice_id() const; virtual void ice_print(std::ostream&) const; + #ifndef ICE_CPP11_MAPPING virtual SyscallException* ice_clone() const; #endif - virtual void ice_throw() const; int error() const; @@ -136,20 +201,49 @@ private: const int _error; }; -class ICE_API FileLockException : public Exception + +#ifdef ICE_CPP11_MAPPING + +template<typename E> +using SyscallExceptionHelper = ExceptionHelper<E, SyscallException>; + +#else // C++98 mapping + +template<typename E> +class SyscallExceptionHelper : public SyscallException +{ +public: + + SyscallExceptionHelper(const char* file, int line, int errorCode) : + SyscallException(file, line, errorCode) + { + } + + virtual void ice_throw() const + { + throw static_cast<const E&>(*this); + } +}; + +#endif + + +class ICE_API FileLockException : public ExceptionHelper<FileLockException> { public: FileLockException(const char*, int, int, const std::string&); + #ifndef ICE_CPP11_COMPILER virtual ~FileLockException() throw(); #endif + virtual std::string ice_id() const; virtual void ice_print(std::ostream&) const; + #ifndef ICE_CPP11_MAPPING virtual FileLockException* ice_clone() const; #endif - virtual void ice_throw() const; std::string path() const; int error() const; @@ -160,36 +254,35 @@ private: std::string _path; }; -class ICE_API OptionalNotSetException : public Exception +class ICE_API OptionalNotSetException : public ExceptionHelper<OptionalNotSetException> { public: OptionalNotSetException(const char*, int); -#ifndef ICE_CPP11_COMPILER - virtual ~OptionalNotSetException() throw(); -#endif virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual OptionalNotSetException* ice_clone() const; #endif - virtual void ice_throw() const; }; #ifndef _WIN32 -class ICE_API IconvInitializationException : public Exception +class ICE_API IconvInitializationException : public ExceptionHelper<IconvInitializationException> { public: IconvInitializationException(const char*, int, const std::string&); + #ifndef ICE_CPP11_COMPILER virtual ~IconvInitializationException() throw(); #endif + virtual std::string ice_id() const; virtual void ice_print(std::ostream&) const; + #ifndef ICE_CPP11_MAPPING virtual IconvInitializationException* ice_clone() const; #endif - virtual void ice_throw() const; std::string reason() const; diff --git a/cpp/include/IceUtil/Options.h b/cpp/include/IceUtil/Options.h index 63301165295..ffae862f88b 100644 --- a/cpp/include/IceUtil/Options.h +++ b/cpp/include/IceUtil/Options.h @@ -22,7 +22,7 @@ namespace IceUtilInternal { -class ICE_API APIException : public IceUtil::Exception +class ICE_API APIException : public IceUtil::ExceptionHelper<APIException> { public: @@ -35,14 +35,13 @@ public: #ifndef ICE_CPP11_MAPPING virtual APIException* ice_clone() const; #endif - virtual void ice_throw() const; ::std::string reason; }; ICE_API ::std::ostream& operator<<(::std::ostream&, const APIException&); -class ICE_API BadOptException : public IceUtil::Exception +class ICE_API BadOptException : public IceUtil::ExceptionHelper<BadOptException> { public: @@ -52,10 +51,10 @@ public: #endif virtual ::std::string ice_id() const; virtual void ice_print(std::ostream&) const; + #ifndef ICE_CPP11_MAPPING virtual BadOptException* ice_clone() const; #endif - virtual void ice_throw() const; ::std::string reason; }; diff --git a/cpp/include/IceUtil/ThreadException.h b/cpp/include/IceUtil/ThreadException.h index 8f380206d5c..2e0756938eb 100644 --- a/cpp/include/IceUtil/ThreadException.h +++ b/cpp/include/IceUtil/ThreadException.h @@ -16,77 +16,78 @@ namespace IceUtil { -class ICE_API ThreadSyscallException : public SyscallException +class ICE_API ThreadSyscallException : public SyscallExceptionHelper<ThreadSyscallException> { public: ThreadSyscallException(const char*, int, int); virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual ThreadSyscallException* ice_clone() const; #endif - virtual void ice_throw() const; }; -class ICE_API ThreadLockedException : public Exception +class ICE_API ThreadLockedException : public ExceptionHelper<ThreadLockedException> { public: ThreadLockedException(const char*, int); virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual ThreadLockedException* ice_clone() const; #endif - virtual void ice_throw() const; }; -class ICE_API ThreadStartedException : public Exception +class ICE_API ThreadStartedException : public ExceptionHelper<ThreadStartedException> { public: ThreadStartedException(const char*, int); virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual ThreadStartedException* ice_clone() const; #endif - virtual void ice_throw() const; + }; -class ICE_API ThreadNotStartedException : public Exception +class ICE_API ThreadNotStartedException : public ExceptionHelper<ThreadNotStartedException> { public: ThreadNotStartedException(const char*, int); virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual ThreadNotStartedException* ice_clone() const; #endif - virtual void ice_throw() const; }; -class ICE_API BadThreadControlException : public Exception +class ICE_API BadThreadControlException : public ExceptionHelper<BadThreadControlException> { public: BadThreadControlException(const char*, int); virtual std::string ice_id() const; + #ifndef ICE_CPP11_MAPPING virtual BadThreadControlException* ice_clone() const; #endif - virtual void ice_throw() const; }; -class ICE_API InvalidTimeoutException : public Exception +class ICE_API InvalidTimeoutException : public ExceptionHelper<InvalidTimeoutException> { public: InvalidTimeoutException(const char*, int, const Time&); virtual std::string ice_id() const; virtual void ice_print(std::ostream&) const; + #ifndef ICE_CPP11_MAPPING virtual InvalidTimeoutException* ice_clone() const; #endif - virtual void ice_throw() const; private: diff --git a/cpp/include/IceUtil/UniquePtr.h b/cpp/include/IceUtil/UniquePtr.h index e58f32fd608..0a81df47fad 100644 --- a/cpp/include/IceUtil/UniquePtr.h +++ b/cpp/include/IceUtil/UniquePtr.h @@ -15,11 +15,12 @@ namespace IceUtil { -// -// This is temporary and very partial placeholder for std::unique_ptr, -// which is not yet widely available. -// +#ifdef ICE_CPP11_MAPPING +template<typename T> +using UniquePtr = std::unique_ptr<T>; + +#else template<typename T> class UniquePtr @@ -84,6 +85,11 @@ public: return _ptr; } + operator bool() const + { + return _ptr != 0; + } + void swap(UniquePtr& a) { T* tmp = a._ptr; @@ -96,6 +102,8 @@ private: T* _ptr; }; +#endif + } // End of namespace IceUtil #endif |