From 8faa1d55ca1507ae4913e5476f21fbcd83e70bfe Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Thu, 24 Jun 2010 12:40:11 +0000 Subject: QPID-2589 - Patch from Chuck Rolke Visual Basic example added, UUID support added, C# Hello World example added. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@957531 13f79535-47bb-0310-9956-ffa450edef68 --- .../Properties/AssemblyInfo.cs | 36 ++++++ .../csharp.example.helloworld.cs | 55 +++++++++ .../csharp.example.helloworld.csproj | 81 +++++++++++++ .../csharp.map.callback.sender.cs | 3 + .../csharp.map.sender/csharp.map.sender.cs | 3 + .../My Project/Application.Designer.vb | 13 ++ .../My Project/Application.myapp | 10 ++ .../My Project/AssemblyInfo.vb | 35 ++++++ .../My Project/Resources.Designer.vb | 63 ++++++++++ .../My Project/Resources.resx | 117 ++++++++++++++++++ .../My Project/Settings.Designer.vb | 73 +++++++++++ .../My Project/Settings.settings | 7 ++ .../visualbasic.example.client.vb | 69 +++++++++++ .../visualbasic.example.client.vbproj | 134 +++++++++++++++++++++ .../qpid/dotnet/org.apache.qpid.messaging.sln | 37 ++++++ cpp/bindings/qpid/dotnet/src/TypeTranslator.cpp | 30 ++++- .../dotnet/test/messaging.test/messaging.test.cs | 14 +++ 17 files changed, 779 insertions(+), 1 deletion(-) create mode 100644 cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/Properties/AssemblyInfo.cs create mode 100644 cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.cs create mode 100644 cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.csproj create mode 100644 cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Application.Designer.vb create mode 100644 cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Application.myapp create mode 100644 cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/AssemblyInfo.vb create mode 100644 cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Resources.Designer.vb create mode 100644 cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Resources.resx create mode 100644 cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Settings.Designer.vb create mode 100644 cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Settings.settings create mode 100644 cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/visualbasic.example.client.vb create mode 100644 cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/visualbasic.example.client.vbproj (limited to 'cpp') diff --git a/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/Properties/AssemblyInfo.cs b/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..2b96ce9122 --- /dev/null +++ b/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("csharp.direct.sender")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("csharp.direct.sender")] +[assembly: AssemblyCopyright("Copyright ? 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("19ce67e4-db90-4480-88c4-3721f47634c7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.cs b/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.cs new file mode 100644 index 0000000000..336970a3ba --- /dev/null +++ b/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.cs @@ -0,0 +1,55 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System; +using Org.Apache.Qpid.Messaging; + +namespace Org.Apache.Qpid.Messaging { + class Program { + static void Main(string[] args) { + String broker = args.Length > 0 ? args[0] : "localhost:5672"; + String address = args.Length > 1 ? args[1] : "amq.topic"; + + Connection connection = null; + try { + connection = new Connection(broker); + connection.Open(); + Session session = connection.CreateSession(); + + Receiver receiver = session.CreateReceiver(address); + Sender sender = session.CreateSender(address); + + sender.Send(new Message("Hello world!")); + + Message message = new Message(); + message = receiver.Fetch(DurationConstants.SECOND * 1); + Console.WriteLine("{0}", message.GetContent()); + session.Acknowledge(); + + connection.Close(); + } catch (Exception e) { + Console.WriteLine("Exception {0}.", e); + if (null != connection) + connection.Close(); + } + } + } +} diff --git a/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.csproj b/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.csproj new file mode 100644 index 0000000000..3038ed64a3 --- /dev/null +++ b/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.csproj @@ -0,0 +1,81 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {8CC1C265-0507-44A3-9483-8FAF48513F4D} + Exe + Properties + csharp.example.helloworld + csharp.example.helloworld + v3.5 + 512 + + + true + full + false + ..\..\..\..\..\src\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\..\..\src\Release\ + TRACE + prompt + 4 + + + true + ..\..\..\..\..\src\Debug\ + DEBUG;TRACE + full + x86 + prompt + + + ..\..\..\..\..\src\Release\ + TRACE + true + pdbonly + x86 + prompt + + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + {AA5A3B83-5F98-406D-A01C-5A921467A57D} + Org.Apache.Qpid.Messaging + + + + + diff --git a/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.sender/csharp.map.callback.sender.cs b/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.sender/csharp.map.callback.sender.cs index 2b17052b3e..c987ad9a53 100644 --- a/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.sender/csharp.map.callback.sender.cs +++ b/cpp/bindings/qpid/dotnet/examples/csharp.map.callback.sender/csharp.map.callback.sender.cs @@ -150,6 +150,9 @@ namespace Org.Apache.Qpid.Messaging.Examples Double myDouble = 13.13; content["myDouble"] = myDouble; + Guid myGuid = new Guid("000102030405060708090a0b0c0d0e0f"); + content["myGuid"] = myGuid; + // // Construct a message with the map content and send it synchronously // via the sender. diff --git a/cpp/bindings/qpid/dotnet/examples/csharp.map.sender/csharp.map.sender.cs b/cpp/bindings/qpid/dotnet/examples/csharp.map.sender/csharp.map.sender.cs index 55172262fe..0763b7455e 100644 --- a/cpp/bindings/qpid/dotnet/examples/csharp.map.sender/csharp.map.sender.cs +++ b/cpp/bindings/qpid/dotnet/examples/csharp.map.sender/csharp.map.sender.cs @@ -113,6 +113,9 @@ namespace Org.Apache.Qpid.Messaging.examples Double myDouble = 13.13; content["myDouble"] = myDouble; + Guid myGuid = new Guid("000102030405060708090a0b0c0d0e0f"); + content["myGuid"] = myGuid; + // // Construct a message with the map content and send it synchronously // via the sender. diff --git a/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Application.Designer.vb b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Application.Designer.vb new file mode 100644 index 0000000000..0c274140df --- /dev/null +++ b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Application.Designer.vb @@ -0,0 +1,13 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:2.0.50727.4927 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Application.myapp b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Application.myapp new file mode 100644 index 0000000000..44772fed09 --- /dev/null +++ b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + false + false + 0 + true + 0 + 2 + true + diff --git a/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/AssemblyInfo.vb b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/AssemblyInfo.vb new file mode 100644 index 0000000000..100283cf2e --- /dev/null +++ b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/AssemblyInfo.vb @@ -0,0 +1,35 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Resources.Designer.vb b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Resources.Designer.vb new file mode 100644 index 0000000000..19d7b32c32 --- /dev/null +++ b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Resources.Designer.vb @@ -0,0 +1,63 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:2.0.50727.4927 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Imports System + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Org.Apache.Qpid.Messaging.Examples.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Resources.resx b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Resources.resx new file mode 100644 index 0000000000..3a752df8c0 --- /dev/null +++ b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Settings.Designer.vb b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Settings.Designer.vb new file mode 100644 index 0000000000..fd9a759e2b --- /dev/null +++ b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:2.0.50727.4927 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.Org.Apache.Qpid.Messaging.Examples.My.MySettings + Get + Return Global.Org.Apache.Qpid.Messaging.Examples.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Settings.settings b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Settings.settings new file mode 100644 index 0000000000..73b4a101e7 --- /dev/null +++ b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/visualbasic.example.client.vb b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/visualbasic.example.client.vb new file mode 100644 index 0000000000..96300ecf66 --- /dev/null +++ b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/visualbasic.example.client.vb @@ -0,0 +1,69 @@ +' +' +' Licensed to the Apache Software Foundation (ASF) under one +' or more contributor license agreements. See the NOTICE file +' distributed with this work for additional information +' regarding copyright ownership. The ASF licenses this file +' to you under the Apache License, Version 2.0 (the +' "License"); you may not use this file except in compliance +' with the License. You may obtain a copy of the License at +' +' http://www.apache.org/licenses/LICENSE-2.0 +' +' Unless required by applicable law or agreed to in writing, +' software distributed under the License is distributed on an +' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +' KIND, either express or implied. See the License for the +' specific language governing permissions and limitations +' under the License. +' +' + +Imports System +Imports Org.Apache.Qpid.Messaging +Namespace Org.Apache.Qpid.Messaging.Examples + Module Module1 + Class Client + Public Shared Sub Main(ByVal args() As String) + Dim url As String = "amqp:tcp:127.0.0.1:5672" + + If args.Length > 0 Then url = args(0) + + Dim connection As Connection + Try + connection = New Connection(url) + connection.Open() + + Dim session As Session = connection.CreateSession() + + Dim sender As Sender = session.CreateSender("service_queue") + + Dim responseQueue As Address = New Address("#response-queue; {create:always, delete:always}") + Dim receiver As Receiver = session.CreateReceiver(responseQueue) + + Dim s(3) As String + s(0) = "Twas brillig, and the slithy toves" + s(1) = "Did gire and gymble in the wabe." + s(2) = "All mimsy were the borogroves," + s(3) = "And the mome raths outgrabe." + + Dim request As Message = New Message("") + request.SetReplyTo(responseQueue) + + Dim i As Integer + For i = 0 To s.Length - 1 + request.SetContent(s(i)) + sender.Send(request) + Dim response As Message = receiver.Fetch() + Console.WriteLine("{0} -> {1}", request.GetContent(), response.GetContent()) + Next i + connection.Close() + + Catch e As Exception + Console.WriteLine("Exception {0}.", e) + connection.Close() + End Try + End Sub + End Class + End Module +End Namespace diff --git a/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/visualbasic.example.client.vbproj b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/visualbasic.example.client.vbproj new file mode 100644 index 0000000000..a7e747a5a9 --- /dev/null +++ b/cpp/bindings/qpid/dotnet/examples/visualbasic.example.client/visualbasic.example.client.vbproj @@ -0,0 +1,134 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {CFEA696E-115B-4AD1-AB56-804E360EDD51} + Exe + Sub Main + Org.Apache.Qpid.Messaging.Examples + visualbasic.example.client + 512 + Console + v3.5 + On + Binary + Off + On + + + true + full + true + true + ..\..\..\..\..\src\Debug\ + visualbasic.example.client.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + pdbonly + false + true + true + bin\Release\ + visualbasic.example.client.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + true + true + true + ..\..\..\..\..\src\Debug\ + visualbasic.example.client.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + full + x86 + + + true + bin\x86\Release\ + visualbasic.example.client.xml + true + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + pdbonly + x86 + + + + + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + + + + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + {AA5A3B83-5F98-406D-A01C-5A921467A57D} + Org.Apache.Qpid.Messaging + + + + + diff --git a/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sln b/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sln index 7269dad1f6..8df1ea6796 100644 --- a/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sln +++ b/cpp/bindings/qpid/dotnet/org.apache.qpid.messaging.sln @@ -57,6 +57,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.example.spout", "exa EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.example.declare_queues", "examples\csharp.example.declare_queues\csharp.example.declare_queues.csproj", "{E31B349C-830C-4583-8BD9-30DA4398349F}" EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "visualbasic.example.client", "examples\visualbasic.example.client\visualbasic.example.client.vbproj", "{CFEA696E-115B-4AD1-AB56-804E360EDD51}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Hello World", "Hello World", "{4408A2DA-ED2D-44AE-A465-0B6D75E1FF86}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp.example.helloworld", "examples\csharp.example.helloworld\csharp.example.helloworld.csproj", "{8CC1C265-0507-44A3-9483-8FAF48513F4D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -264,6 +270,34 @@ Global {E31B349C-830C-4583-8BD9-30DA4398349F}.Release|Win32.ActiveCfg = Release|x86 {E31B349C-830C-4583-8BD9-30DA4398349F}.Release|x86.ActiveCfg = Release|x86 {E31B349C-830C-4583-8BD9-30DA4398349F}.Release|x86.Build.0 = Release|x86 + {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Debug|Win32.ActiveCfg = Debug|x86 + {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Debug|x86.ActiveCfg = Debug|x86 + {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Debug|x86.Build.0 = Debug|x86 + {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Release|Any CPU.Build.0 = Release|Any CPU + {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Release|Mixed Platforms.Build.0 = Release|x86 + {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Release|Win32.ActiveCfg = Release|x86 + {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Release|x86.ActiveCfg = Release|x86 + {CFEA696E-115B-4AD1-AB56-804E360EDD51}.Release|x86.Build.0 = Release|x86 + {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|Win32.ActiveCfg = Debug|x86 + {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|x86.ActiveCfg = Debug|x86 + {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Debug|x86.Build.0 = Debug|x86 + {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|Any CPU.Build.0 = Release|Any CPU + {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|Mixed Platforms.Build.0 = Release|x86 + {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|Win32.ActiveCfg = Release|x86 + {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|x86.ActiveCfg = Release|x86 + {8CC1C265-0507-44A3-9483-8FAF48513F4D}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -274,6 +308,7 @@ Global {E99FEFEE-B866-4BBA-9AA3-79DDF1C92960} = {34C477FB-B0CC-4AB9-A346-EA7B055469AC} {9232212E-F3C6-4D18-8D25-0C31DD5FF3DB} = {34C477FB-B0CC-4AB9-A346-EA7B055469AC} {89CE04CB-21DE-4ABB-9236-50529DD8C022} = {34C477FB-B0CC-4AB9-A346-EA7B055469AC} + {4408A2DA-ED2D-44AE-A465-0B6D75E1FF86} = {34C477FB-B0CC-4AB9-A346-EA7B055469AC} {7B71CE78-8E78-4632-ADBE-F4D5DFAE0068} = {DE58D329-10DC-4C8D-9EFA-230A57314089} {52F880E7-D677-4C91-8516-D679CE0F46A8} = {DE58D329-10DC-4C8D-9EFA-230A57314089} {AF2FBC78-266C-430C-BC29-9477AB596A36} = {39E9D1BF-3A0B-4D86-BF6B-F463E1A2245A} @@ -281,10 +316,12 @@ Global {AD9E53D7-DB10-4DA2-84D2-A81BE09B04E9} = {E99FEFEE-B866-4BBA-9AA3-79DDF1C92960} {68A43817-2358-4A31-8FDF-FE21722BFBCF} = {E99FEFEE-B866-4BBA-9AA3-79DDF1C92960} {12F1C14F-5C7D-4075-9BAE-C091394FF99A} = {E99FEFEE-B866-4BBA-9AA3-79DDF1C92960} + {CFEA696E-115B-4AD1-AB56-804E360EDD51} = {E99FEFEE-B866-4BBA-9AA3-79DDF1C92960} {0DE01712-C2D1-4CA4-B42C-5856456A8696} = {9232212E-F3C6-4D18-8D25-0C31DD5FF3DB} {090A081D-E8B5-4949-AA43-EE182B7101E3} = {9232212E-F3C6-4D18-8D25-0C31DD5FF3DB} {C43DEB69-8088-420B-B0CA-C699535E6D08} = {89CE04CB-21DE-4ABB-9236-50529DD8C022} {EB36626D-36C2-41B3-B65E-762BAF27F137} = {89CE04CB-21DE-4ABB-9236-50529DD8C022} {E31B349C-830C-4583-8BD9-30DA4398349F} = {89CE04CB-21DE-4ABB-9236-50529DD8C022} + {8CC1C265-0507-44A3-9483-8FAF48513F4D} = {4408A2DA-ED2D-44AE-A465-0B6D75E1FF86} EndGlobalSection EndGlobal diff --git a/cpp/bindings/qpid/dotnet/src/TypeTranslator.cpp b/cpp/bindings/qpid/dotnet/src/TypeTranslator.cpp index d463e668c3..c4587fe0f7 100644 --- a/cpp/bindings/qpid/dotnet/src/TypeTranslator.cpp +++ b/cpp/bindings/qpid/dotnet/src/TypeTranslator.cpp @@ -221,7 +221,25 @@ namespace Messaging { } break; - + case System::TypeCode::Object : + { + // + // Derived classes + // + if ("System.Guid" == typeP->ToString()) + { + cli::array ^ guidBytes = ((System::Guid)managedValue).ToByteArray(); + pin_ptr pinnedBuf = &guidBytes[0]; + ::qpid::types::Uuid newUuid = ::qpid::types::Uuid(pinnedBuf); + qpidVariant = newUuid; + } + else + { + throw gcnew System::NotImplementedException(); + } + } + break; + default: throw gcnew System::NotImplementedException(); @@ -318,6 +336,11 @@ namespace Messaging { } case ::qpid::types::VAR_UUID: + { + System::String ^ elementValue = gcnew System::String(variant.asUuid().str().c_str()); + System::Guid ^ newGuid = System::Guid(elementValue); + dict[elementName] = newGuid; + } break; } } @@ -406,6 +429,11 @@ namespace Messaging { } case ::qpid::types::VAR_UUID: + { + System::String ^ elementValue = gcnew System::String(variant.asUuid().str().c_str()); + System::Guid ^ newGuid = System::Guid(elementValue); + (*managedList).Add(newGuid); + } break; } } diff --git a/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.cs b/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.cs index 5763077637..2e0e481581 100644 --- a/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.cs +++ b/cpp/bindings/qpid/dotnet/test/messaging.test/messaging.test.cs @@ -114,6 +114,20 @@ namespace Org.Apache.Qpid.Messaging Console.Write("{0} ", rawDataReadback4[i].ToString()); Console.WriteLine(); + // + // Guid factoids + // + Guid myGuid = new Guid("000102030405060708090a0b0c0d0e0f"); + System.Type typeP = myGuid.GetType(); + System.TypeCode typeCode = System.Type.GetTypeCode(typeP); + + Console.WriteLine("Guid Type = {0}, TypeCode = {1}", + typeP.ToString(), typeCode.ToString()); + // typeP="System.Guid", typeCode="Object" + byte[] guidReadback; + guidReadback = myGuid.ToByteArray(); + + Console.WriteLine("GuidReadback len = {0}", guidReadback.Length); } } } -- cgit v1.2.1