Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

pqxxobject::ptr_field< T > Class Template Reference

Database pointer field template class. More...

#include <ptr_field.h>

Inheritance diagram for pqxxobject::ptr_field< T >:

pqxxobject::field_base Object List of all members.

Public Types

typedef T value_type

Public Member Functions

 ptr_field ()
 The constructor.

 ptr_field (const value_type &value)
 The constructor.

 ptr_field (const ptr_field< value_type > &rhs)
 The copy constructor.

virtual ~ptr_field ()
const value_typeoperator-> () const
 Access member functions.

const value_typeoperator * () const
ptr_field< value_type > & operator= (const ptr_field< value_type > &rhs)
 Overloaded assignment operator.

ptr_field< value_type > & operator= (const value_type &rhs)
 Overloaded assignment operator.

ptr_field< value_type > & operator+= (const ptr_field< value_type > &rhs)
ptr_field< value_type > & operator-= (const ptr_field< value_type > &rhs)
ptr_field< value_type > & operator *= (const ptr_field< value_type > &rhs)
ptr_field< value_type > & operator/= (const ptr_field< value_type > &rhs)
ptr_field< value_type > & operator%= (const ptr_field< value_type > &rhs)
ptr_field< value_type > & operator++ ()
ptr_field< value_typeoperator++ (int)
ptr_field< value_type > & operator-- ()
ptr_field< value_typeoperator-- (int)
 operator const value_type & () const
 Conversion operator.

value_typeget_value ()
 Get the contained value by reference.

const value_typeget_value () const
 Get the contained value by constant reference.

void set_value (const value_type &value)
 Set the contained value.

void set_null ()
 Set the contained value to NULL.

bool is_null () const
 Check if the contained value is NULL.

bool is_not_null () const
 Check if the contained value is not NULL.


Private Attributes

value_typem_value
 The contained value.


Friends

ptr_field< value_typeoperator+ (const ptr_field< value_type > &lhs, const ptr_field< value_type > &rhs)
ptr_field< value_typeoperator- (const ptr_field< value_type > &lhs, const ptr_field< value_type > &rhs)
ptr_field< value_typeoperator * (const ptr_field< value_type > &lhs, const ptr_field< value_type > &rhs)
ptr_field< value_typeoperator/ (const ptr_field< value_type > &lhs, const ptr_field< value_type > &rhs)
ptr_field< value_typeoperator% (const ptr_field< value_type > &lhs, const ptr_field< value_type > &rhs)
bool operator== (const ptr_field< value_type > &lhs, const ptr_field< value_type > &rhs)
bool operator!= (const ptr_field< value_type > &lhs, const ptr_field< value_type > &rhs)
ptr_field< value_typeoperator- (const ptr_field< value_type > &rhs)
ptr_field< value_typeoperator+ (const ptr_field< value_type > &rhs)
std::ostream & operator<< (std::ostream &output_stream, const ptr_field< value_type > &rhs)

Detailed Description

template<typename T>
class pqxxobject::ptr_field< T >

Database pointer field template class.

This class is used to represent a single field in a row of a table. This is a single value belonging to a column in a row, rather than the whole column. Like a database field, the value may be NULL. If set to NULL, it is important not to call any of the object member functions, or access the object itself (this would dereference a NULL pointer).

The class has some similarity with std::auto_ptr, but the copying semantics are different: on copy, the value is copied, which may involve memory allocation. There is no transfer of pointer ownership. Contained objects must posess a copy constructor.

As well as storing value, the class has the ability to emit signals when the field value is changed. Listeners (e.g. user interface widgets) may connect to the signal and will receive notification of changes as they occur.

Definition at line 71 of file ptr_field.h.


Member Typedef Documentation

template<typename T>
typedef T pqxxobject::ptr_field< T >::value_type
 

Definition at line 74 of file ptr_field.h.

Referenced by pqxxobject::ptr_field< T >::set_value().


Constructor & Destructor Documentation

template<typename T>
pqxxobject::ptr_field< T >::ptr_field  )  [inline]
 

The constructor.

Definition at line 77 of file ptr_field.h.

template<typename T>
pqxxobject::ptr_field< T >::ptr_field const value_type value  )  [inline, explicit]
 

The constructor.

Definition at line 82 of file ptr_field.h.

References pqxxobject::ptr_field< T >::set_value().

template<typename T>
pqxxobject::ptr_field< T >::ptr_field const ptr_field< value_type > &  rhs  )  [inline]
 

The copy constructor.

Definition at line 89 of file ptr_field.h.

References pqxxobject::ptr_field< T >::m_value, and pqxxobject::ptr_field< T >::set_value().

template<typename T>
virtual pqxxobject::ptr_field< T >::~ptr_field  )  [inline, virtual]
 

Definition at line 97 of file ptr_field.h.


Member Function Documentation

template<typename T>
const value_type& pqxxobject::ptr_field< T >::get_value  )  const [inline]
 

Get the contained value by constant reference.

Returns:
a constant reference to the value.

Definition at line 261 of file ptr_field.h.

template<typename T>
value_type& pqxxobject::ptr_field< T >::get_value  )  [inline]
 

Get the contained value by reference.

Returns:
a reference to the value.

Definition at line 251 of file ptr_field.h.

template<typename T>
bool pqxxobject::ptr_field< T >::is_not_null  )  const [inline, virtual]
 

Check if the contained value is not NULL.

Returns:
true if not NULL, otherwise false.

Implements pqxxobject::field_base.

Definition at line 305 of file ptr_field.h.

template<typename T>
bool pqxxobject::ptr_field< T >::is_null  )  const [inline, virtual]
 

Check if the contained value is NULL.

Returns:
true if NULL, otherwise false.

Implements pqxxobject::field_base.

Definition at line 296 of file ptr_field.h.

template<typename T>
const value_type& pqxxobject::ptr_field< T >::operator *  )  const [inline]
 

Definition at line 110 of file ptr_field.h.

template<typename T>
ptr_field<value_type>& pqxxobject::ptr_field< T >::operator *= const ptr_field< value_type > &  rhs  )  [inline]
 

Definition at line 151 of file ptr_field.h.

References pqxxobject::ptr_field< T >::m_value.

template<typename T>
pqxxobject::ptr_field< T >::operator const value_type &  )  const [inline]
 

Conversion operator.

Definition at line 241 of file ptr_field.h.

template<typename T>
ptr_field<value_type>& pqxxobject::ptr_field< T >::operator%= const ptr_field< value_type > &  rhs  )  [inline]
 

Definition at line 169 of file ptr_field.h.

References pqxxobject::ptr_field< T >::m_value.

template<typename T>
ptr_field<value_type> pqxxobject::ptr_field< T >::operator++ int   )  [inline]
 

Definition at line 186 of file ptr_field.h.

template<typename T>
ptr_field<value_type>& pqxxobject::ptr_field< T >::operator++  )  [inline]
 

Definition at line 178 of file ptr_field.h.

template<typename T>
ptr_field<value_type>& pqxxobject::ptr_field< T >::operator+= const ptr_field< value_type > &  rhs  )  [inline]
 

Definition at line 133 of file ptr_field.h.

References pqxxobject::ptr_field< T >::m_value.

template<typename T>
ptr_field<value_type> pqxxobject::ptr_field< T >::operator-- int   )  [inline]
 

Definition at line 203 of file ptr_field.h.

template<typename T>
ptr_field<value_type>& pqxxobject::ptr_field< T >::operator--  )  [inline]
 

Definition at line 195 of file ptr_field.h.

template<typename T>
ptr_field<value_type>& pqxxobject::ptr_field< T >::operator-= const ptr_field< value_type > &  rhs  )  [inline]
 

Definition at line 142 of file ptr_field.h.

References pqxxobject::ptr_field< T >::m_value.

template<typename T>
const value_type* pqxxobject::ptr_field< T >::operator->  )  const [inline]
 

Access member functions.

Definition at line 104 of file ptr_field.h.

template<typename T>
ptr_field<value_type>& pqxxobject::ptr_field< T >::operator/= const ptr_field< value_type > &  rhs  )  [inline]
 

Definition at line 160 of file ptr_field.h.

References pqxxobject::ptr_field< T >::m_value.

template<typename T>
ptr_field<value_type>& pqxxobject::ptr_field< T >::operator= const value_type rhs  )  [inline]
 

Overloaded assignment operator.

Definition at line 127 of file ptr_field.h.

References pqxxobject::ptr_field< T >::set_value().

template<typename T>
ptr_field<value_type>& pqxxobject::ptr_field< T >::operator= const ptr_field< value_type > &  rhs  )  [inline]
 

Overloaded assignment operator.

Definition at line 117 of file ptr_field.h.

References pqxxobject::ptr_field< T >::m_value, pqxxobject::ptr_field< T >::set_null(), and pqxxobject::ptr_field< T >::set_value().

template<typename T>
void pqxxobject::ptr_field< T >::set_null  )  [inline]
 

Set the contained value to NULL.

Definition at line 283 of file ptr_field.h.

Referenced by pqxxobject::ptr_field< T >::operator=().

template<typename T>
void pqxxobject::ptr_field< T >::set_value const value_type value  )  [inline]
 

Set the contained value.

Parameters:
value the value to set.

Definition at line 271 of file ptr_field.h.

References pqxxobject::ptr_field< T >::value_type.

Referenced by pqxxobject::ptr_field< T >::operator=(), and pqxxobject::ptr_field< T >::ptr_field().


Friends And Related Function Documentation

template<typename T>
ptr_field<value_type> operator * const ptr_field< value_type > &  lhs,
const ptr_field< value_type > &  rhs
[friend]
 

template<typename T>
bool operator!= const ptr_field< value_type > &  lhs,
const ptr_field< value_type > &  rhs
[friend]
 

template<typename T>
ptr_field<value_type> operator% const ptr_field< value_type > &  lhs,
const ptr_field< value_type > &  rhs
[friend]
 

template<typename T>
ptr_field<value_type> operator+ const ptr_field< value_type > &  rhs  )  [friend]
 

template<typename T>
ptr_field<value_type> operator+ const ptr_field< value_type > &  lhs,
const ptr_field< value_type > &  rhs
[friend]
 

template<typename T>
ptr_field<value_type> operator- const ptr_field< value_type > &  rhs  )  [friend]
 

template<typename T>
ptr_field<value_type> operator- const ptr_field< value_type > &  lhs,
const ptr_field< value_type > &  rhs
[friend]
 

template<typename T>
ptr_field<value_type> operator/ const ptr_field< value_type > &  lhs,
const ptr_field< value_type > &  rhs
[friend]
 

template<typename T>
std::ostream& operator<< std::ostream &  output_stream,
const ptr_field< value_type > &  rhs
[friend]
 

template<typename T>
bool operator== const ptr_field< value_type > &  lhs,
const ptr_field< value_type > &  rhs
[friend]
 


Member Data Documentation

template<typename T>
value_type* pqxxobject::ptr_field< T >::m_value [private]
 

The contained value.

Definition at line 312 of file ptr_field.h.

Referenced by pqxxobject::operator *(), pqxxobject::ptr_field< T >::operator *=(), pqxxobject::operator!=(), pqxxobject::operator%(), pqxxobject::ptr_field< T >::operator%=(), pqxxobject::operator+(), pqxxobject::ptr_field< T >::operator+=(), pqxxobject::operator-(), pqxxobject::ptr_field< T >::operator-=(), pqxxobject::operator/(), pqxxobject::ptr_field< T >::operator/=(), pqxxobject::ptr_field< T >::operator=(), pqxxobject::operator==(), and pqxxobject::ptr_field< T >::ptr_field().


The documentation for this class was generated from the following file:
Generated on Sat May 22 18:34:01 2004 for pqxxobject API Reference by doxygen 1.3.6-20040222