39 #ifndef vtkVariantCast_h 40 #define vtkVariantCast_h 48 vtkGenericWarningMacro(
49 <<
"Cannot convert vtkVariant containing [" << value.
GetTypeAsString() <<
"] " 50 <<
"to unsupported type [" <<
typeid(T).
name() <<
"]. " 51 <<
"Create a vtkVariantCast<> specialization to eliminate this warning." 64 return value.ToChar(valid);
70 return value.ToSignedChar(valid);
76 return value.ToUnsignedChar(valid);
82 return value.ToShort(valid);
88 return value.ToUnsignedShort(valid);
94 return value.ToInt(valid);
100 return value.ToUnsignedInt(valid);
106 return value.ToLong(valid);
112 return value.ToUnsignedLong(valid);
118 return value.ToLongLong(valid);
124 return value.ToUnsignedLongLong(valid);
130 return value.ToFloat(valid);
136 return value.ToDouble(valid);
145 return value.ToString();
154 return value.ToUnicodeString();
Wrapper around std::string to keep symbols short.
T vtkVariantCast(const vtkVariant &value, bool *valid=nullptr)
A atomic type representing the union of many types.
Converts a vtkVariant to some other type.
const char * GetTypeAsString() const
Get the type of the variant as a string.
String class that stores Unicode text.