MySQLaux 0.6 is free software from Langensoft written by Thomas Langen.

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

MySQLaux::TypedField Class Template Reference

A field containing a value of "T" type. More...

#include <TypedField.h>

Inheritance diagram for MySQLaux::TypedField

Inheritance graph
[legend]
List of all members.

Public Methods

 TypedField (std::string const &name, std::string const &data)
 Constructor. More...

 TypedField (string const &name)
 Constructor for null fields. More...

T const& value () const throw (NullFieldIndicator)
 Get value. More...

std::string to_string () const throw (NullFieldIndicator)
 Get value as string. More...

std::size_t size () const
 Get storage size of value. More...


Detailed Description

template<class T> class MySQLaux::TypedField

A field containing a value of "T" type.

Parameters:
T   type
See also:
Field, the common abstract base

Definition at line 39 of file TypedField.h.


Constructor & Destructor Documentation

template<class T>
MySQLaux::TypedField<T>::TypedField<T> ( std::string const & name,
std::string const & data ) [inline]
 

Constructor.

Parameters:
name   type name
data   value string

Definition at line 65 of file TypedField.h.

00067         : Field (name)
00068     {
00069       std::istringstream is (data);
00070       is >> _value;
00071 

template<class T>
MySQLaux::TypedField<T>::TypedField<T> ( string const & name ) [inline]
 

Constructor for null fields.

Parameters:
name   type name

Definition at line 77 of file TypedField.h.

00078         : Field (name, true)
00079     {
00080 


Member Function Documentation

template<class T>
std::size_t MySQLaux::TypedField<T>::size ( ) const [inline, virtual]
 

Get storage size of value.

Reimplemented from MySQLaux::Field.

Definition at line 110 of file TypedField.h.

00110                             { return sizeof(_value); }
00111 

template<class T>
std::string MySQLaux::TypedField<T>::to_string ( ) const throw (NullFieldIndicator) [inline, virtual]
 

Get value as string.

Reimplemented from MySQLaux::Field.

Definition at line 96 of file TypedField.h.

00098     {
00099       if (_is_null)
00100         throw NullFieldIndicator ();
00101       
00102       std::ostringstream os;
00103       os << _value;
00104       return os.str();
00105 

template<class T>
T const & MySQLaux::TypedField<T>::value ( ) const throw (NullFieldIndicator) [inline]
 

Get value.

Definition at line 85 of file TypedField.h.

00087     {
00088       if (_is_null)
00089         throw NullFieldIndicator ();
00090       return _value;
00091 


The documentation for this class was generated from the following file:
Generated at Fri Apr 6 11:20:17 2001 for MySQLaux by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001