ACF $AcfVersion:0$
Public Member Functions | List of all members
istd::TNullable< T > Class Template Reference

#include <TNullable.h>

Public Member Functions

 TNullable ()
 
 TNullable (const T &value)
 
 TNullable (T &&value)
 
 ~TNullable ()
 
bool IsValid () const
 Checks whether the container has been initialized with a value, even if it is a NULL value.
 
bool IsNull () const
 Checks whether the container has been explicitly initialized with a NULL value.
 
bool HasValue () const
 Checks whether the container has been initialized with a specific value.
 
const T * GetPtr () const
 access the pointer of value
 
T * GetPtr ()
 
T & GetValue ()
 access the value
 
const T & GetValue () const
 
void Reset ()
 Resets a container and destroys a value.
 
T & Emplace ()
 Initializes a container with a default value.
 
void SetNull ()
 Destroys a containing value (if was set), and sets state of a container to NULL.
 
TNullableoperator= (const T &value)
 
TNullableoperator= (T &&value)
 
const T * operator-> () const
 
T * operator-> ()
 
const T & operator* () const &
 
T & operator* () &
 
const T && operator* () const &&
 
T && operator* () &&
 
TNullableoperator= (std::nullptr_t)
 
TNullableoperator= (const TNullable &other)
 
 operator bool () const
 
bool has_value () const
 
T & value () &
 
const T & value () const &
 
T && value () &&
 
const T && value () const &&
 
value_or (const T &default_value) const
 
void swap (TNullable &other)
 
void reset ()
 
T & emplace ()
 
T & emplace (T &&value) &&
 
bool operator== (const TNullable &other) const
 
bool operator!= (const TNullable &other) const
 
bool operator== (std::nullptr_t) const
 
bool operator!= (std::nullptr_t) const
 
bool operator== (const T &value) const
 
bool operator!= (const T &value) const
 

Detailed Description

template<class T>
class istd::TNullable< T >

Definition at line 20 of file TNullable.h.

Constructor & Destructor Documentation

◆ TNullable() [1/3]

template<class T >
istd::TNullable< T >::TNullable ( )

Definition at line 173 of file TNullable.h.

◆ TNullable() [2/3]

template<class T >
istd::TNullable< T >::TNullable ( const T &  value)
inline

Definition at line 183 of file TNullable.h.

References istd::TNullable< T >::value().

◆ TNullable() [3/3]

template<class T >
istd::TNullable< T >::TNullable ( T &&  value)
inline

Definition at line 194 of file TNullable.h.

References istd::TNullable< T >::value().

◆ ~TNullable()

template<class T >
istd::TNullable< T >::~TNullable ( )

Definition at line 205 of file TNullable.h.

Member Function Documentation

◆ Emplace()

template<class T >
T & istd::TNullable< T >::Emplace ( )

Initializes a container with a default value.

Returns
a reference to a created value
Note
for primitive types don't forget to initialize with a value
value.Emplace() = 50; // initialize
T & Emplace()
Initializes a container with a default value.
Definition TNullable.h:279

Definition at line 279 of file TNullable.h.

◆ emplace() [1/2]

template<class T >
T & istd::TNullable< T >::emplace ( )

Definition at line 506 of file TNullable.h.

◆ emplace() [2/2]

template<class T >
T & istd::TNullable< T >::emplace ( T &&  value) &&

Definition at line 513 of file TNullable.h.

◆ GetPtr() [1/2]

template<class T >
T * istd::TNullable< T >::GetPtr ( )

Definition at line 242 of file TNullable.h.

◆ GetPtr() [2/2]

template<class T >
const T * istd::TNullable< T >::GetPtr ( ) const

access the pointer of value

Returns
a pointer to a stored value

Definition at line 235 of file TNullable.h.

◆ GetValue() [1/2]

template<class T >
T & istd::TNullable< T >::GetValue ( )

access the value

Returns
a reference to a value
Warning
before call this method you MUST ensure, the container was initialized with a non-NULL value! Call HasValue() before.

Definition at line 249 of file TNullable.h.

◆ GetValue() [2/2]

template<class T >
const T & istd::TNullable< T >::GetValue ( ) const

Definition at line 258 of file TNullable.h.

◆ has_value()

template<class T >
bool istd::TNullable< T >::has_value ( ) const

Definition at line 435 of file TNullable.h.

◆ HasValue()

template<class T >
bool istd::TNullable< T >::HasValue ( ) const

Checks whether the container has been initialized with a specific value.

Returns
true if a non-NULL value was set, and false if a null value was set or if no value was set.
value.HasValue(); // false
value = 50;
value.HasValue(); // true
value.SetNull();
value.HasValue(); // false
bool HasValue() const
Checks whether the container has been initialized with a specific value.
Definition TNullable.h:228

Definition at line 228 of file TNullable.h.

◆ IsNull()

template<class T >
bool istd::TNullable< T >::IsNull ( ) const

Checks whether the container has been explicitly initialized with a NULL value.

Returns
true if a NULL value was set, and false if a non-NULL value was set or if no value was set.
See also
SetNull
value.IsNull(); // false
value = 50;
value.IsNull(); // false
value.SetNull();
value.IsNull(); // true
bool IsNull() const
Checks whether the container has been explicitly initialized with a NULL value.
Definition TNullable.h:221

Definition at line 221 of file TNullable.h.

◆ IsValid()

template<class T >
bool istd::TNullable< T >::IsValid ( ) const
inline

Checks whether the container has been initialized with a value, even if it is a NULL value.

Returns
true if a value has been initialized or a NULL value was set and false otherwise
See also
IsNull
HasValue

Definition at line 214 of file TNullable.h.

◆ operator bool()

template<class T >
istd::TNullable< T >::operator bool ( ) const
explicit

Definition at line 428 of file TNullable.h.

◆ operator!=() [1/3]

template<class T >
bool istd::TNullable< T >::operator!= ( const T &  value) const

Definition at line 572 of file TNullable.h.

◆ operator!=() [2/3]

template<class T >
bool istd::TNullable< T >::operator!= ( const TNullable< T > &  other) const

Definition at line 538 of file TNullable.h.

◆ operator!=() [3/3]

template<class T >
bool istd::TNullable< T >::operator!= ( std::nullptr_t  ) const

Definition at line 552 of file TNullable.h.

◆ operator*() [1/4]

template<class T >
T & istd::TNullable< T >::operator* ( ) &

Definition at line 370 of file TNullable.h.

◆ operator*() [2/4]

template<class T >
T && istd::TNullable< T >::operator* ( ) &&

Definition at line 388 of file TNullable.h.

◆ operator*() [3/4]

template<class T >
const T & istd::TNullable< T >::operator* ( ) const &

Definition at line 361 of file TNullable.h.

◆ operator*() [4/4]

template<class T >
const T && istd::TNullable< T >::operator* ( ) const &&

Definition at line 379 of file TNullable.h.

◆ operator->() [1/2]

template<class T >
T * istd::TNullable< T >::operator-> ( )

Definition at line 352 of file TNullable.h.

◆ operator->() [2/2]

template<class T >
const T * istd::TNullable< T >::operator-> ( ) const

Definition at line 343 of file TNullable.h.

◆ operator=() [1/4]

template<class T >
TNullable< T > & istd::TNullable< T >::operator= ( const T &  value)

Definition at line 306 of file TNullable.h.

◆ operator=() [2/4]

template<class T >
TNullable< T > & istd::TNullable< T >::operator= ( const TNullable< T > &  other)

Definition at line 408 of file TNullable.h.

◆ operator=() [3/4]

template<class T >
TNullable< T > & istd::TNullable< T >::operator= ( std::nullptr_t  )

Definition at line 397 of file TNullable.h.

◆ operator=() [4/4]

template<class T >
TNullable< T > & istd::TNullable< T >::operator= ( T &&  value)

Definition at line 323 of file TNullable.h.

◆ operator==() [1/3]

template<class T >
bool istd::TNullable< T >::operator== ( const T &  value) const

Definition at line 559 of file TNullable.h.

◆ operator==() [2/3]

template<class T >
bool istd::TNullable< T >::operator== ( const TNullable< T > &  other) const

Definition at line 525 of file TNullable.h.

◆ operator==() [3/3]

template<class T >
bool istd::TNullable< T >::operator== ( std::nullptr_t  ) const

Definition at line 545 of file TNullable.h.

◆ Reset()

template<class T >
void istd::TNullable< T >::Reset ( )

Resets a container and destroys a value.

Definition at line 266 of file TNullable.h.

◆ reset()

template<class T >
void istd::TNullable< T >::reset ( )

Definition at line 499 of file TNullable.h.

◆ SetNull()

template<class T >
void istd::TNullable< T >::SetNull ( )
inline

Destroys a containing value (if was set), and sets state of a container to NULL.

value.HasValue(); // false
value.IsNull(); // false
value.IsValid(); // false
value = 50;
value.HasValue(); // false
value.IsNull(); // false
value.IsValid(); // true
value.SetNull();
value.HasValue(); // false
value.IsNull(); // true
value.IsValid(); // true

Definition at line 295 of file TNullable.h.

◆ swap()

template<class T >
void istd::TNullable< T >::swap ( TNullable< T > &  other)

Definition at line 489 of file TNullable.h.

◆ value() [1/4]

template<class T >
T & istd::TNullable< T >::value ( ) &

◆ value() [2/4]

template<class T >
T && istd::TNullable< T >::value ( ) &&

Definition at line 460 of file TNullable.h.

◆ value() [3/4]

template<class T >
const T & istd::TNullable< T >::value ( ) const &

Definition at line 451 of file TNullable.h.

◆ value() [4/4]

template<class T >
const T && istd::TNullable< T >::value ( ) const &&

Definition at line 469 of file TNullable.h.

◆ value_or()

template<class T >
T istd::TNullable< T >::value_or ( const T &  default_value) const

Definition at line 478 of file TNullable.h.


The documentation for this class was generated from the following file: