Qpid .NET Messaging API  0.24
 All Classes Namespaces Files Functions Variables Typedefs
QpidTypeCheck.h
Go to the documentation of this file.
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 #pragma once
20 
21 #include <windows.h>
22 #include <msclr\lock.h>
23 #include <oletx2xa.h>
24 #include <string>
25 #include <limits>
26 
27 namespace Org {
28 namespace Apache {
29 namespace Qpid {
30 namespace Messaging {
31 
36  // The supported mapping is:
40 
41  typedef System::Collections::Generic::Dictionary<
42  System::String^,
43  System::Object^>
45 
46  typedef System::Collections::ObjectModel::Collection<
47  System::Object^>
49 
50  private ref class QpidTypeCheckConstants sealed
51  {
52  private:
53  QpidTypeCheckConstants::QpidTypeCheckConstants() {}
54 
55  public:
56  static System::Type const ^ const mapTypeP = System::Type::GetType(
57  "System.Collections.Generic.Dictionary`2[System.String,System.Object]");
58  static System::Type const ^ const listTypeP = System::Type::GetType(
59  "System.Collections.ObjectModel.Collection`1[System.Object]");
60  };
61 
62 
63  public ref class QpidTypeCheck sealed
64  {
65  private:
66  QpidTypeCheck::QpidTypeCheck() {}
67 
68  public:
69 
70  static bool ObjectIsMap (System::Object ^ theValue)
71  {
72  if (nullptr == theValue)
73  return false;
74  else
75  return (*theValue).GetType() == QpidTypeCheckConstants::mapTypeP;
76  }
77 
78  static bool ObjectIsList(System::Object ^ theValue)
79  {
80  if (nullptr == theValue)
81  return false;
82  else
83  return (*theValue).GetType() == QpidTypeCheckConstants::listTypeP;
84  }
85  };
86 }}}}