VTK  9.1.0
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 "vtkVariant.h"
36 #include <typeinfo> // for warnings
37 
38 template <typename T>
40 {
41  vtkGenericWarningMacro(
42  << "Cannot convert unsupported type [" << typeid(T).name() << "] to vtkVariant. "
43  << "Create a vtkVariantCreate<> specialization to eliminate this warning.");
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 <>
127 VTK_DEPRECATED_IN_9_1_0("Use vtkVariant vtkVariantCreate<vtkStdString>(const vtkStdString& value)")
129 
130 template <>
132 {
133  return value;
134 }
135 
136 #endif
137 
138 // VTK-HeaderTest-Exclude: vtkVariantCreate.h
vtkVariant.h
vtkVariantCreate
Performs an explicit conversion from an arbitrary type to a vtkVariant.
vtkX3D::value
@ value
Definition: vtkX3D.h:226
vtkVariantCreate< double >
vtkVariant vtkVariantCreate< double >(const double &value)
Definition: vtkVariantCreate.h:115
vtkVariantCreate
vtkVariant vtkVariantCreate(const T &)
Definition: vtkVariantCreate.h:39
vtkVariantCreate< short >
vtkVariant vtkVariantCreate< short >(const short &value)
Definition: vtkVariantCreate.h:61
vtkVariantCreate< unsigned int >
vtkVariant vtkVariantCreate< unsigned int >(const unsigned int &value)
Definition: vtkVariantCreate.h:79
VTK_DEPRECATED_IN_9_1_0
#define VTK_DEPRECATED_IN_9_1_0(reason)
Definition: vtkDeprecation.h:117
vtkVariantCreate< int >
vtkVariant vtkVariantCreate< int >(const int &value)
Definition: vtkVariantCreate.h:73
vtkVariantCreate< unsigned short >
vtkVariant vtkVariantCreate< unsigned short >(const unsigned short &value)
Definition: vtkVariantCreate.h:67
vtkVariantCreate< vtkStdString >
vtkVariant vtkVariantCreate< vtkStdString >(const vtkStdString &value)
Definition: vtkVariantCreate.h:121
vtkVariantCreate< unsigned long long >
vtkVariant vtkVariantCreate< unsigned long long >(const unsigned long long &value)
Definition: vtkVariantCreate.h:103
vtkUnicodeString
String class that stores Unicode text.
Definition: vtkUnicodeString.h:80
vtkVariant
A atomic type representing the union of many types.
Definition: vtkVariant.h:155
vtkX3D::name
@ name
Definition: vtkX3D.h:225
vtkVariantCreate< float >
vtkVariant vtkVariantCreate< float >(const float &value)
Definition: vtkVariantCreate.h:109
vtkVariantCreate< unsigned long >
vtkVariant vtkVariantCreate< unsigned long >(const unsigned long &value)
Definition: vtkVariantCreate.h:91
vtkVariantCreate< char >
vtkVariant vtkVariantCreate< char >(const char &value)
Definition: vtkVariantCreate.h:49
vtkVariantCreate< long >
vtkVariant vtkVariantCreate< long >(const long &value)
Definition: vtkVariantCreate.h:85
vtkVariantCreate< long long >
vtkVariant vtkVariantCreate< long long >(const long long &value)
Definition: vtkVariantCreate.h:97
vtkVariantCreate< unsigned char >
vtkVariant vtkVariantCreate< unsigned char >(const unsigned char &value)
Definition: vtkVariantCreate.h:55
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:105