From 30004443d55d6597f9695bfcf54a6771bc296501 Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Wed, 13 Jul 2016 12:06:46 -0400 Subject: Various C++ cleanups --- cpp/src/Ice/ACMF.h | 35 +++++++++++++++++++++++++++++++++++ cpp/src/Ice/ConnectRequestHandlerF.h | 4 ++-- cpp/src/Ice/ConnectionFactoryF.h | 35 +++++++++++++++++++++++++++++++++++ cpp/src/Ice/ConnectionI.h | 2 +- cpp/src/Ice/EndpointIF.h | 10 +++++----- cpp/src/Ice/EventHandlerF.h | 2 +- cpp/src/Ice/IPEndpointIF.h | 2 +- cpp/src/Ice/ObjectAdapterFactoryF.h | 30 ++++++++++++++++++++++++++++++ cpp/src/Ice/SlicedData.cpp | 23 +++++++++++++++++++++++ cpp/src/Ice/TraceLevels.cpp | 2 +- cpp/src/Ice/TraceLevelsF.h | 2 +- cpp/src/slice2cpp/Gen.cpp | 17 ----------------- 12 files changed, 135 insertions(+), 29 deletions(-) create mode 100644 cpp/src/Ice/ACMF.h create mode 100644 cpp/src/Ice/ConnectionFactoryF.h create mode 100644 cpp/src/Ice/ObjectAdapterFactoryF.h (limited to 'cpp/src') diff --git a/cpp/src/Ice/ACMF.h b/cpp/src/Ice/ACMF.h new file mode 100644 index 00000000000..9f7f17d26fa --- /dev/null +++ b/cpp/src/Ice/ACMF.h @@ -0,0 +1,35 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef ICE_ACM_F_H +#define ICE_ACM_F_H + +#include +#include + +namespace IceInternal +{ + +class ACMMonitor; +class FactoryACMMonitor; + +#ifdef ICE_CPP11_MAPPING +using ACMMonitorPtr = ::std::shared_ptr; +using FactoryACMMonitorPtr = ::std::shared_ptr; +#else +IceUtil::Shared* upCast(ACMMonitor*); +typedef IceInternal::Handle ACMMonitorPtr; + +IceUtil::Shared* upCast(FactoryACMMonitor*); +typedef IceInternal::Handle FactoryACMMonitorPtr; +#endif + +} + +#endif diff --git a/cpp/src/Ice/ConnectRequestHandlerF.h b/cpp/src/Ice/ConnectRequestHandlerF.h index 3ed40897176..974ca6f05fc 100644 --- a/cpp/src/Ice/ConnectRequestHandlerF.h +++ b/cpp/src/Ice/ConnectRequestHandlerF.h @@ -18,9 +18,9 @@ namespace IceInternal class ConnectRequestHandler; #ifdef ICE_CPP11_MAPPING -typedef ::std::shared_ptr ConnectRequestHandlerPtr; +using ConnectRequestHandlerPtr = ::std::shared_ptr; #else -ICE_API IceUtil::Shared* upCast(ConnectRequestHandler*); +IceUtil::Shared* upCast(ConnectRequestHandler*); typedef IceInternal::Handle ConnectRequestHandlerPtr; #endif diff --git a/cpp/src/Ice/ConnectionFactoryF.h b/cpp/src/Ice/ConnectionFactoryF.h new file mode 100644 index 00000000000..033d61b9761 --- /dev/null +++ b/cpp/src/Ice/ConnectionFactoryF.h @@ -0,0 +1,35 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef ICE_CONNECTION_FACTORY_F_H +#define ICE_CONNECTION_FACTORY_F_H + +#include + +#include + +namespace IceInternal +{ + +class OutgoingConnectionFactory; +IceUtil::Shared* upCast(OutgoingConnectionFactory*); +typedef IceInternal::Handle OutgoingConnectionFactoryPtr; + +class IncomingConnectionFactory; + +#ifdef ICE_CPP11_MAPPING +using IncomingConnectionFactoryPtr = ::std::shared_ptr; +#else +IceUtil::Shared* upCast(IncomingConnectionFactory*); +typedef IceInternal::Handle IncomingConnectionFactoryPtr; +#endif + +} + +#endif diff --git a/cpp/src/Ice/ConnectionI.h b/cpp/src/Ice/ConnectionI.h index d10213fa5c4..023ac044e5b 100644 --- a/cpp/src/Ice/ConnectionI.h +++ b/cpp/src/Ice/ConnectionI.h @@ -147,7 +147,7 @@ public: virtual void connectionStartCompleted(const ConnectionIPtr&) = 0; virtual void connectionStartFailed(const ConnectionIPtr&, const Ice::LocalException&) = 0; }; - typedef ::std::shared_ptr StartCallbackPtr; + using StartCallbackPtr = ::std::shared_ptr; #else class StartCallback : public virtual IceUtil::Shared { diff --git a/cpp/src/Ice/EndpointIF.h b/cpp/src/Ice/EndpointIF.h index c3a4c767772..55449a594d4 100644 --- a/cpp/src/Ice/EndpointIF.h +++ b/cpp/src/Ice/EndpointIF.h @@ -24,11 +24,11 @@ class EndpointI_connectors; #ifdef ICE_CPP11_MAPPING // C++11 mapping -typedef ::std::shared_ptr EndpointIPtr; -typedef ::std::shared_ptr TcpEndpointIPtr; -typedef ::std::shared_ptr UdpEndpointIPtr; -typedef ::std::shared_ptr WSEndpointPtr; -typedef ::std::shared_ptr EndpointI_connectorsPtr; +using EndpointIPtr = ::std::shared_ptr; +using TcpEndpointIPtr = ::std::shared_ptr; +using UdpEndpointIPtr = ::std::shared_ptr; +using WSEndpointPtr = ::std::shared_ptr; +using EndpointI_connectorsPtr = ::std::shared_ptr; #else // C++98 mapping diff --git a/cpp/src/Ice/EventHandlerF.h b/cpp/src/Ice/EventHandlerF.h index 722329efa73..750efeec97a 100644 --- a/cpp/src/Ice/EventHandlerF.h +++ b/cpp/src/Ice/EventHandlerF.h @@ -19,7 +19,7 @@ namespace IceInternal class EventHandler; #ifdef ICE_CPP11_MAPPING -typedef ::std::shared_ptr EventHandlerPtr; +using EventHandlerPtr = ::std::shared_ptr; #else ICE_API IceUtil::Shared* upCast(EventHandler*); typedef Handle EventHandlerPtr; diff --git a/cpp/src/Ice/IPEndpointIF.h b/cpp/src/Ice/IPEndpointIF.h index bc8513b4bd4..4a346f5b545 100644 --- a/cpp/src/Ice/IPEndpointIF.h +++ b/cpp/src/Ice/IPEndpointIF.h @@ -19,7 +19,7 @@ namespace IceInternal class IPEndpointI; #ifdef ICE_CPP11_MAPPING -typedef ::std::shared_ptr IPEndpointIPtr; +using IPEndpointIPtr = ::std::shared_ptr; #else ICE_API IceUtil::Shared* upCast(IPEndpointI*); typedef Handle IPEndpointIPtr; diff --git a/cpp/src/Ice/ObjectAdapterFactoryF.h b/cpp/src/Ice/ObjectAdapterFactoryF.h new file mode 100644 index 00000000000..ab292e47d51 --- /dev/null +++ b/cpp/src/Ice/ObjectAdapterFactoryF.h @@ -0,0 +1,30 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef ICE_OBJECT_ADAPTER_FACTORY_F_H +#define ICE_OBJECT_ADAPTER_FACTORY_F_H + +#include + +#include + +namespace IceInternal +{ + +class ObjectAdapterFactory; +#ifdef ICE_CPP11_MAPPING +using ObjectAdapterFactoryPtr = ::std::shared_ptr; +#else +IceUtil::Shared* upCast(ObjectAdapterFactory*); +typedef IceInternal::Handle ObjectAdapterFactoryPtr; +#endif + +} + +#endif diff --git a/cpp/src/Ice/SlicedData.cpp b/cpp/src/Ice/SlicedData.cpp index ca2b28e5cef..6a433ffbe4d 100644 --- a/cpp/src/Ice/SlicedData.cpp +++ b/cpp/src/Ice/SlicedData.cpp @@ -58,6 +58,7 @@ Ice::UnknownSlicedValue::__gcVisitMembers(IceInternal::GCVisitor& _v) _slicedData->__gcVisitMembers(_v); } } + #endif Ice::UnknownSlicedValue::UnknownSlicedValue(const string& unknownTypeId) : _unknownTypeId(unknownTypeId) @@ -89,3 +90,25 @@ Ice::UnknownSlicedValue::__read(Ice::InputStream* __is) __is->startValue(); _slicedData = __is->endValue(true); } + +#ifdef ICE_CPP11_MAPPING + +string +Ice::UnknownSlicedValue::ice_id() const +{ + return _unknownTypeId; +} + +shared_ptr +Ice::UnknownSlicedValue::ice_clone() const +{ + return static_pointer_cast(cloneImpl()); +} + +shared_ptr +Ice::UnknownSlicedValue::cloneImpl() const +{ + return make_shared(static_cast(*this)); +} + +#endif diff --git a/cpp/src/Ice/TraceLevels.cpp b/cpp/src/Ice/TraceLevels.cpp index 09de5048d00..dcdc5f7afb3 100644 --- a/cpp/src/Ice/TraceLevels.cpp +++ b/cpp/src/Ice/TraceLevels.cpp @@ -14,7 +14,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -ICE_API IceUtil::Shared* IceInternal::upCast(TraceLevels* p) { return p; } +IceUtil::Shared* IceInternal::upCast(TraceLevels* p) { return p; } IceInternal::TraceLevels::TraceLevels(const PropertiesPtr& properties) : network(0), diff --git a/cpp/src/Ice/TraceLevelsF.h b/cpp/src/Ice/TraceLevelsF.h index 52bd4e77c71..a2012c702ba 100644 --- a/cpp/src/Ice/TraceLevelsF.h +++ b/cpp/src/Ice/TraceLevelsF.h @@ -18,7 +18,7 @@ namespace IceInternal { class TraceLevels; -ICE_API IceUtil::Shared* upCast(TraceLevels*); +IceUtil::Shared* upCast(TraceLevels*); typedef Handle TraceLevelsPtr; } diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index e7fe5c368bb..f0e3453e41a 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -6716,14 +6716,6 @@ Slice::Gen::Cpp11LocalObjectVisitor::visitClassDefStart(const ClassDefPtr& p) H << nl << "public:" << sp; H.inc(); - // - // In C++, a nested type cannot have the same name as the enclosing type - // - if(p->name() != "PointerType") - { - H << nl << "using PointerType = ::std::shared_ptr<" << name << ">;"; - } - // // Out of line virtual dtor to avoid weak vtable // @@ -7614,15 +7606,6 @@ Slice::Gen::Cpp11ValueVisitor::visitClassDefStart(const ClassDefPtr& p) H << nl << "public:" << sp; H.inc(); - // - // In C++, a nested type cannot have the same name as the enclosing type - // - - if(p->name() != "PointerType") - { - H << nl << "using PointerType = ::std::shared_ptr<" << name << ">;"; - } - // Out of line dtor to avoid weak vtable H << sp; H << nl << _dllMemberExport << "virtual ~" << name << "();"; -- cgit v1.2.3