Public Member Functions

Nullable< T > Class Template Reference

#include <nullable.h>

List of all members.

Public Member Functions

 Nullable ()
 Nullable (const NullValue &)
 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
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
bool operator!= (const NullValue &) const
 compares the Nullable with the special null value

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 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>
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>
Nullable<T>& Nullable< T >::operator= ( const Nullable< T > &  t  )  [inline]

copies the given nullable value

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>
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 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>
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 >::value (  )  [inline]

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


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Friends Defines