VTK
Public Member Functions | Friends | List of all members
vtkVariant Class Reference

A atomic type representing the union of many types. More...

#include <vtkVariant.h>

Collaboration diagram for vtkVariant:
[legend]

Public Member Functions

 vtkVariant ()
 Create an invalid variant. More...
 
 ~vtkVariant ()
 Destruct the variant. More...
 
 vtkVariant (const vtkVariant &other)
 Copy constructor. More...
 
 vtkVariant (bool value)
 Create a bool variant. More...
 
 vtkVariant (char value)
 Create a char variant. More...
 
 vtkVariant (unsigned char value)
 Create an unsigned char variant. More...
 
 vtkVariant (signed char value)
 Create a signed char variant. More...
 
 vtkVariant (short value)
 Create a short variant. More...
 
 vtkVariant (unsigned short value)
 Create an unsigned short variant. More...
 
 vtkVariant (int value)
 Create an integer variant. More...
 
 vtkVariant (unsigned int value)
 Create an unsigned integer variant. More...
 
 vtkVariant (long value)
 Create an long variant. More...
 
 vtkVariant (unsigned long value)
 Create an unsigned long variant. More...
 
 vtkVariant (long long value)
 Create a long long variant. More...
 
 vtkVariant (unsigned long long value)
 Create an unsigned long long variant. More...
 
 vtkVariant (float value)
 Create a float variant. More...
 
 vtkVariant (double value)
 Create a double variant. More...
 
 vtkVariant (const char *value)
 Create a string variant from a const char*. More...
 
 vtkVariant (vtkStdString value)
 Create a string variant from a std string. More...
 
 vtkVariant (const vtkUnicodeString &value)
 Create a Unicode string variant. More...
 
 vtkVariant (vtkObjectBase *value)
 Create a vtkObjectBase variant. More...
 
 vtkVariant (const vtkVariant &other, unsigned int type)
 Create a variant of a specific type. More...
 
vtkVariantoperator= (const vtkVariant &other)
 Copy the value of one variant into another. More...
 
bool IsValid () const
 Get whether the variant value is valid. More...
 
bool IsString () const
 Get whether the variant is a string. More...
 
bool IsUnicodeString () const
 Get whether the variant is a Unicode string. More...
 
bool IsNumeric () const
 Get whether the variant is any numeric type. More...
 
bool IsFloat () const
 Get whether the variant is a float. More...
 
bool IsDouble () const
 Get whether the variant is a double. More...
 
bool IsChar () const
 Get whether the variant is an char. More...
 
bool IsUnsignedChar () const
 Get whether the variant is an unsigned char. More...
 
bool IsSignedChar () const
 Get whether the variant is an signed char. More...
 
bool IsShort () const
 Get whether the variant is an short. More...
 
bool IsUnsignedShort () const
 Get whether the variant is an unsigned short. More...
 
bool IsInt () const
 Get whether the variant is an int. More...
 
bool IsUnsignedInt () const
 Get whether the variant is an unsigned int. More...
 
bool IsLong () const
 Get whether the variant is an long. More...
 
bool IsUnsignedLong () const
 Get whether the variant is an unsigned long. More...
 
bool Is__Int64 () const
 Legacy. More...
 
bool IsUnsigned__Int64 () const
 Legacy. More...
 
bool IsLongLong () const
 Get whether the variant is long long. More...
 
bool IsUnsignedLongLong () const
 Get whether the variant is unsigned long long. More...
 
bool IsVTKObject () const
 Get whether the variant is a VTK object pointer. More...
 
bool IsArray () const
 Get whether the variant is a VTK array (i.e. More...
 
unsigned int GetType () const
 Get the type of the variant. More...
 
const char * GetTypeAsString () const
 Get the type of the variant as a string. More...
 
vtkStdString ToString () const
 Convert the variant to a string. More...
 
vtkUnicodeString ToUnicodeString () const
 convert the variant to a Unicode string. More...
 
vtkObjectBaseToVTKObject () const
 Return the VTK object, or nullptr if not of that type. More...
 
vtkAbstractArrayToArray () const
 Return the array, or nullptr if not of that type. More...
 
bool IsEqual (const vtkVariant &other) const
 Determines whether two variants have the same value. More...
 
float ToFloat (bool *valid) const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
float ToFloat () const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
double ToDouble (bool *valid) const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
double ToDouble () const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
char ToChar (bool *valid) const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
char ToChar () const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
unsigned char ToUnsignedChar (bool *valid) const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
unsigned char ToUnsignedChar () const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
signed char ToSignedChar (bool *valid) const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
signed char ToSignedChar () const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
short ToShort (bool *valid) const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
short ToShort () const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
unsigned short ToUnsignedShort (bool *valid) const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
unsigned short ToUnsignedShort () const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
int ToInt (bool *valid) const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
int ToInt () const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
unsigned int ToUnsignedInt (bool *valid) const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
unsigned int ToUnsignedInt () const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
long ToLong (bool *valid) const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
long ToLong () const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
unsigned long ToUnsignedLong (bool *valid) const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
unsigned long ToUnsignedLong () const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
long long ToLongLong (bool *valid) const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
long long ToLongLong () const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
unsigned long long ToUnsignedLongLong (bool *valid) const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
unsigned long long ToUnsignedLongLong () const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
vtkTypeInt64 ToTypeInt64 (bool *valid) const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
vtkTypeInt64 ToTypeInt64 () const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
vtkTypeUInt64 ToTypeUInt64 (bool *valid) const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
vtkTypeUInt64 ToTypeUInt64 () const
 Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type. More...
 
bool operator== (const vtkVariant &other) const
 Compare two variants for equality, greater than, and less than. More...
 
bool operator!= (const vtkVariant &other) const
 Compare two variants for equality, greater than, and less than. More...
 
bool operator< (const vtkVariant &other) const
 Compare two variants for equality, greater than, and less than. More...
 
bool operator> (const vtkVariant &other) const
 Compare two variants for equality, greater than, and less than. More...
 
bool operator<= (const vtkVariant &other) const
 Compare two variants for equality, greater than, and less than. More...
 
bool operator>= (const vtkVariant &other) const
 Compare two variants for equality, greater than, and less than. More...
 

Friends

struct vtkVariantLessThan
 
struct vtkVariantEqual
 
struct vtkVariantStrictWeakOrder
 
struct vtkVariantStrictEquality
 
VTKCOMMONCORE_EXPORT ostream & operator<< (ostream &os, const vtkVariant &val)
 

Detailed Description

A atomic type representing the union of many types.

Thanks:
Thanks to Patricia Crossno, Ken Moreland, Andrew Wilson and Brian Wylie from Sandia National Laboratories for their help in developing this class.
Examples:
vtkVariant (Examples)
Tests:
vtkVariant (Tests)

Definition at line 71 of file vtkVariant.h.

Constructor & Destructor Documentation

vtkVariant::vtkVariant ( )

Create an invalid variant.

vtkVariant::~vtkVariant ( )

Destruct the variant.

vtkVariant::vtkVariant ( const vtkVariant other)

Copy constructor.

vtkVariant::vtkVariant ( bool  value)

Create a bool variant.

Internally store it as char.

vtkVariant::vtkVariant ( char  value)

Create a char variant.

vtkVariant::vtkVariant ( unsigned char  value)

Create an unsigned char variant.

vtkVariant::vtkVariant ( signed char  value)

Create a signed char variant.

vtkVariant::vtkVariant ( short  value)

Create a short variant.

vtkVariant::vtkVariant ( unsigned short  value)

Create an unsigned short variant.

vtkVariant::vtkVariant ( int  value)

Create an integer variant.

vtkVariant::vtkVariant ( unsigned int  value)

Create an unsigned integer variant.

vtkVariant::vtkVariant ( long  value)

Create an long variant.

vtkVariant::vtkVariant ( unsigned long  value)

Create an unsigned long variant.

vtkVariant::vtkVariant ( long long  value)

Create a long long variant.

vtkVariant::vtkVariant ( unsigned long long  value)

Create an unsigned long long variant.

vtkVariant::vtkVariant ( float  value)

Create a float variant.

vtkVariant::vtkVariant ( double  value)

Create a double variant.

vtkVariant::vtkVariant ( const char *  value)

Create a string variant from a const char*.

vtkVariant::vtkVariant ( vtkStdString  value)

Create a string variant from a std string.

vtkVariant::vtkVariant ( const vtkUnicodeString value)

Create a Unicode string variant.

vtkVariant::vtkVariant ( vtkObjectBase value)

Create a vtkObjectBase variant.

vtkVariant::vtkVariant ( const vtkVariant other,
unsigned int  type 
)

Create a variant of a specific type.

Member Function Documentation

vtkVariant& vtkVariant::operator= ( const vtkVariant other)

Copy the value of one variant into another.

bool vtkVariant::IsValid ( ) const

Get whether the variant value is valid.

bool vtkVariant::IsString ( ) const

Get whether the variant is a string.

bool vtkVariant::IsUnicodeString ( ) const

Get whether the variant is a Unicode string.

bool vtkVariant::IsNumeric ( ) const

Get whether the variant is any numeric type.

bool vtkVariant::IsFloat ( ) const

Get whether the variant is a float.

bool vtkVariant::IsDouble ( ) const

Get whether the variant is a double.

bool vtkVariant::IsChar ( ) const

Get whether the variant is an char.

bool vtkVariant::IsUnsignedChar ( ) const

Get whether the variant is an unsigned char.

bool vtkVariant::IsSignedChar ( ) const

Get whether the variant is an signed char.

bool vtkVariant::IsShort ( ) const

Get whether the variant is an short.

bool vtkVariant::IsUnsignedShort ( ) const

Get whether the variant is an unsigned short.

bool vtkVariant::IsInt ( ) const

Get whether the variant is an int.

bool vtkVariant::IsUnsignedInt ( ) const

Get whether the variant is an unsigned int.

bool vtkVariant::IsLong ( ) const

Get whether the variant is an long.

bool vtkVariant::IsUnsignedLong ( ) const

Get whether the variant is an unsigned long.

bool vtkVariant::Is__Int64 ( ) const

Legacy.

Returns false. The variant is never an __int64.

bool vtkVariant::IsUnsigned__Int64 ( ) const

Legacy.

Returns false. The variant is never an unsigned __int64.

bool vtkVariant::IsLongLong ( ) const

Get whether the variant is long long.

bool vtkVariant::IsUnsignedLongLong ( ) const

Get whether the variant is unsigned long long.

bool vtkVariant::IsVTKObject ( ) const

Get whether the variant is a VTK object pointer.

bool vtkVariant::IsArray ( ) const

Get whether the variant is a VTK array (i.e.

a subclass of vtkAbstractArray).

unsigned int vtkVariant::GetType ( ) const

Get the type of the variant.

const char* vtkVariant::GetTypeAsString ( ) const

Get the type of the variant as a string.

vtkStdString vtkVariant::ToString ( ) const

Convert the variant to a string.

vtkUnicodeString vtkVariant::ToUnicodeString ( ) const

convert the variant to a Unicode string.

float vtkVariant::ToFloat ( bool *  valid) const

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

float vtkVariant::ToFloat ( ) const
inline

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

Definition at line 326 of file vtkVariant.h.

double vtkVariant::ToDouble ( bool *  valid) const

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

double vtkVariant::ToDouble ( ) const
inline

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

Definition at line 329 of file vtkVariant.h.

char vtkVariant::ToChar ( bool *  valid) const

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

char vtkVariant::ToChar ( ) const
inline

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

Definition at line 332 of file vtkVariant.h.

unsigned char vtkVariant::ToUnsignedChar ( bool *  valid) const

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

unsigned char vtkVariant::ToUnsignedChar ( ) const
inline

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

Definition at line 335 of file vtkVariant.h.

signed char vtkVariant::ToSignedChar ( bool *  valid) const

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

signed char vtkVariant::ToSignedChar ( ) const
inline

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

Definition at line 338 of file vtkVariant.h.

short vtkVariant::ToShort ( bool *  valid) const

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

short vtkVariant::ToShort ( ) const
inline

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

Definition at line 341 of file vtkVariant.h.

unsigned short vtkVariant::ToUnsignedShort ( bool *  valid) const

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

unsigned short vtkVariant::ToUnsignedShort ( ) const
inline

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

Definition at line 344 of file vtkVariant.h.

int vtkVariant::ToInt ( bool *  valid) const

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

int vtkVariant::ToInt ( ) const
inline

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

Definition at line 347 of file vtkVariant.h.

unsigned int vtkVariant::ToUnsignedInt ( bool *  valid) const

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

unsigned int vtkVariant::ToUnsignedInt ( ) const
inline

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

Definition at line 350 of file vtkVariant.h.

long vtkVariant::ToLong ( bool *  valid) const

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

long vtkVariant::ToLong ( ) const
inline

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

Definition at line 353 of file vtkVariant.h.

unsigned long vtkVariant::ToUnsignedLong ( bool *  valid) const

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

unsigned long vtkVariant::ToUnsignedLong ( ) const
inline

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

Definition at line 356 of file vtkVariant.h.

long long vtkVariant::ToLongLong ( bool *  valid) const

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

long long vtkVariant::ToLongLong ( ) const
inline

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

Definition at line 359 of file vtkVariant.h.

unsigned long long vtkVariant::ToUnsignedLongLong ( bool *  valid) const

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

unsigned long long vtkVariant::ToUnsignedLongLong ( ) const
inline

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

Definition at line 362 of file vtkVariant.h.

vtkTypeInt64 vtkVariant::ToTypeInt64 ( bool *  valid) const

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

vtkTypeInt64 vtkVariant::ToTypeInt64 ( ) const
inline

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

Definition at line 365 of file vtkVariant.h.

vtkTypeUInt64 vtkVariant::ToTypeUInt64 ( bool *  valid) const

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

vtkTypeUInt64 vtkVariant::ToTypeUInt64 ( ) const
inline

Convert the variant to a numeric type: If it holds a numeric, cast to the appropriate type.

If it holds a string, attempt to convert the string to the appropriate type; set the valid flag to false when the conversion fails. If it holds an array type, cast the first value of the array to the appropriate type. Fail if it holds a VTK object which is not an array.

Definition at line 368 of file vtkVariant.h.

vtkObjectBase* vtkVariant::ToVTKObject ( ) const

Return the VTK object, or nullptr if not of that type.

vtkAbstractArray* vtkVariant::ToArray ( ) const

Return the array, or nullptr if not of that type.

bool vtkVariant::IsEqual ( const vtkVariant other) const

Determines whether two variants have the same value.

They do not need to be storing exactly the same type to have the same value. In practice you don't need to use this method: just use operator== instead. If you want precise equality down to the bit level use the following idiom:

vtkVariantStrictEquality comparator; bool variantsEqual = comparator(firstVariant, secondVariant);

bool vtkVariant::operator== ( const vtkVariant other) const
inline

Compare two variants for equality, greater than, and less than.

These operators use the value represented by the variant instead of the particular type/bit pattern used to represent it. This behavior is similar to the default behavior in C and C++, including type promotion, with the following caveats:

  • When comparing type X with a string, type X will first be converted to string, then compared lexically (the usual behavior of string::operator< and company).
  • vtkObject pointers will be converted to an unsigned integer of appropriate size. If both variants contain vtkObjects then they are comparable directly.
  • Comparing char values with strings will not work the way you might expect if you're treating a char as a numeric type. Char values are written to strings as literal ASCII characters instead of numbers.

This approach follows the principle of least surprise at the expense of speed. Casting integers to floating-point values is relatively slow. Casting numeric types to strings is very slow. If you prefer speed at the expense of counterintuitive behavior – for example, when using vtkVariants as keys in STL containers – you can use the functors described at the bottom of this file.

The actual definitions of these operators are in vtkVariantInlineOperators.cxx.

Definition at line 106 of file vtkVariantInlineOperators.h.

bool vtkVariant::operator!= ( const vtkVariant other) const
inline

Compare two variants for equality, greater than, and less than.

These operators use the value represented by the variant instead of the particular type/bit pattern used to represent it. This behavior is similar to the default behavior in C and C++, including type promotion, with the following caveats:

  • When comparing type X with a string, type X will first be converted to string, then compared lexically (the usual behavior of string::operator< and company).
  • vtkObject pointers will be converted to an unsigned integer of appropriate size. If both variants contain vtkObjects then they are comparable directly.
  • Comparing char values with strings will not work the way you might expect if you're treating a char as a numeric type. Char values are written to strings as literal ASCII characters instead of numbers.

This approach follows the principle of least surprise at the expense of speed. Casting integers to floating-point values is relatively slow. Casting numeric types to strings is very slow. If you prefer speed at the expense of counterintuitive behavior – for example, when using vtkVariants as keys in STL containers – you can use the functors described at the bottom of this file.

The actual definitions of these operators are in vtkVariantInlineOperators.cxx.

Definition at line 274 of file vtkVariantInlineOperators.h.

bool vtkVariant::operator< ( const vtkVariant other) const
inline

Compare two variants for equality, greater than, and less than.

These operators use the value represented by the variant instead of the particular type/bit pattern used to represent it. This behavior is similar to the default behavior in C and C++, including type promotion, with the following caveats:

  • When comparing type X with a string, type X will first be converted to string, then compared lexically (the usual behavior of string::operator< and company).
  • vtkObject pointers will be converted to an unsigned integer of appropriate size. If both variants contain vtkObjects then they are comparable directly.
  • Comparing char values with strings will not work the way you might expect if you're treating a char as a numeric type. Char values are written to strings as literal ASCII characters instead of numbers.

This approach follows the principle of least surprise at the expense of speed. Casting integers to floating-point values is relatively slow. Casting numeric types to strings is very slow. If you prefer speed at the expense of counterintuitive behavior – for example, when using vtkVariants as keys in STL containers – you can use the functors described at the bottom of this file.

The actual definitions of these operators are in vtkVariantInlineOperators.cxx.

Definition at line 186 of file vtkVariantInlineOperators.h.

bool vtkVariant::operator> ( const vtkVariant other) const
inline

Compare two variants for equality, greater than, and less than.

These operators use the value represented by the variant instead of the particular type/bit pattern used to represent it. This behavior is similar to the default behavior in C and C++, including type promotion, with the following caveats:

  • When comparing type X with a string, type X will first be converted to string, then compared lexically (the usual behavior of string::operator< and company).
  • vtkObject pointers will be converted to an unsigned integer of appropriate size. If both variants contain vtkObjects then they are comparable directly.
  • Comparing char values with strings will not work the way you might expect if you're treating a char as a numeric type. Char values are written to strings as literal ASCII characters instead of numbers.

This approach follows the principle of least surprise at the expense of speed. Casting integers to floating-point values is relatively slow. Casting numeric types to strings is very slow. If you prefer speed at the expense of counterintuitive behavior – for example, when using vtkVariants as keys in STL containers – you can use the functors described at the bottom of this file.

The actual definitions of these operators are in vtkVariantInlineOperators.cxx.

Definition at line 280 of file vtkVariantInlineOperators.h.

bool vtkVariant::operator<= ( const vtkVariant other) const
inline

Compare two variants for equality, greater than, and less than.

These operators use the value represented by the variant instead of the particular type/bit pattern used to represent it. This behavior is similar to the default behavior in C and C++, including type promotion, with the following caveats:

  • When comparing type X with a string, type X will first be converted to string, then compared lexically (the usual behavior of string::operator< and company).
  • vtkObject pointers will be converted to an unsigned integer of appropriate size. If both variants contain vtkObjects then they are comparable directly.
  • Comparing char values with strings will not work the way you might expect if you're treating a char as a numeric type. Char values are written to strings as literal ASCII characters instead of numbers.

This approach follows the principle of least surprise at the expense of speed. Casting integers to floating-point values is relatively slow. Casting numeric types to strings is very slow. If you prefer speed at the expense of counterintuitive behavior – for example, when using vtkVariants as keys in STL containers – you can use the functors described at the bottom of this file.

The actual definitions of these operators are in vtkVariantInlineOperators.cxx.

Definition at line 287 of file vtkVariantInlineOperators.h.

bool vtkVariant::operator>= ( const vtkVariant other) const
inline

Compare two variants for equality, greater than, and less than.

These operators use the value represented by the variant instead of the particular type/bit pattern used to represent it. This behavior is similar to the default behavior in C and C++, including type promotion, with the following caveats:

  • When comparing type X with a string, type X will first be converted to string, then compared lexically (the usual behavior of string::operator< and company).
  • vtkObject pointers will be converted to an unsigned integer of appropriate size. If both variants contain vtkObjects then they are comparable directly.
  • Comparing char values with strings will not work the way you might expect if you're treating a char as a numeric type. Char values are written to strings as literal ASCII characters instead of numbers.

This approach follows the principle of least surprise at the expense of speed. Casting integers to floating-point values is relatively slow. Casting numeric types to strings is very slow. If you prefer speed at the expense of counterintuitive behavior – for example, when using vtkVariants as keys in STL containers – you can use the functors described at the bottom of this file.

The actual definitions of these operators are in vtkVariantInlineOperators.cxx.

Definition at line 294 of file vtkVariantInlineOperators.h.

Friends And Related Function Documentation

friend struct vtkVariantLessThan
friend

Definition at line 463 of file vtkVariant.h.

friend struct vtkVariantEqual
friend

Definition at line 464 of file vtkVariant.h.

friend struct vtkVariantStrictWeakOrder
friend

Definition at line 465 of file vtkVariant.h.

friend struct vtkVariantStrictEquality
friend

Definition at line 466 of file vtkVariant.h.

VTKCOMMONCORE_EXPORT ostream& operator<< ( ostream &  os,
const vtkVariant val 
)
friend

Member Data Documentation

vtkStdString* vtkVariant::String

Definition at line 442 of file vtkVariant.h.

vtkUnicodeString* vtkVariant::UnicodeString

Definition at line 443 of file vtkVariant.h.

float vtkVariant::Float

Definition at line 444 of file vtkVariant.h.

double vtkVariant::Double

Definition at line 445 of file vtkVariant.h.

char vtkVariant::Char

Definition at line 446 of file vtkVariant.h.

unsigned char vtkVariant::UnsignedChar

Definition at line 447 of file vtkVariant.h.

signed char vtkVariant::SignedChar

Definition at line 448 of file vtkVariant.h.

short vtkVariant::Short

Definition at line 449 of file vtkVariant.h.

unsigned short vtkVariant::UnsignedShort

Definition at line 450 of file vtkVariant.h.

int vtkVariant::Int

Definition at line 451 of file vtkVariant.h.

unsigned int vtkVariant::UnsignedInt

Definition at line 452 of file vtkVariant.h.

long vtkVariant::Long

Definition at line 453 of file vtkVariant.h.

unsigned long vtkVariant::UnsignedLong

Definition at line 454 of file vtkVariant.h.

long long vtkVariant::LongLong

Definition at line 455 of file vtkVariant.h.

unsigned long long vtkVariant::UnsignedLongLong

Definition at line 456 of file vtkVariant.h.

vtkObjectBase* vtkVariant::VTKObject

Definition at line 457 of file vtkVariant.h.


The documentation for this class was generated from the following files: