PACK Qt Binding  $VERSION$
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
Public Member Functions | List of all members
Nullable< T > Class Template Reference

#include <nullable.h>

Public Member Functions

 Nullable ()
 
 Nullable (const NullValue &)
 
 Nullable (const std::nullptr_t &)
 
 Nullable (const T &t)
 
 Nullable (const Nullable< T > &t)
 
Nullable< T > & operator= (const T &t)
 
Nullable< T > & operator= (const Nullable< T > &t)
 
bool isNull () const
 
 operator T () const
 
T & value ()
 
value (const T &defaultval=T()) const
 
valueOrDefault () const
 Helper to automatically convert to base type. More...
 
T & data ()
 
data (const T &defaultval=T()) const
 
dataOrDefault () const
 Helper to automatically convert to base type. More...
 
T * operator-> () const
 converts the nullable to a pointer of the wrapped class - acting like a smart pointer More...
 
bool operator== (const T &t) const
 
bool operator!= (const T &t) const
 
bool operator== (const Nullable< T > &t) const
 
bool operator!= (const Nullable< T > &t) const
 
bool operator== (const NullValue &) const
 compares the Nullable with the special null value More...
 
bool operator!= (const NullValue &) const
 compares the Nullable with the special null value More...
 
bool operator== (const std::nullptr_t &) const
 compares the Nullable with the special null value More...
 
bool operator!= (const std::nullptr_t &) const
 compares the Nullable with the special null value More...
 

Detailed Description

template<class T>
class Nullable< T >

wrapper around scalar values that makes them NULL-able, i.e. the virtual value NULL is added to the range of the wrapped value; wrapped classes must have a default constructor and =, == and != operators

Constructor & Destructor Documentation

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

creates a NULL value

template<class T>
Nullable< T >::Nullable ( const NullValue )
inline

creates a NULL value

template<class T>
Nullable< T >::Nullable ( const std::nullptr_t &  )
inlineexplicit

creates a NULL value

template<class T>
Nullable< T >::Nullable ( const T &  t)
inline

creates a wrapped non-NULL value that is equivalent to the original

template<class T>
Nullable< T >::Nullable ( const Nullable< T > &  t)
inline

copies a nullable value

Member Function Documentation

template<class T>
T& Nullable< T >::data ( )
inline

returns a reference to the wrapped value - the result is undefined if it us currently NULL

template<class T>
T Nullable< T >::data ( const T &  defaultval = T()) const
inline

returns the original value, if it is currently NULL it returns the given default value, if no default is given an instance created with the default constructor is returned

template<class T>
T Nullable< T >::dataOrDefault ( ) const
inline

Helper to automatically convert to base type.

template<class T>
bool Nullable< T >::isNull ( ) const
inline

returns whether this instance is NULL

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

converts this nullable to the original wrapped class - uses the default constructor if it is NULL

template<class T>
bool Nullable< T >::operator!= ( const T &  t) const
inline

compares this instance with a value of the original class, NULL is different from ANY instance of the original class

template<class T>
bool Nullable< T >::operator!= ( const Nullable< T > &  t) const
inline

compares two nullable instances, if both are NULL it returns false

template<class T>
bool Nullable< T >::operator!= ( const NullValue ) const
inline

compares the Nullable with the special null value

template<class T>
bool Nullable< T >::operator!= ( const std::nullptr_t &  ) const
inline

compares the Nullable with the special null value

template<class T>
T* Nullable< T >::operator-> ( ) const
inline

converts the nullable to a pointer of the wrapped class - acting like a smart pointer

template<class T>
Nullable<T>& Nullable< T >::operator= ( const T &  t)
inline

makes this instance non-NULL and equivalent to the given value

template<class T>
Nullable<T>& Nullable< T >::operator= ( const Nullable< T > &  t)
inline

copies the given nullable value

template<class T>
bool Nullable< T >::operator== ( const T &  t) const
inline

compares this instance with a value of the original class, NULL is different from ANY instance of the original class

template<class T>
bool Nullable< T >::operator== ( const Nullable< T > &  t) const
inline

compares two nullable instances, if both are NULL it returns true

template<class T>
bool Nullable< T >::operator== ( const NullValue ) const
inline

compares the Nullable with the special null value

template<class T>
bool Nullable< T >::operator== ( const std::nullptr_t &  ) const
inline

compares the Nullable with the special null value

template<class T>
T& Nullable< T >::value ( )
inline

returns a reference to the wrapped value - the result is undefined if it us currently NULL

template<class T>
T Nullable< T >::value ( const T &  defaultval = T()) const
inline

returns the original value, if it is currently NULL it returns the given default value, if no default is given an instance created with the default constructor is returned

template<class T>
T Nullable< T >::valueOrDefault ( ) const
inline

Helper to automatically convert to base type.


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