From aba5b6b5ec8afab62f670a540a4ca2d61b76dc22 Mon Sep 17 00:00:00 2001 From: "Charles E. Rolke" Date: Thu, 7 Apr 2011 20:40:10 +0000 Subject: QPID-3192 .NET Binding for Messaging classes are missing intrinsic copy constructors. The existing 'T(const T ^)' constructor is useful for C# code but fails for Cpp/clr. This commit adds the 'T(const T %)' intrinsic copy constructor for Cpp/clr. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1089995 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/bindings/qpid/dotnet/src/Connection.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'cpp/bindings/qpid/dotnet/src/Connection.cpp') diff --git a/cpp/bindings/qpid/dotnet/src/Connection.cpp b/cpp/bindings/qpid/dotnet/src/Connection.cpp index 69ace7db52..12c0e29f74 100644 --- a/cpp/bindings/qpid/dotnet/src/Connection.cpp +++ b/cpp/bindings/qpid/dotnet/src/Connection.cpp @@ -114,7 +114,7 @@ namespace Messaging { } - // Copy constructor + // Copy constructor look-alike (C#) Connection::Connection(const Connection ^ connection) { System::Exception ^ newException = nullptr; @@ -136,6 +136,28 @@ namespace Messaging { } } + // Copy constructor implicitly dereferenced (C++) + Connection::Connection(const Connection % connection) + { + System::Exception ^ newException = nullptr; + + try + { + connectionp = new ::qpid::messaging::Connection( + *(const_cast(connection).NativeConnection)); + } + catch (const ::qpid::types::Exception & error) + { + String ^ errmsg = gcnew String(error.what()); + newException = gcnew QpidException(errmsg); + } + + if (newException != nullptr) + { + throw newException; + } + } + // Destructor Connection::~Connection() -- cgit v1.2.1