|
CFx SDK Documentation 2024 SP0
|
#include <GiVariant.h>
Classes | |
| class | EnumType |
Public Types | |
| enum | VariantType { kUndefined = 0 , kBoolean , kInt , kDouble , kColor , kString , kTable } |
Public Member Functions | |
| ODRX_DECLARE_MEMBERS (OdGiVariant) | |
| ~OdGiVariant () | |
| bool | operator== (const OdGiVariant &value) const |
| OdGiVariant & | operator= (const OdGiVariant &value) |
| virtual void | copyFrom (const OdRxObject *pSource) |
| VariantType | type () const |
| void | set (bool value) |
| void | set (OdInt32 value) |
| void | set (double value) |
| void | set (const OdCmEntityColor &value) |
| void | set (const OdString &value) |
| void | set (const OdChar *value) |
| bool | asBoolean () const |
| OdInt32 | asInt () const |
| double | asDouble () const |
| const OdCmEntityColor & | asColor () const |
| const OdString & | asString () const |
| float | asFloat () const |
| OdInt8 | asChar () const |
| OdUInt8 | asUchar () const |
| OdInt16 | asShort () const |
| OdUInt16 | asUshort () const |
| OdUInt32 | asUint () const |
| OdInt32 | asLong () const |
| OdUInt32 | asUlong () const |
| EnumType | asEnum () const |
| bool | getElem (const OdString &elem, OdGiVariant &value) const |
| const OdGiVariant * | getElem (const OdString &elem) const |
| void | setElem (const OdString &elem, const OdGiVariant &value) |
| void | deleteElem (const OdString &elem) |
| OdInt32 | getElemCount () const |
| bool | getElemAt (OdInt32 nElem, OdString &elem, OdGiVariant &value) const |
| const OdGiVariant * | getElemAt (OdInt32 nElem, OdString &elem) const |
Public Member Functions inherited from OdRxObject | |
| ODRX_HEAP_OPERATORS () | |
| OdRxObject () | |
| virtual | ~OdRxObject () |
| virtual OdRxObject * | queryX (const OdRxClass *pClass) const |
| virtual OdRxObject * | x (const OdRxClass *pClass) const |
| virtual OdRxClass * | isA () const |
| virtual void | addRef ()=0 |
| virtual void | release ()=0 |
| virtual long | numRefs () const |
| bool | isKindOf (const OdRxClass *pClass) const |
| virtual OdRxObjectPtr | clone () const |
| virtual void | copyFrom (const OdRxObject *pSource) |
| virtual OdRx::Ordering | comparedTo (const OdRxObject *pOther) const |
| virtual bool | isEqualTo (const OdRxObject *pOther) const |
Static Public Member Functions | |
| static OdSmartPtr< OdGiVariant > | createObject (const OdGiVariant &value) |
| static OdSmartPtr< OdGiVariant > | createObject (bool value) |
| static OdSmartPtr< OdGiVariant > | createObject (OdInt32 value) |
| static OdSmartPtr< OdGiVariant > | createObject (double value) |
| static OdSmartPtr< OdGiVariant > | createObject (const OdCmEntityColor &value) |
| static OdSmartPtr< OdGiVariant > | createObject (const OdString &value) |
| static OdSmartPtr< OdGiVariant > | createObject (const OdChar *value) |
| static bool | isEquivalent (const OdGiVariant *v1, const OdGiVariant *v2) |
Static Public Member Functions inherited from OdRxObject | |
| static OdRxObjectPtr | cast (const OdRxObject *pointer) |
| static OdRxClass * | desc () |
Protected Member Functions | |
| OdGiVariant () | |
This class is used as the basis for the generic data storage used for procedural material definitions.
<group OdGi_Classes>
Definition at line 46 of file GiVariant.h.
Defines the current type set to an OdGiVariant object.
| Enumerator | |
|---|---|
| kUndefined | |
| kBoolean | |
| kInt | |
| kDouble | |
| kColor | |
| kString | |
| kTable | |
Definition at line 53 of file GiVariant.h.
|
protected |
| OdGiVariant::~OdGiVariant | ( | ) |
Destructor for the OdGiVariant class.
| bool OdGiVariant::asBoolean | ( | ) | const |
Returns the current value if the variant type is kBoolean. For other types the method throws an exception.
| OdInt8 OdGiVariant::asChar | ( | ) | const |
Returns the current value as a char. The method calls the asInt() and casts the result to a char.
| const OdCmEntityColor & OdGiVariant::asColor | ( | ) | const |
Returns the current value if the variant type is kColor. For other types the method throws an exception.
| double OdGiVariant::asDouble | ( | ) | const |
Returns the current value if the variant type is kDouble. For other types the method throws an exception.
| EnumType OdGiVariant::asEnum | ( | ) | const |
Returns the current value as an EnumType. The method calls the asInt() and creates an OdGiVariant::EnumType from the result.
| float OdGiVariant::asFloat | ( | ) | const |
Returns the current value as a float. The method calls the asDouble() and casts the result to a float.
| OdInt32 OdGiVariant::asInt | ( | ) | const |
Returns the current value if the variant type is kInt. For other types the method throws an exception.
| OdInt32 OdGiVariant::asLong | ( | ) | const |
Returns the current value as a long. The method is equivalent to asInt().
| OdInt16 OdGiVariant::asShort | ( | ) | const |
Returns the current value as a short. The method calls the asInt() and casts the result to a short.
| const OdString & OdGiVariant::asString | ( | ) | const |
Returns the current value if the variant type is kString. For other types the method throws an exception.
| OdUInt8 OdGiVariant::asUchar | ( | ) | const |
Returns the current value as an unsigned char. The method calls the asInt() and casts the result to an unsigned char.
| OdUInt32 OdGiVariant::asUint | ( | ) | const |
Returns the current value as an unsigned long. The method calls the asInt() and casts the result to an unsigned long.
| OdUInt32 OdGiVariant::asUlong | ( | ) | const |
Returns the current value as an unsigned long. The method is equivalent to asUint().
| OdUInt16 OdGiVariant::asUshort | ( | ) | const |
Returns the current value as an unsigned short. The method calls the asInt() and casts the result to an unsigned short.
|
virtual |
Copies the contents of the specified object into this object.
| pSource | [in] Pointer to the source object. |
Throws:
Cause eNotApplicable The incoming object isn't of type OdGiVariant. eNullObjectPointer The incoming object is null.
Reimplemented from OdRxObject.
|
static |
Creates a new OdGiVariant object of the kBoolean type, initializes it with an input boolean value and returns a smart pointer to the created object.
| value | [in] Input initial boolean value. |
|
static |
Creates a new OdGiVariant object of the kString type, initializes it with a string of an input char array and returns a smart pointer to the created object.
| value | [in] Input initial char array. |
|
static |
Creates a new OdGiVariant object of the kColor type, initializes it with an input color value and returns a smart pointer to the created object.
| value | [in] Input initial color value. |
|
static |
This constructor creates an empty OdGiVariant instance, copies an input OdGiVariant into it and returns a smart pointer to the created object.
| value | [in] Reference to an existing OdGiVariant to copy. |
|
static |
Creates a new OdGiVariant object of the kString type, initializes it with an input string and returns a smart pointer to the created object.
| value | [in] Input initial string value. |
|
static |
Creates a new OdGiVariant object of the kDouble type, initializes it with an input floating point value and returns a smart pointer to the created object.
| value | [in] Input initial floating point value. |
|
static |
Creates a new OdGiVariant object of the kInt type, initializes it with an input long value and returns a smart pointer to the created object.
| value | [in] Input initial long value. |
If the variant's type is kTable, deletes the element with the specified string key from the table. For other types the method is invalid.
| elem | [in] Input string key with which to add the value. |
| const OdGiVariant * OdGiVariant::getElem | ( | const OdString & | elem | ) | const |
If the variant's type is kTable, gets the value paired with the specified string key. For other types the method is invalid.
| elem | [in] Input string key of an element in the table. |
| bool OdGiVariant::getElem | ( | const OdString & | elem, |
| OdGiVariant & | value | ||
| ) | const |
If the variant's type is kTable, gets the value paired with the specified string key. For other types the method is invalid.
| value | [in] Input reference to an OdGiVariant object to be filled with the retrieved value. |
| elem | [in] Input string key of an element in the table. |
| const OdGiVariant * OdGiVariant::getElemAt | ( | OdInt32 | nElem, |
| OdString & | elem | ||
| ) | const |
If the variant's type is kTable, gets the key and a pointer to the OdGiVariant value from the table by the specified index. For other types the method is invalid.
| nElem | [in] Input index. Should be within the limits of the table size. |
| elem | [out] Output string key at the nElem index. |
| bool OdGiVariant::getElemAt | ( | OdInt32 | nElem, |
| OdString & | elem, | ||
| OdGiVariant & | value | ||
| ) | const |
If the variant's type is kTable, gets the key and OdGiVariant value from the table by the specified index. For other types the method is invalid.
| nElem | [in] Input index. Should be within the limits of the table size. |
| value | [out] Output OdGiVariant value at the nElem index. |
| elem | [out] Output string key at the nElem index. |
| OdInt32 OdGiVariant::getElemCount | ( | ) | const |
If the variant's type is kTable, returns the number of table's elements. For other types the method is invalid.
|
static |
Determines whether two OdGiVariant objects are equivalent by checking the types and values. For table elements, verifies equivalence of each element by its key.
v1 - first input OdGiVariant object. v2 - second input OdGiVariant object.
| OdGiVariant::ODRX_DECLARE_MEMBERS | ( | OdGiVariant | ) |
| OdGiVariant & OdGiVariant::operator= | ( | const OdGiVariant & | value | ) |
Assignment operator for the OdGiVariant class. Returns a reference to this object with a new assigned value.
| value | [in] Variant to assign. |
| bool OdGiVariant::operator== | ( | const OdGiVariant & | value | ) | const |
Equality operator for the OdGiVariant class.
| value | [in] Variant to compare. |
| void OdGiVariant::set | ( | bool | value | ) |
Changes the OdGiVariant's type to kBoolean and assigns a new value.
| value | [in] Input new boolean value to set. |
Changes the OdGiVariant's type to kString and assigns a new value.
| value | [in] Input new char array to set as a string value. |
| void OdGiVariant::set | ( | const OdCmEntityColor & | value | ) |
Changes the OdGiVariant's type to kColor and assigns a new value.
| value | [in] Input new color value to set. |
Changes the OdGiVariant's type to kString and assigns a new value.
| value | [in] Input new string value to set. |
| void OdGiVariant::set | ( | double | value | ) |
Changes the OdGiVariant's type to kDouble and assigns a new value.
| value | [in] Input new floating point value to set. |
Changes the OdGiVariant's type to kInt and assigns a new value.
| value | [in] Input new long value to set. |
| void OdGiVariant::setElem | ( | const OdString & | elem, |
| const OdGiVariant & | value | ||
| ) |
Adds the specified value to the table with the specified string key. If the object isn't of the kTable type, the method converts the type to kTable.
| value | [in] Value to be added with the elem key. |
| elem | [in] Input string key with which to add the value. |
| VariantType OdGiVariant::type | ( | ) | const |
Returns the current type of the OdGiVariant object. All available types are defined in the VariantType enumeration.