Rhino C++ API
8.11
|
#include <RhRdkVariant.h>
Public Types | |
enum | VariantType { vtNull = 0, vtBool = 1, vtInteger = 2, vtFloat = 3, vtDouble = 4, vtColor = 5, vtVector2d = 6, vtVector3d = 7, vtString = 8, vtPointer = 9, vtUuid = 10, vtMatrix = 11, vtTime = 12, vtBuffer = 13, vtPoint4d = 14, vtForce32bit = 0xFFFFFFFF } |
Public Member Functions | |
CRhRdkVariant () | |
CRhRdkVariant (bool b) | |
CRhRdkVariant (const char *sz) | |
CRhRdkVariant (const CRhRdkColor &c) | |
CRhRdkVariant (const CRhRdkVariant &v) | |
CRhRdkVariant (const ON_2dVector &v) | |
CRhRdkVariant (const ON_3dVector &v) | |
CRhRdkVariant (const ON_4dPoint &p) | |
CRhRdkVariant (const ON_4fColor &c) | |
CRhRdkVariant (const ON_Buffer &buf) | |
CRhRdkVariant (const ON_Color &c) | |
CRhRdkVariant (const ON_wString &s) | |
CRhRdkVariant (const ON_Xform &xform) | |
CRhRdkVariant (const ON_XMLVariant &v) | |
CRhRdkVariant (const ON_XMLVariant *v)=delete | |
CRhRdkVariant (const time_t &time) | |
CRhRdkVariant (const UUID &uuid) | |
CRhRdkVariant (const void *pData, size_t size) | |
CRhRdkVariant (const wchar_t *wsz) | |
CRhRdkVariant (double d) | |
CRhRdkVariant (float f) | |
CRhRdkVariant (int i) | |
CRhRdkVariant (void *p) | |
~CRhRdkVariant () | |
bool | AsBool (void) const |
const void * | AsBuffer (size_t &sizeOut) const |
ON_Buffer | AsBuffer (void) const |
double | AsDouble (void) const |
float | AsFloat (void) const |
int | AsInteger (void) const |
ON_Xform | AsMatrix (void) const |
double | AsModelDouble (const CRhinoDoc *pDoc) const |
float | AsModelFloat (const CRhinoDoc *pDo) const |
RDK_DEPRECATED ON_Color | AsOn4fColor (void) const |
ON_4fColor | AsOn4fColorEx (void) const |
ON_Color | AsOnColor (void) const |
ON_XMLVariant | AsOnXMLVariant (void) const |
ON_4dPoint | AsPoint4d (void) const |
void * | AsPointer (void) const |
CRhRdkColor | AsRdkColor (void) const |
bool | AsSmartBool (bool bNullResult=false, bool bVariesResult=true) const |
double | AsSmartDouble (double dNullResult=0.0, double dVariesResult=0.0) const |
const wchar_t * | AsSmartString (const wchar_t *wszNullResult=L"", const wchar_t *wszVariesResult=L"") const |
const wchar_t * | AsString (void) const |
time_t | AsTime (void) const |
UUID | AsUuid (void) const |
ON_2dVector | AsVector2d (void) const |
ON_3dVector | AsVector3d (void) const |
DWORD | CalculateCRC (void) const |
void | ChangeType (VariantType) |
void * | EF (const wchar_t *wszFunc, void *pvData) |
void | Format (ON_wString &sOut) const |
bool | IsNull (void) const |
operator bool (void) const | |
operator const wchar_t * (void) const | |
operator CRhRdkColor (void) const | |
operator double (void) const | |
operator float (void) const | |
operator int (void) const | |
operator ON_2dVector (void) const | |
operator ON_3dVector (void) const | |
operator ON_4dPoint (void) const | |
operator ON_4fColor (void) const | |
operator ON_Buffer (void) const | |
operator ON_Color (void) const | |
operator ON_Xform (void) const | |
operator ON_XMLVariant (void) const | |
operator time_t (void) const | |
operator UUID (void) const | |
operator void * (void) const | |
bool | operator!= (const CRhRdkVariant &v) const |
bool | operator< (const CRhRdkVariant &v) const |
const CRhRdkVariant & | operator= (bool b) |
const CRhRdkVariant & | operator= (const char *sz) |
const CRhRdkVariant & | operator= (const CRhRdkVariant &v) |
const CRhRdkVariant & | operator= (const ON_2dVector &v) |
const CRhRdkVariant & | operator= (const ON_3dVector &v) |
const CRhRdkVariant & | operator= (const ON_4dPoint &p) |
const CRhRdkVariant & | operator= (const ON_4fColor &c) |
const CRhRdkVariant & | operator= (const ON_Buffer &buf) |
const CRhRdkVariant & | operator= (const ON_Color &c) |
const CRhRdkVariant & | operator= (const ON_wString &s) |
const CRhRdkVariant & | operator= (const ON_Xform &xform) |
const CRhRdkVariant & | operator= (const ON_XMLVariant &v) |
const CRhRdkVariant & | operator= (const time_t &time) |
const CRhRdkVariant & | operator= (const UUID &uuid) |
const CRhRdkVariant & | operator= (const wchar_t *wsz) |
const CRhRdkVariant & | operator= (double d) |
const CRhRdkVariant & | operator= (float f) |
const CRhRdkVariant & | operator= (int i) |
const CRhRdkVariant & | operator= (void *p) |
bool | operator== (const CRhRdkVariant &v) const |
bool | operator> (const CRhRdkVariant &v) const |
void | SetAsModelDouble (double d, const CRhinoDoc *pDoc) |
void | SetAsModelFloat (float f, const CRhinoDoc *pDoc) |
void | SetNull (void) |
void | SetUnits (ON::LengthUnitSystem units) |
void | SetValue (bool b) |
void | SetValue (const char *sz) |
void | SetValue (const CRhRdkColor &c) |
void | SetValue (const ON_2dVector &v) |
void | SetValue (const ON_3dVector &v) |
void | SetValue (const ON_4dPoint &p) |
void | SetValue (const ON_4fColor &c) |
void | SetValue (const ON_Buffer &buf) |
void | SetValue (const ON_Color &c) |
void | SetValue (const ON_wString &s) |
void | SetValue (const ON_Xform &xform) |
void | SetValue (const ON_XMLVariant &v) |
void | SetValue (const time_t &time) |
void | SetValue (const UUID &uuid) |
void | SetValue (const void *pBuffer, size_t size) |
void | SetValue (const wchar_t *wsz) |
void | SetValue (double v) |
void | SetValue (float v) |
void | SetValue (int v) |
void | SetValue (void *p) |
void | SetVaries (void) |
VariantType | Type (void) const |
ON::LengthUnitSystem | Units (void) const |
bool | Varies (void) const |
Static Public Member Functions | |
static const CRhRdkVariant & | Null (void) |
The RDK variant is an object that can hold data of different types. It is primarily used by the automatic user interface system to provide a unified way of passing parameters to and from the user interface.
A null variant has a type of vtNull and no value.
Use the 'varying' feature to represent multiple different values of the same type. This is useful for property pages etc. If you use this feature, you must check Varies() before retrieving the value. If you never call SetVaries() then you never have to call Varies().
When reading the value, conversion will be performed if necessary.
This class has no virtual functions and should not be subclassed.
CRhRdkVariant::~CRhRdkVariant | ( | ) |
CRhRdkVariant::CRhRdkVariant | ( | ) |
Construct as null.
CRhRdkVariant::CRhRdkVariant | ( | int | i | ) |
Construct from an integer.
CRhRdkVariant::CRhRdkVariant | ( | bool | b | ) |
Construct from a boolean.
CRhRdkVariant::CRhRdkVariant | ( | float | f | ) |
Construct from a float.
CRhRdkVariant::CRhRdkVariant | ( | double | d | ) |
Construct from a double.
CRhRdkVariant::CRhRdkVariant | ( | const char * | sz | ) |
Construct from a string.
CRhRdkVariant::CRhRdkVariant | ( | const wchar_t * | wsz | ) |
Construct from a wide string.
|
explicit |
Construct from an ON_wString.
CRhRdkVariant::CRhRdkVariant | ( | const ON_Color & | c | ) |
Construct from a color.
CRhRdkVariant::CRhRdkVariant | ( | const CRhRdkColor & | c | ) |
Construct from an RDK color.
CRhRdkVariant::CRhRdkVariant | ( | const ON_4fColor & | c | ) |
Construct from a float color.
CRhRdkVariant::CRhRdkVariant | ( | const ON_2dVector & | v | ) |
Construct from a 2 dimensional vector.
CRhRdkVariant::CRhRdkVariant | ( | const ON_3dVector & | v | ) |
Construct from a 3 dimensional vector.
CRhRdkVariant::CRhRdkVariant | ( | const ON_4dPoint & | p | ) |
Construct from a 4 dimensional point.
CRhRdkVariant::CRhRdkVariant | ( | void * | p | ) |
Construct from a pointer. The variant treats the pointer as an opaque 32-bit value.
CRhRdkVariant::CRhRdkVariant | ( | const UUID & | uuid | ) |
Construct from a UUID.
CRhRdkVariant::CRhRdkVariant | ( | const ON_Xform & | xform | ) |
Construct from a matrix.
CRhRdkVariant::CRhRdkVariant | ( | const time_t & | time | ) |
Construct from a time.
CRhRdkVariant::CRhRdkVariant | ( | const ON_Buffer & | buf | ) |
Construct from a buffer
CRhRdkVariant::CRhRdkVariant | ( | const void * | pData, |
size_t | size | ||
) |
Construct from a raw buffer.
|
explicit |
Construct from an ON_XMLVariant.
CRhRdkVariant::CRhRdkVariant | ( | const CRhRdkVariant & | v | ) |
Construct from another RDK variant.
|
explicitdelete |
Disallows calls which usually result from a typo; force use of object or reference.
bool CRhRdkVariant::AsBool | ( | void | ) | const |
Retrieve the value as a boolean. Null or varying returns false.
const void* CRhRdkVariant::AsBuffer | ( | size_t & | sizeOut | ) | const |
Retrieve the value as a raw buffer. Null or varying returns null pointer and zero length.
ON_Buffer CRhRdkVariant::AsBuffer | ( | void | ) | const |
Retrieve the value as a buffer. Null or varying returns an empty buffer.
double CRhRdkVariant::AsDouble | ( | void | ) | const |
Retrieve the value as a double. Null or varying returns 0.0.
float CRhRdkVariant::AsFloat | ( | void | ) | const |
Retrieve the value as a float. Null or varying returns 0.0f.
int CRhRdkVariant::AsInteger | ( | void | ) | const |
Retrieve the value as an integer. Null or varying returns 0.
ON_Xform CRhRdkVariant::AsMatrix | ( | void | ) | const |
Retrieve the value as a matrix. Null or varying returns zero matrix.
double CRhRdkVariant::AsModelDouble | ( | const CRhinoDoc * | pDoc | ) | const |
Retrieve the value as a double in model units. Null or varying returns 0.0. The value will be converted from the variant's units to model units if necessary.
float CRhRdkVariant::AsModelFloat | ( | const CRhinoDoc * | pDo | ) | const |
Retrieve the value as a float in model units. Null or varying returns 0.0. The value will be converted from the variant's units to model units if necessary.
RDK_DEPRECATED ON_Color CRhRdkVariant::AsOn4fColor | ( | void | ) | const |
Retrieve the value as an ON_4fColor. Null or varying returns black.
ON_4fColor CRhRdkVariant::AsOn4fColorEx | ( | void | ) | const |
ON_Color CRhRdkVariant::AsOnColor | ( | void | ) | const |
Retrieve the value as an ON_Color. Null or varying returns black.
ON_XMLVariant CRhRdkVariant::AsOnXMLVariant | ( | void | ) | const |
Retrieve the value as an ON_XMLVariant.
ON_4dPoint CRhRdkVariant::AsPoint4d | ( | void | ) | const |
Retrieve the value as a 4 dimensional point. Null or varying returns (0, 0, 0, 0).
void* CRhRdkVariant::AsPointer | ( | void | ) | const |
Retrieve the value as a pointer. Null or varying returns NULL.
CRhRdkColor CRhRdkVariant::AsRdkColor | ( | void | ) | const |
Retrieve the value as a CRhRdkColor. Null or varying returns black.
bool CRhRdkVariant::AsSmartBool | ( | bool | bNullResult = false , |
bool | bVariesResult = true |
||
) | const |
It is often necessary to get a variant as a boolean, especially in dialogs with lots of check boxes. This helper retrieves the value as a boolean ensuring that null and varying are handled correctly. Null returns bNullResult, varying returns bVariesResult.
double CRhRdkVariant::AsSmartDouble | ( | double | dNullResult = 0.0 , |
double | dVariesResult = 0.0 |
||
) | const |
It is often necessary to get a variant as a double, especially in dialogs with lots of numeric edit boxes. This helper retrieves the value as a double ensuring that null and varying are handled correctly. Null returns dNullResult, varying returns dVariesResult.
const wchar_t* CRhRdkVariant::AsSmartString | ( | const wchar_t * | wszNullResult = L"" , |
const wchar_t * | wszVariesResult = L"" |
||
) | const |
It is often necessary to get a variant as a string, especially in dialogs with lots of combo boxes. This helper retrieves the value as a string ensuring that null and varying are handled correctly. Null returns wszNullResult, varying returns wszVariesResult.
const wchar_t* CRhRdkVariant::AsString | ( | void | ) | const |
Retrieve the value as a wide string. Null returns "NULL", varying returns "VARIES".
time_t CRhRdkVariant::AsTime | ( | void | ) | const |
Retrieve the value as a time. Null or varying returns zero time.
UUID CRhRdkVariant::AsUuid | ( | void | ) | const |
Retrieve the value as a UUID. Null or varying returns ON_nil_uuid.
ON_2dVector CRhRdkVariant::AsVector2d | ( | void | ) | const |
Retrieve the value as a 2 dimensional vector. Null or varying returns (0, 0).
ON_3dVector CRhRdkVariant::AsVector3d | ( | void | ) | const |
Retrieve the value as a 3 dimensional vector. Null or varying returns (0, 0, 0).
DWORD CRhRdkVariant::CalculateCRC | ( | void | ) | const |
Calculates a CRC for the variant's state. If the variant is null or 'varies' this will be zero.
void CRhRdkVariant::ChangeType | ( | VariantType | ) |
Change the type of the variant while retaining the data as close as possible.
void* CRhRdkVariant::EF | ( | const wchar_t * | wszFunc, |
void * | pvData | ||
) |
Emergency function for future expansion.
void CRhRdkVariant::Format | ( | ON_wString & | sOut | ) | const |
Format string as type and value. Useful for debugging.
bool CRhRdkVariant::IsNull | ( | void | ) | const |
Check if the variant is null.
|
static |
General purpose null variant for use in return values where a null variant means "nothing".
CRhRdkVariant::operator bool | ( | void | ) | const |
CRhRdkVariant::operator const wchar_t * | ( | void | ) | const |
CRhRdkVariant::operator CRhRdkColor | ( | void | ) | const |
CRhRdkVariant::operator double | ( | void | ) | const |
CRhRdkVariant::operator float | ( | void | ) | const |
CRhRdkVariant::operator int | ( | void | ) | const |
CRhRdkVariant::operator ON_2dVector | ( | void | ) | const |
CRhRdkVariant::operator ON_3dVector | ( | void | ) | const |
CRhRdkVariant::operator ON_4dPoint | ( | void | ) | const |
CRhRdkVariant::operator ON_4fColor | ( | void | ) | const |
CRhRdkVariant::operator ON_Buffer | ( | void | ) | const |
CRhRdkVariant::operator ON_Color | ( | void | ) | const |
CRhRdkVariant::operator ON_Xform | ( | void | ) | const |
CRhRdkVariant::operator ON_XMLVariant | ( | void | ) | const |
CRhRdkVariant::operator time_t | ( | void | ) | const |
CRhRdkVariant::operator UUID | ( | void | ) | const |
CRhRdkVariant::operator void * | ( | void | ) | const |
bool CRhRdkVariant::operator!= | ( | const CRhRdkVariant & | v | ) | const |
Inequality check.
bool CRhRdkVariant::operator< | ( | const CRhRdkVariant & | v | ) | const |
Less-than check.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | bool | b | ) |
Assign from a boolean.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | const char * | sz | ) |
Assign from a string.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | const CRhRdkVariant & | v | ) |
Assign from another variant. Null and varying can be copied.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | const ON_2dVector & | v | ) |
Assign from a 2 dimensional vector.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | const ON_3dVector & | v | ) |
Assign from a 3 dimensional vector.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | const ON_4dPoint & | p | ) |
Assign from a 4 dimensional point.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | const ON_4fColor & | c | ) |
Assign from a float color.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | const ON_Buffer & | buf | ) |
Assign from a buffer.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | const ON_Color & | c | ) |
Assign from a color.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | const ON_wString & | s | ) |
Assign from an ON_wString.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | const ON_Xform & | xform | ) |
Assign from a matrix.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | const ON_XMLVariant & | v | ) |
Assign from an ON_XMLVariant.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | const time_t & | time | ) |
Assign from a time.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | const UUID & | uuid | ) |
Assign from a UUID.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | const wchar_t * | wsz | ) |
Assign from a wide string.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | double | d | ) |
Assign from a double.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | float | f | ) |
Assign from a float.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | int | i | ) |
Assign from an integer.
const CRhRdkVariant& CRhRdkVariant::operator= | ( | void * | p | ) |
Assign from a pointer. The variant treats the pointer as an opaque 32-bit value.
bool CRhRdkVariant::operator== | ( | const CRhRdkVariant & | v | ) | const |
Equality check.
bool CRhRdkVariant::operator> | ( | const CRhRdkVariant & | v | ) | const |
Greater-than check.
void CRhRdkVariant::SetAsModelDouble | ( | double | d, |
const CRhinoDoc * | pDoc | ||
) |
Set the value to a double in model units. The value will be converted from model units to the variant's units if necessary.
void CRhRdkVariant::SetAsModelFloat | ( | float | f, |
const CRhinoDoc * | pDoc | ||
) |
Set the value to a float in model units. The value will be converted from model units to the variant's units if necessary.
void CRhRdkVariant::SetNull | ( | void | ) |
Set the variant to be null. Can be called at any time.
void CRhRdkVariant::SetUnits | ( | ON::LengthUnitSystem | units | ) |
Set the units associated with numeric values.
void CRhRdkVariant::SetValue | ( | bool | b | ) |
void CRhRdkVariant::SetValue | ( | const char * | sz | ) |
void CRhRdkVariant::SetValue | ( | const CRhRdkColor & | c | ) |
Set the value to an RDK color.
void CRhRdkVariant::SetValue | ( | const ON_2dVector & | v | ) |
void CRhRdkVariant::SetValue | ( | const ON_3dVector & | v | ) |
void CRhRdkVariant::SetValue | ( | const ON_4dPoint & | p | ) |
void CRhRdkVariant::SetValue | ( | const ON_4fColor & | c | ) |
void CRhRdkVariant::SetValue | ( | const ON_Buffer & | buf | ) |
Set the value to a buffer.
void CRhRdkVariant::SetValue | ( | const ON_Color & | c | ) |
void CRhRdkVariant::SetValue | ( | const ON_wString & | s | ) |
Set the value to an ON_wString.
void CRhRdkVariant::SetValue | ( | const ON_Xform & | xform | ) |
Set the value to a matrix.
void CRhRdkVariant::SetValue | ( | const ON_XMLVariant & | v | ) |
Set the value to an ON_XMLVariant.
void CRhRdkVariant::SetValue | ( | const time_t & | time | ) |
Set the value to a time.
void CRhRdkVariant::SetValue | ( | const UUID & | uuid | ) |
Set the value to a UUID.
void CRhRdkVariant::SetValue | ( | const void * | pBuffer, |
size_t | size | ||
) |
Set the value to a raw buffer.
void CRhRdkVariant::SetValue | ( | const wchar_t * | wsz | ) |
void CRhRdkVariant::SetValue | ( | double | v | ) |
void CRhRdkVariant::SetValue | ( | float | v | ) |
void CRhRdkVariant::SetValue | ( | int | v | ) |
void CRhRdkVariant::SetValue | ( | void * | p | ) |
Set the value to a pointer. The variant treats the pointer as an opaque 64-bit value.
void CRhRdkVariant::SetVaries | ( | void | ) |
Set the value to varying. The type is retained. Calling this method on a null variant is not supported.
VariantType CRhRdkVariant::Type | ( | void | ) | const |
ON::LengthUnitSystem CRhRdkVariant::Units | ( | void | ) | const |
Retrieve the units associated with numeric values.
bool CRhRdkVariant::Varies | ( | void | ) | const |
Check if the value is varying.