![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <Variant.h>
Public Member Functions | |
| FVariant () | |
| FVariant (const FVariant &)=default | |
| FVariant & | operator= (const FVariant &)=default |
| ~FVariant ()=default | |
| FVariant (FVariant &&Other) | |
| FVariant & | operator= (FVariant &&Other) |
| template<typename T > | |
| FVariant (T InValue) | |
| FVariant (TArray< uint8 > &&InArray) | |
| FVariant (const TArray< uint8 > &InArray) | |
| FVariant (const TCHAR *InString) | |
| template<typename T > | |
| FVariant & | operator= (T InValue) |
| FVariant & | operator= (TArray< uint8 > &&InArray) |
| FVariant & | operator= (const TArray< uint8 > &InArray) |
| FVariant & | operator= (const TCHAR *InString) |
| template<typename T > | |
| operator T () const | |
| bool | operator== (const FVariant &Other) const |
| bool | operator!= (const FVariant &Other) const |
| void | Empty () |
| bool | IsEmpty () const |
| const TArray< uint8 > & | GetBytes () const |
| int32 | GetSize () const |
| EVariantTypes | GetType () const |
| template<typename T > | |
| T | GetValue () const |
| template<> | |
| TArray< uint8 > | GetValue () const |
Friends | |
| FArchive & | operator<< (FArchive &Ar, FVariant &Variant) |
Implements an extensible union of multiple types.
Variant types can be used to store a range of different built-in types, as well as user defined types. The values are internally serialized into a byte array, which means that only FArchive serializable types are supported at this time.
|
inline |
Default constructor.
|
default |
|
default |
|
inline |
|
inline |
Creates and initializes a new instance with the specified value.
| InValue | The initial value. |
Creates and initializes a new instance from a byte array.
Array values are passed straight through as an optimization. Please note that, if you serialize any complex types into arrays and then store them in FVariant, you will be responsible for ensuring byte ordering if the FVariant gets sent over the network.
| InValue- | The initial value. |
|
inline |
Creates and initializes a new instance from a TCHAR string.
| InString | The initial value. |
Gets the stored value as a byte array.
This method returns the internal representation of any value as an array of raw bytes. To retrieve values of type TArray<uint8> use GetValue<TArray<uint8>>() instead.
|
inline |
|
inline |
Gets the stored value for byte arrays.
Array values are passed straight through as an optimization. Please note that, if you serialize any complex types into arrays and then store them in FVariant, you will be responsible for ensuring byte ordering if the FVariant gets send over the network.
To retrieve any value as an array of serialized bytes, use GetBytes() instead.
|
inline |
|
inline |
Checks whether the value is empty.
|
inline |
Implicit conversion operator.
| T | The type to convert the value to. |
Comparison operator for inequality.
| Other | The variant to compare with. |
Assignment operator for TCHAR strings.
| InString | The value to assign. |
Assignment operator.
| T | The type of the value to assign. |
| InValue | The value to assign. |
Assignment operator for byte arrays.
Array values are passed straight through as an optimization. Please note that, if you serialize any complex types into arrays and then store them in FVariant, you will be responsible for ensuring byte ordering if the FVariant gets sent over the network.
| InArray | The byte array to assign. |
Comparison operator for equality.
| Other | The variant to compare with. |
Serializes the given variant type from or into the specified archive.
| Ar | The archive to serialize from or into. |
| Variant | The value to serialize. |