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
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:36
String class that stores Unicode text.
Performs an explicit conversion from an arbitrary type to a vtkVariant.
A atomic type representing the union of many types.
Definition: vtkVariant.h:66
@ value
Definition: vtkX3D.h:226
@ name
Definition: vtkX3D.h:225
#define VTK_DEPRECATED_IN_9_1_0(reason)
vtkVariant vtkVariantCreate< vtkStdString >(const vtkStdString &value)
vtkVariant vtkVariantCreate(const T &)
vtkVariant vtkVariantCreate< unsigned long >(const unsigned long &value)
vtkVariant vtkVariantCreate< float >(const float &value)
vtkVariant vtkVariantCreate< int >(const int &value)
vtkVariant vtkVariantCreate< unsigned short >(const unsigned short &value)
vtkVariant vtkVariantCreate< unsigned char >(const unsigned char &value)
vtkVariant vtkVariantCreate< unsigned int >(const unsigned int &value)
vtkVariant vtkVariantCreate< long >(const long &value)
vtkVariant vtkVariantCreate< double >(const double &value)
vtkVariant vtkVariantCreate< unsigned long long >(const unsigned long long &value)
vtkVariant vtkVariantCreate< short >(const short &value)
vtkVariant vtkVariantCreate< long long >(const long long &value)
vtkVariant vtkVariantCreate< char >(const char &value)