#include <field_base.h>
Inheritance diagram for pqxxobject::field_base:
Public Member Functions | |
field_base () | |
The constructor. | |
field_base (const std::string &column_name) | |
The constructor. | |
field_base (const field_base &rhs) | |
The copy constructor. | |
virtual | ~field_base () |
The destructor. | |
field_base & | operator= (const field_base &rhs) |
Overloaded assignment operator. | |
const std::string & | get_column_name () const |
Get the column name this field belongs to. | |
void | set_column_name (const std::string &column) |
Set the column name this field belongs to. | |
virtual bool | is_null () const=0 |
Check if the contained value is NULL. | |
virtual bool | is_not_null () const=0 |
Check if the contained value is not NULL. | |
SigC::Signal0< void > & | signal_changed () |
Signal emitted on value change. | |
Protected Attributes | |
std::string | m_column_name |
The column name. | |
SigC::Signal0< void > | m_signal_changed |
The changed signal. |
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 68 of file field_base.h.
|
The constructor.
Definition at line 43 of file field_base.cc. |
|
The constructor.
Definition at line 49 of file field_base.cc. |
|
The copy constructor.
Definition at line 56 of file field_base.cc. |
|
The destructor.
Definition at line 62 of file field_base.cc. |
|
Get the column name this field belongs to.
Definition at line 76 of file field_base.cc. References m_column_name. Referenced by pqxxobject::update_query::remove(), and pqxxobject::insert_query::remove(). |
|
Check if the contained value is not NULL.
Implemented in pqxxobject::field< T >, and pqxxobject::ptr_field< T >. |
|
Check if the contained value is NULL.
Implemented in pqxxobject::field< T >, and pqxxobject::ptr_field< T >. |
|
Overloaded assignment operator. The field column name is not copied by the assignment. This is because differently-named columns could potentially be assigned to one another. Definition at line 67 of file field_base.cc. |
|
Set the column name this field belongs to.
Definition at line 82 of file field_base.cc. References m_column_name. |
|
Signal emitted on value change.
i.e. a class method (listener.on_col_changed()) will be called when the value is changed. Definition at line 89 of file field_base.cc. References m_signal_changed. |
|
The column name.
Definition at line 137 of file field_base.h. Referenced by get_column_name(), and set_column_name(). |
|
The changed signal.
Definition at line 140 of file field_base.h. Referenced by signal_changed(). |