VTK
vtkVariantCreate.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkVariantCreate.h
5 
6 -------------------------------------------------------------------------
7  Copyright 2008 Sandia Corporation.
8  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9  the U.S. Government retains certain rights in this software.
10 -------------------------------------------------------------------------
11 
12  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
13  All rights reserved.
14  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
15 
16  This software is distributed WITHOUT ANY WARRANTY; without even
17  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18  PURPOSE. See the above copyright notice for more information.
19 
20 =========================================================================*/
21 
32 #ifndef vtkVariantCreate_h
33 #define vtkVariantCreate_h
34 
35 #include <typeinfo> // for warnings
36 
37 template<typename T>
39 {
40  vtkGenericWarningMacro(
41  << "Cannot convert unsupported type [" << typeid(T).name() << "] to vtkVariant. "
42  << "Create a vtkVariantCreate<> specialization to eliminate this warning."
43  );
44 
45  return vtkVariant();
46 }
47 
48 template<>
50 {
51  return value;
52 }
53 
54 template<>
55 inline vtkVariant vtkVariantCreate<unsigned char>(const unsigned char& value)
56 {
57  return value;
58 }
59 
60 template<>
62 {
63  return value;
64 }
65 
66 template<>
67 inline vtkVariant vtkVariantCreate<unsigned short>(const unsigned short& value)
68 {
69  return value;
70 }
71 
72 template<>
74 {
75  return value;
76 }
77 
78 template<>
79 inline vtkVariant vtkVariantCreate<unsigned int>(const unsigned int& value)
80 {
81  return value;
82 }
83 
84 template<>
86 {
87  return value;
88 }
89 
90 template<>
91 inline vtkVariant vtkVariantCreate<unsigned long>(const unsigned long& value)
92 {
93  return value;
94 }
95 
96 template<>
98 {
99  return value;
100 }
101 
102 template<>
103 inline vtkVariant vtkVariantCreate<unsigned long long>(const unsigned long long& value)
104 {
105  return value;
106 }
107 
108 template<>
110 {
111  return value;
112 }
113 
114 template<>
116 {
117  return value;
118 }
119 
120 template<>
122 {
123  return value;
124 }
125 
126 template<>
128 {
129  return value;
130 }
131 
132 template<>
134 {
135  return value;
136 }
137 
138 #endif
139 
140 // VTK-HeaderTest-Exclude: vtkVariantCreate.h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:34
vtkVariant vtkVariantCreate< vtkVariant >(const vtkVariant &value)
vtkVariant vtkVariantCreate(const T &)
vtkVariant vtkVariantCreate< short >(const short &value)
vtkVariant vtkVariantCreate< int >(const int &value)
vtkVariant vtkVariantCreate< double >(const double &value)
vtkVariant vtkVariantCreate< vtkUnicodeString >(const vtkUnicodeString &value)
vtkVariant vtkVariantCreate< unsigned int >(const unsigned int &value)
vtkVariant vtkVariantCreate< vtkStdString >(const vtkStdString &value)
A atomic type representing the union of many types.
Definition: vtkVariant.h:65
vtkVariant vtkVariantCreate< unsigned long long >(const unsigned long long &value)
vtkVariant vtkVariantCreate< unsigned short >(const unsigned short &value)
vtkVariant vtkVariantCreate< char >(const char &value)
vtkVariant vtkVariantCreate< float >(const float &value)
vtkVariant vtkVariantCreate< unsigned long >(const unsigned long &value)
vtkVariant vtkVariantCreate< unsigned char >(const unsigned char &value)
vtkVariant vtkVariantCreate< long >(const long &value)
vtkVariant vtkVariantCreate< long long >(const long long &value)
String class that stores Unicode text.