Class Varying

Nested Relationships

Nested Types

Class Documentation

class Varying

Public Types

template<typename T>
using StringType = typename std::enable_if_t<IsString<T>::value, T>
template<typename T>
using SignedIntegerType = typename std::enable_if_t<IsSignedInteger<T>::value, T>
template<typename T>
using UnsignedIntegerType = typename std::enable_if_t<IsUnsignedInteger<T>::value, T>
template<typename T>
using UserDataType = typename std::enable_if_t<IsUserData<T>::value, T>

Public Functions

template<typename T>
inline explicit Varying(const T &value)

Generalized constructor for bool, integral- and float-types. This constructor has been specialized for std::string and std::vector<std::byte>.

explicit Varying(const std::vector<std::byte> &value)

Constructor for an arbitrary sequence of bytes value.

explicit Varying(const std::string &value)

Constructor for a string value.

inline explicit Varying(const char *value)

Constructor for a string literal value.

Varying(const Varying &other)

Copy constructor.

Varying(Varying &&other) noexcept

Move constructor.

Varying &operator=(const Varying &other)

Assignment operator. i.e., type_A = type_B.

Varying &operator=(const std::vector<std::byte> &value)

Assigns an arbitrary sequence of bytes value.

Varying &operator=(const std::string &value)

Assigns a string value.

template<typename T, std::enable_if_t<IsBool<T>::value, bool> = true>
inline Varying &operator=(const T &value)

Assigns a bool value.

template<typename T, std::enable_if_t<IsInteger<T>::value, bool> = true>
inline Varying &operator=(const T &value)

Assigns an integer value.

template<typename T, std::enable_if_t<IsFloat<T>::value, bool> = true>
inline Varying &operator=(const T &value)

Assign a floating point value.

inline bool operator==(const Varying &that) const

Equality operator.

inline bool operator!=(const Varying &that) const

Inequality operator.

inline bool operator>(const Varying &that) const

Relation operators.

inline bool operator>=(const Varying &that) const

Relation operators.

inline bool operator<(const Varying &that) const

Relation operators.

inline bool operator<=(const Varying &that) const

Relation operators.

template<typename T>
inline BoolType<T> GetValue() const

Returns values of type bool if able.

template<typename T>
inline FloatType<T> GetValue() const

Returns floating point values if able.

template<typename T>
inline StringType<T> GetValue() const

Returns a string if able.

template<typename T>
inline SignedIntegerType<T> GetValue() const

Returns a signed integer if able.

template<typename T>
inline UnsignedIntegerType<T> GetValue() const

Returns an unsigned integer if able.

template<typename T>
inline UserDataType<T> GetValue() const

Returns user data if able.

std::string GetStringValue() const

Returns the string value if valid. Otherwise throws std::logic_error.

bool GetBoolValue() const

Returns the bool value if valid. Otherwise throws std::logic_error.

int64_t GetIntegerValue() const

Returns the integer value if valid. Otherwise throws std::logic_error.

double GetFloatValue() const

Returns the float value if valid. Otherwise throws std::logic_error.

template<typename T>
inline T GetUserDataValue() const
size_t GetByteSize() const

Returns the raw byte size associated with the type.

inline VaryingDataType GetType() const

Returns the current-type of the variable.

inline std::string GetTypeName() const

Returns the string type name of the type.

std::string PrintStr(bool with_type = true) const

Returns a string value for the value.

~Varying() = default

Public Static Functions

static inline std::unique_ptr<VaryingType> Helper(const bool &value)
static inline std::unique_ptr<VaryingType> Helper(const int64_t &value)
static inline std::unique_ptr<VaryingType> Helper(const double &value)
static inline std::unique_ptr<VaryingType> Helper(const Vector3 &value)
template<typename T>
static inline std::unique_ptr<VaryingType> Helper(const std::shared_ptr<T> &value)
template<typename T>
static inline T DefaultValue()

Returns a default value for the type required.

template<typename T>
struct IsSignedInteger

Public Static Attributes

static bool value = std::is_integral_v<T> and std::is_signed_v<T> and not std::is_same_v<T, bool>
template<typename T>
struct IsUnsignedInteger

Public Static Attributes

static bool value = std::is_integral_v<T> and std::is_unsigned_v<T> and not std::is_same_v<T, bool>