# cee::Variant

class `Variant`

  The Variant class acts like a union for the most common data types.

  A Variant object holds a single value of a single type() at a time. The methods named get*() (e.g., getInt(), getString()) are const.

  Public Types

  enum `DataType`

    List of variant data types.

    Values:

    enumerator `INVALID`

      Invalid.

    enumerator `INT`

      Integer data type (int)

    enumerator `UINT`

      Unsigned integer data type (unsigned int)

    enumerator `DOUBLE`

      Double precision data type (double)

    enumerator `FLOAT`

      Floating point data type (float)

    enumerator `BOOL`

      Boolean data type (bool)

    enumerator `VEC3D`

      Vector data type (cee::Vec3d)

    enumerator `COLOR3F`

      Color data type (cee::Color3f)

    enumerator `STRING`

      String data type (cee::Str)

    enumerator `ARRAY`

      Array data type (std::vector)

  Public Functions

  `Variant`()

    Creates an empty Variant.

  `Variant`(const Variant &other)

    Creates a Variant as a copy of another Variant.

  `Variant`(int val)

    Creates a Variant with the int value val.

  `Variant`(unsigned int val)

    Creates a Variant with the unsigned int value val.

  `Variant`(double val)

    Creates a Variant with the double value val.

  `Variant`(float val)

    Creates a Variant with the float value val.

  `Variant`(bool val)

    Creates a Variant with the bool value val.

  `Variant`(const Vec3d &val)

    Creates a Variant with the Vec3d value val.

  `Variant`(const Color3f &val)

    Creates a Variant with the Color3f value val.

  `Variant`(const Str &val)

    Creates a Variant with the Str value val.

  `Variant`(const char *val)

    Creates a Variant with the const char pointer val.

  `Variant`(const std::vector<Variant> &arr)

    Creates a Variant from an array of Variant arr.

  Variant &`operator=`(const Variant &rhs)

    Assigns rhs to this and returns a reference to this Variant.

  bool `operator==`(const Variant &rhs) const

    Returns true if rhs is equal to this Variant; otherwise returns false.

  bool `operator!=`(const Variant &rhs) const

    Returns true if rhs is not equal to this Variant; otherwise returns false.

  DataType `type`() const

    Returns the data type of this Variant.

  bool `isValid`() const

    Returns true if this is a valid Variant.

  int `getInt`() const

    Returns the current value as an int.

    Assumes that the type of the Variant is INT. No conversion is done.

  unsigned int `getUInt`() const

    Returns the current value as an unsigned int.

    Assumes that the type of the Variant is UINT. No conversion is done.

  double `getDouble`() const

    Returns the current value as a double.

    Assumes that the type of the Variant is DOUBLE. No conversion is done.

  float `getFloat`() const

    Returns the current value as a float.

    Assumes that the type of the Variant is FLOAT. No conversion is done.

  bool `getBool`() const

    Returns the current value as a bool.

    Assumes that the type of the Variant is BOOL. No conversion is done.

  Vec3d `getVec3d`() const

    Returns the current value as a Vec3d.

    Assumes that the type of the Variant is VEC3D. No conversion is done.

  Color3f `getColor3f`() const

    Returns the current value as a Color3f.

    Assumes that the type of the Variant is COLOR3F. No conversion is done.

  Str `getString`() const

    Returns the current value as a string.

    Assumes that the type of the Variant is STRING. No conversion is done.

  std::vector<Variant> `getArray`() const

    Returns the array of variants.

    Assumes that the type of the Variant is ARRAY. No conversion is done.

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your Docs generative AI assistant. Ask me anything about HOOPS Envision for Desktop or choose a sample question below to start a conversation:

What is HOOPS Envision for Desktop?
What are the latest release notes for HOOPS Envision for Desktop?
How do I start evaluating HOOPS Envision for Desktop?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...