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

pqxxobject::field< T > Class Template Reference

Database field template class. More...

#include <field.h>

Inheritance diagram for pqxxobject::field< T >:

pqxxobject::field_base Object List of all members.

Public Types

typedef T value_type

Public Member Functions

 field (const value_type &value)
 The constructor.

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

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

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

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

field< value_type > & operator+= (const field< value_type > &rhs)
field< value_type > & operator-= (const field< value_type > &rhs)
field< value_type > & operator *= (const field< value_type > &rhs)
field< value_type > & operator/= (const field< value_type > &rhs)
field< value_type > & operator%= (const field< value_type > &rhs)
field< value_type > & operator++ ()
field< value_typeoperator++ (int)
field< value_type > & operator-- ()
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.

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_type m_value
 The contained value.


Friends

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

Detailed Description

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

Database 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. The value may not be NULL.

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 69 of file field.h.


Member Typedef Documentation

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

Definition at line 72 of file field.h.

Referenced by pqxxobject::field< T >::field(), pqxxobject::field< T >::get_value(), pqxxobject::field< T >::operator *(), pqxxobject::field< T >::operator->(), pqxxobject::field< T >::operator=(), and pqxxobject::field< T >::set_value().


Constructor & Destructor Documentation

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

The constructor.

Definition at line 75 of file field.h.

References pqxxobject::field< T >::m_value, and pqxxobject::field< T >::value_type.

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

The copy constructor.

Definition at line 83 of file field.h.

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

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

Definition at line 91 of file field.h.


Member Function Documentation

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

Get the contained value by constant reference.

Returns:
a constant reference to the value.

Definition at line 235 of file field.h.

References pqxxobject::field< T >::m_value, and pqxxobject::field< T >::value_type.

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

Get the contained value by reference.

Returns:
a reference to the value.

Definition at line 226 of file field.h.

References pqxxobject::field< T >::m_value, and pqxxobject::field< T >::value_type.

template<typename T>
bool pqxxobject::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 263 of file field.h.

template<typename T>
bool pqxxobject::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 254 of file field.h.

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

Definition at line 100 of file field.h.

References pqxxobject::field< T >::m_value, and pqxxobject::field< T >::value_type.

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

Definition at line 134 of file field.h.

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

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

Conversion operator.

Definition at line 217 of file field.h.

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

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

Definition at line 148 of file field.h.

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

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

Definition at line 162 of file field.h.

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

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

Definition at line 155 of file field.h.

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

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

Definition at line 120 of file field.h.

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

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

Definition at line 177 of file field.h.

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

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

Definition at line 170 of file field.h.

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

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

Definition at line 127 of file field.h.

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

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

Access member functions.

Definition at line 95 of file field.h.

References pqxxobject::field< T >::m_value, and pqxxobject::field< T >::value_type.

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

Definition at line 141 of file field.h.

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

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

Overloaded assignment operator.

Definition at line 114 of file field.h.

References pqxxobject::field< T >::set_value(), and pqxxobject::field< T >::value_type.

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

Overloaded assignment operator.

Definition at line 106 of file field.h.

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

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

Set the contained value.

Parameters:
value the value to set.

Definition at line 244 of file field.h.

References pqxxobject::field< T >::m_value, and pqxxobject::field< T >::value_type.

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


Friends And Related Function Documentation

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

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

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

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

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

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

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

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

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

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


Member Data Documentation

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

The contained value.

Definition at line 270 of file field.h.

Referenced by pqxxobject::field< T >::field(), pqxxobject::field< T >::get_value(), pqxxobject::field< T >::operator *(), pqxxobject::field< T >::operator *=(), pqxxobject::field< T >::operator const value_type &(), pqxxobject::field< T >::operator%=(), pqxxobject::operator+(), pqxxobject::field< T >::operator++(), pqxxobject::field< T >::operator+=(), pqxxobject::operator-(), pqxxobject::field< T >::operator--(), pqxxobject::field< T >::operator-=(), pqxxobject::field< T >::operator->(), pqxxobject::field< T >::operator/=(), pqxxobject::field< T >::operator=(), pqxxobject::operator==(), and pqxxobject::field< T >::set_value().


The documentation for this class was generated from the following file:
Generated on Thu Apr 1 10:37:56 2004 for pqxx-object API Reference by doxygen 1.3.5