Itasca C++ Interface
|
A simpler (and slightly faster) version of a QVariant, added for interfaces that do not use Qt. More...
#include <variant.h>
Classes | |
class | VUserType |
This is a helper class, designed to make it possible to allow user-defined types to be encoded in a Variant. . More... | |
class | VUserType< void * > |
Template specialization for void pointers; this should probably never be used, except to determine the size of VUserType for type_selector. More... | |
Public Types | |
enum class | Type { Type::Byte = 1 , Type::UByte , Type::Short , Type::UShort , Type::Int , Type::UInt , Type::Long , Type::ULong , Type::Float , Type::Double , Type::Void , Type::Bool , Type::IVect2 , Type::DVect2 , Type::IVect3 , Type::DVect3 , Type::RawData , Type::String = 100 , Type::User } |
Indicates the type of the variant. 18 types are predefined. More... | |
Public Member Functions | |
BASE_EXPORT | Variant (const Variant &mv) |
Copy constructor. | |
BASE_EXPORT | Variant (const int32 &v=0) |
BASE_EXPORT | Variant (const bool &v) |
BASE_EXPORT | Variant (const int8 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT | Variant (const uint8 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT | Variant (const int16 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT | Variant (const uint16 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT | Variant (const uint32 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT | Variant (const int64 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT | Variant (const uint64 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT | Variant (const float &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT | Variant (const double &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT | Variant (void *v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT | Variant (const void *v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT | Variant (const IVect2 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT | Variant (const DVect2 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT | Variant (const IVect3 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT | Variant (const DVect3 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT | Variant (const string &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT | Variant (const char *v) |
BASE_EXPORT | ~Variant () |
Destructor. | |
BASE_EXPORT const Variant & | operator= (const Variant &mv) |
Equality operator. | |
BASE_EXPORT Type | getType () const |
The type of the Variant. Note that this may be a user-defined value. | |
BASE_EXPORT string | getTypeName () const |
A string indicating the Variant type. | |
BASE_EXPORT bool | toBool (bool *success=0) const |
BASE_EXPORT int8 | toByte (bool *success=0) const |
BASE_EXPORT uint8 | toUByte (bool *success=0) const |
BASE_EXPORT int16 | toShort (bool *success=0) const |
BASE_EXPORT uint16 | toUShort (bool *success=0) const |
BASE_EXPORT int32 | toInt (bool *success=0) const |
BASE_EXPORT uint32 | toUInt (bool *success=0) const |
BASE_EXPORT int64 | toLong (bool *success=0) const |
BASE_EXPORT uint64 | toULong (bool *success=0) const |
BASE_EXPORT float | toFloat (bool *success=0) const |
BASE_EXPORT double | toDouble (bool *success=0) const |
BASE_EXPORT string | toString (bool *success=0) const |
BASE_EXPORT void * | toVoid (bool *success=0) const |
BASE_EXPORT IVect2 | toIVect2 (bool *success=0) const |
BASE_EXPORT DVect2 | toDVect2 (bool *success=0) const |
BASE_EXPORT IVect3 | toIVect3 (bool *success=0) const |
BASE_EXPORT DVect3 | toDVect3 (bool *success=0) const |
BASE_EXPORT const int32 & | fastToInt () const |
BASE_EXPORT const bool & | fastToBool () const |
BASE_EXPORT const int64 & | fastToLong () const |
BASE_EXPORT const double & | fastToDouble () const |
BASE_EXPORT const DVect2 & | fastToDVect2 () const |
BASE_EXPORT const DVect3 & | fastToDVect3 () const |
BASE_EXPORT const string & | fastToString () const |
const Variant & | operator= (const bool &v) |
Assignment operator for a specific type, converts the Variant to the same type and value. | |
const Variant & | operator= (const int8 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (const uint8 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (const int16 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (const uint16 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (const int32 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (const uint32 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (const int64 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (const uint64 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (const float &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (const double &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (void *v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (const void *v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (const IVect2 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (const DVect2 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (const DAVect2 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (const IVect3 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (const DVect3 &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT const Variant & | operator= (const string &v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const Variant & | operator= (const char *v) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
BASE_EXPORT void | setToRawData () |
char * | getRawData () |
const char * | getRawData () const |
template<class T > | |
void | setToUserType (const T &t) |
template<class T > | |
void | moveToUserType (T &&t) |
template<class T > | |
T & | convertToUserType () |
template<class T > | |
T | toUserType () const |
template<class T > | |
T & | fastToUserType () |
template<class T > | |
const T & | fastToUserType () const |
template<class T > | |
bool | isUserType () const |
Static Public Member Functions | |
static BASE_EXPORT string | getTypeName (Type type) |
Returns the name associated with a given type value, of "UnKnown" if the type is not valid. | |
static BASE_EXPORT int | getRawDataSize () |
static BASE_EXPORT bool | getUserTypeClaimed (int type) |
template<class T > | |
static bool | registerType (int type, const string &name) |
This method allows user-defined types to be encoded in a variant. | |
Friends | |
template<class T > | |
class | VUserType |
BASE_EXPORT QDataStream & | operator<< (QDataStream &, const Variant &) |
Allows writing a Variant to a QDataStream. | |
A simpler (and slightly faster) version of a QVariant, added for interfaces that do not use Qt.
This class implements a variant. Used when parameters need to be passed or returned but the type could vary.
These types could be integral, floating-point, strings, 2D or 3D vectors, etc.
This type is used in the property interface for constitutive models, and by FISH.
If QT is active, it is preferred you use the Qt QVariant class.
QVariant is more general, but this version should perform better at runtime.