soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SEmptyable< T > Class Template Reference

A template class that can represent a value or be empty (NULL). More...

#include <SEmptyable.hpp>

Public Member Functions

 SEmptyable (T val)
 Constructor with initial value.
 
 SEmptyable ()
 Default constructor. Initializes the object in an empty state.
 
bool isEmpty () const
 Checks if the object is empty.
 
bool operator== (const SEmptyable &right) const
 Equality operator with another SEmptyable object.
 
bool operator== (const T &right) const
 Equality operator with a value of type T.
 
bool operator!= (const SEmptyable &right) const
 Inequality operator with another SEmptyable object.
 
bool operator!= (const T &right) const
 Inequality operator with a value of type T.
 
bool operator< (const SEmptyable &right) const
 Less-than operator with another SEmptyable object.
 
bool operator< (const T &right) const
 Less-than operator with a value of type T.
 
SEmptyableoperator= (const SEmptyable &right)
 Assignment operator from another SEmptyable object.
 
SEmptyableoperator= (const T &val)
 Assignment operator from a value of type T.
 
 operator T () const
 Conversion operator to type T.
 
void reset ()
 Resets the object to an empty state.
 

Detailed Description

template<class T>
class SEmptyable< T >

A template class that can represent a value or be empty (NULL).

This class allows a variable to either hold a value of type T or be in an empty state.

Template Parameters
TThe type of the value to be stored.

Definition at line 15 of file SEmptyable.hpp.

Constructor & Destructor Documentation

◆ SEmptyable() [1/2]

template<class T>
SEmptyable< T >::SEmptyable ( T val)
inline

Constructor with initial value.

Parameters
valThe initial value to store.

Definition at line 22 of file SEmptyable.hpp.

◆ SEmptyable() [2/2]

template<class T>
SEmptyable< T >::SEmptyable ( )
inline

Default constructor. Initializes the object in an empty state.

Definition at line 31 of file SEmptyable.hpp.

Member Function Documentation

◆ isEmpty()

template<class T>
bool SEmptyable< T >::isEmpty ( ) const
inline

Checks if the object is empty.

Returns
TRUE if the object is empty, FALSE otherwise.

Definition at line 40 of file SEmptyable.hpp.

◆ operator T()

template<class T>
SEmptyable< T >::operator T ( ) const
inline

Conversion operator to type T.

Returns
The stored value.
Note
Asserts that the object is not empty.

Definition at line 165 of file SEmptyable.hpp.

◆ operator!=() [1/2]

template<class T>
bool SEmptyable< T >::operator!= ( const SEmptyable< T > & right) const
inline

Inequality operator with another SEmptyable object.

Parameters
rightThe SEmptyable object to compare with.
Returns
TRUE if the objects are not equal, FALSE otherwise.

Definition at line 86 of file SEmptyable.hpp.

◆ operator!=() [2/2]

template<class T>
bool SEmptyable< T >::operator!= ( const T & right) const
inline

Inequality operator with a value of type T.

Parameters
rightThe value to compare with.
Returns
TRUE if the object does not hold the same value, FALSE otherwise.

Definition at line 96 of file SEmptyable.hpp.

◆ operator<() [1/2]

template<class T>
bool SEmptyable< T >::operator< ( const SEmptyable< T > & right) const
inline

Less-than operator with another SEmptyable object.

Parameters
rightThe SEmptyable object to compare with.
Returns
TRUE if this object is less than the other object, FALSE otherwise.

Definition at line 106 of file SEmptyable.hpp.

◆ operator<() [2/2]

template<class T>
bool SEmptyable< T >::operator< ( const T & right) const
inline

Less-than operator with a value of type T.

Parameters
rightThe value to compare with.
Returns
TRUE if this object holds a value less than the given value, FALSE otherwise.

Definition at line 126 of file SEmptyable.hpp.

◆ operator=() [1/2]

template<class T>
SEmptyable & SEmptyable< T >::operator= ( const SEmptyable< T > & right)
inline

Assignment operator from another SEmptyable object.

Parameters
rightThe SEmptyable object to assign from.
Returns
Reference to the current object.

Definition at line 141 of file SEmptyable.hpp.

◆ operator=() [2/2]

template<class T>
SEmptyable & SEmptyable< T >::operator= ( const T & val)
inline

Assignment operator from a value of type T.

Parameters
valThe value to assign.
Returns
Reference to the current object.

Definition at line 153 of file SEmptyable.hpp.

◆ operator==() [1/2]

template<class T>
bool SEmptyable< T >::operator== ( const SEmptyable< T > & right) const
inline

Equality operator with another SEmptyable object.

Parameters
rightThe SEmptyable object to compare with.
Returns
TRUE if both objects are equal, FALSE otherwise.

Definition at line 50 of file SEmptyable.hpp.

◆ operator==() [2/2]

template<class T>
bool SEmptyable< T >::operator== ( const T & right) const
inline

Equality operator with a value of type T.

Parameters
rightThe value to compare with.
Returns
TRUE if the object holds the same value, FALSE otherwise.

Definition at line 71 of file SEmptyable.hpp.

◆ reset()

template<class T>
void SEmptyable< T >::reset ( )
inline

Resets the object to an empty state.

Definition at line 174 of file SEmptyable.hpp.


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