Rebel Fork Framework
Variant.h File Reference
#include <EASTL/optional.h>
#include <EASTL/type_traits.h>
#include <EASTL/vector.h>
#include <EASTL/unordered_map.h>
#include <EASTL/unique_ptr.h>
#include "../Container/Ptr.h"
#include "../Container/ByteVector.h"
#include "../Core/Assert.h"
#include "../Core/Exception.h"
#include "../Core/TypeTrait.h"
#include "../Math/Color.h"
#include "../Math/Matrix3.h"
#include "../Math/Matrix3x4.h"
#include "../Math/Rect.h"
#include "../Math/StringHash.h"
#include <typeinfo>

Classes

struct  Urho3D::ResourceRef
 Typed resource reference. More...
 
struct  Urho3D::ResourceRefList
 List of typed resource references. More...
 
class  Urho3D::CustomVariantValue
 
struct  Urho3D::CustomVariantValueTraits< T >
 Custom variant value type traits. Specialize the template to implement custom type behavior. More...
 
struct  Urho3D::CustomVariantValueTraits< ea::unique_ptr< T > >
 Custom variant value type traits for unique_ptr. More...
 
class  Urho3D::CustomVariantValueImpl< T >
 Custom variant value implementation. More...
 
union  Urho3D::VariantValue
 Union for the possible variant values. Objects exceeding the VARIANT_VALUE_SIZE are allocated on the heap. More...
 
class  Urho3D::Variant
 Variable that supports a fixed set of types. More...
 

Typedefs

using Urho3D::VariantVector = ea::vector< Variant >
 Vector of variants.
 
using Urho3D::StringVector = ea::vector< ea::string >
 Vector of strings.
 
using Urho3D::VariantMap = ea::unordered_map< StringHash, Variant >
 Map of variants.
 
using Urho3D::StringVariantMap = ea::unordered_map< ea::string, Variant, ea::hash< ea::string >, ea::equal_to< ea::string >, EASTLAllocatorType, true >
 Map from string to Variant. Cache string hashes.
 
using Urho3D::VariantBuffer = ByteVector
 

Enumerations

enum  Urho3D::VariantType : unsigned char {
  VAR_NONE = 0, VAR_INT, VAR_BOOL, VAR_FLOAT,
  VAR_VECTOR2, VAR_VECTOR3, VAR_VECTOR4, VAR_QUATERNION,
  VAR_COLOR, VAR_STRING, VAR_BUFFER, VAR_VOIDPTR,
  VAR_RESOURCEREF, VAR_RESOURCEREFLIST, VAR_VARIANTVECTOR, VAR_VARIANTMAP,
  VAR_INTRECT, VAR_INTVECTOR2, VAR_PTR, VAR_MATRIX3,
  VAR_MATRIX3X4, VAR_MATRIX4, VAR_DOUBLE, VAR_STRINGVECTOR,
  VAR_RECT, VAR_INTVECTOR3, VAR_INT64, VAR_CUSTOM,
  VAR_VARIANTCURVE, VAR_STRINGVARIANTMAP, MAX_VAR_TYPES, Urho3D::MAX_VAR_MASK = 0b00111111
}
 Variant's supported types. More...
 

Functions

 Urho3D::URHO3D_TYPE_TRAIT (IsEquallyComparable, std::declval< T >()==std::declval< T >())
 
 Urho3D::URHO3D_TYPE_TRAIT (IsConvertibleToString, std::declval< T >().ToString())
 
 Urho3D::URHO3D_TYPE_TRAIT (IsArchiveSerializable, SerializeValue(std::declval< Archive & >(), "", std::declval< T & >()))
 
template<class T >
constexpr bool Urho3D::IsCustomTypeOnStack ()
 Checks whether the custom variant type could be stored on stack.
 
template<typename T >
Variant Urho3D::MakeCustomValue (T &&value)
 Make custom variant value.
 
unsigned Urho3D::GetVariantTypeSize (VariantType type)
 Return variant size in bytes from type. This is not the same as size of Variant class instance, this is a size of corresponding type.
 
ea::vector< const char * > Urho3D::ToCStringVector (const StringVector &strings)
 Cast StringVector to C string vector.
 
template<typename T >
VariantType Urho3D::GetVariantType ()
 Return variant type from type.
 
template<>
VariantType Urho3D::GetVariantType< int > ()
 
template<>
VariantType Urho3D::GetVariantType< unsigned > ()
 
template<>
VariantType Urho3D::GetVariantType< long long > ()
 
template<>
VariantType Urho3D::GetVariantType< unsigned long long > ()
 
template<>
VariantType Urho3D::GetVariantType< bool > ()
 
template<>
VariantType Urho3D::GetVariantType< float > ()
 
template<>
VariantType Urho3D::GetVariantType< double > ()
 
template<>
VariantType Urho3D::GetVariantType< Vector2 > ()
 
template<>
VariantType Urho3D::GetVariantType< Vector3 > ()
 
template<>
VariantType Urho3D::GetVariantType< Vector4 > ()
 
template<>
VariantType Urho3D::GetVariantType< Quaternion > ()
 
template<>
VariantType Urho3D::GetVariantType< Color > ()
 
template<>
VariantType Urho3D::GetVariantType< ea::string > ()
 
template<>
VariantType Urho3D::GetVariantType< StringHash > ()
 
template<>
VariantType Urho3D::GetVariantType< VariantBuffer > ()
 
template<>
VariantType Urho3D::GetVariantType< ResourceRef > ()
 
template<>
VariantType Urho3D::GetVariantType< ResourceRefList > ()
 
template<>
VariantType Urho3D::GetVariantType< VariantVector > ()
 
template<>
VariantType Urho3D::GetVariantType< StringVector > ()
 
template<>
VariantType Urho3D::GetVariantType< VariantMap > ()
 
template<>
VariantType Urho3D::GetVariantType< Rect > ()
 
template<>
VariantType Urho3D::GetVariantType< IntRect > ()
 
template<>
VariantType Urho3D::GetVariantType< IntVector2 > ()
 
template<>
VariantType Urho3D::GetVariantType< IntVector3 > ()
 
template<>
VariantType Urho3D::GetVariantType< Matrix3 > ()
 
template<>
VariantType Urho3D::GetVariantType< Matrix3x4 > ()
 
template<>
VariantType Urho3D::GetVariantType< Matrix4 > ()
 
template<>
VariantType Urho3D::GetVariantType< VariantCurve > ()
 
template<>
VariantType Urho3D::GetVariantType< StringVariantMap > ()
 
template<>
const ea::string & Urho3D::Variant::Get< const ea::string & > (int) const
 
template<>
ea::string Urho3D::Variant::Get< ea::string > (int) const
 

Variables

static const unsigned Urho3D::VARIANT_VALUE_SIZE = sizeof(void*) * 4
 Size of variant value. 16 bytes on 32-bit platform, 32 bytes on 64-bit platform.
 

Typedef Documentation

◆ VariantBuffer

using Urho3D::VariantBuffer = typedef ByteVector

Deprecated. Use ByteVector instead. TODO: Rename all instances of VariantBuffer to ByteVector.

Enumeration Type Documentation

◆ VariantType

enum Urho3D::VariantType : unsigned char

Variant's supported types.

Enumerator
MAX_VAR_MASK 

There should be at most 64 variant types.