libpqxx  3.1.1
pqxx::result::const_iterator Class Reference

Iterator for rows (tuples) in a query result set. More...

#include <result.hxx>

Inheritance diagram for pqxx::result::const_iterator:
pqxx::result::tuple pqxx::result::const_reverse_iterator

Public Types

typedef const tuplepointer
typedef tuple reference
typedef result::size_type size_type
typedef result::difference_type difference_type
- Public Types inherited from pqxx::result::tuple
typedef unsigned int size_type
typedef signed int difference_type
typedef const_fielditerator const_iterator
typedef const_iterator iterator
typedef field reference
typedef const_fielditerator pointer
typedef const_reverse_fielditerator const_reverse_iterator
typedef const_reverse_iterator reverse_iterator

Public Member Functions

 const_iterator () throw ()
 const_iterator (const tuple &t) throw ()
Dereferencing operators
pointer operator-> () const
reference operator* () const
Manipulations
const_iterator operator++ (int)
const_iteratoroperator++ ()
const_iterator operator-- (int)
const_iteratoroperator-- ()
const_iteratoroperator+= (difference_type i)
const_iteratoroperator-= (difference_type i)
Comparisons
bool operator== (const const_iterator &i) const
bool operator!= (const const_iterator &i) const
bool operator< (const const_iterator &i) const
bool operator<= (const const_iterator &i) const
bool operator> (const const_iterator &i) const
bool operator>= (const const_iterator &i) const
- Public Member Functions inherited from pqxx::result::tuple
 tuple (const result *r, result::size_type i) throw ()
 ~tuple () throw ()
const_iterator begin () const throw ()
const_iterator end () const throw ()
size_type size () const throw ()
void swap (tuple &) throw ()
result::size_type rownumber () const throw ()
result::size_type num () const
tuple slice (size_type Begin, size_type End) const
bool empty () const throw ()
bool operator== (const tuple &) const throw ()
bool operator!= (const tuple &rhs) const throw ()
reference front () const throw ()
reference back () const throw ()
const_reverse_fielditerator rbegin () const
const_reverse_fielditerator rend () const
reference operator[] (size_type i) const throw ()
reference operator[] (int i) const throw ()
reference operator[] (const char f[]) const
reference operator[] (const std::string &s) const
reference at (size_type) const throw (range_error)
reference at (int i) const throw (range_error)
reference at (const char[]) const
reference at (const std::string &s) const
size_type column_number (const std::string &ColName) const
 Number of given column (throws exception if it doesn't exist)
size_type column_number (const char[]) const
 Number of given column (throws exception if it doesn't exist)
oid column_type (size_type ColNum) const
 Type of given column.
oid column_type (int ColNum) const
 Type of given column.
oid column_type (const std::string &ColName) const
 Type of given column.
oid column_type (const char ColName[]) const
 Type of given column.
oid column_table (size_type ColNum) const
 What table did this column come from? Requires PostgreSQL 7.4 C API.
oid column_table (int ColNum) const
 What table did this column come from? Requires PostgreSQL 7.4 C API.
oid column_table (const std::string &ColName) const
 What table did this column come from? Requires PostgreSQL 7.4 C API.
size_type table_column (size_type ColNum) const
 What column number in its table did this result column come from?
size_type table_column (int ColNum) const
 What column number in its table did this result column come from?
size_type table_column (const std::string &ColName) const
 What column number in its table did this result column come from?

Friends

class pqxx::result

Arithmetic operators

const_iterator operator+ (difference_type, const_iterator)
const_iterator operator+ (difference_type) const
const_iterator operator- (difference_type) const
difference_type operator- (const_iterator) const

Additional Inherited Members

- Protected Attributes inherited from pqxx::result::tuple
const resultm_Home
result::size_type m_Index
size_type m_Begin
size_type m_End

Detailed Description

Iterator for rows (tuples) in a query result set.

A result, once obtained, cannot be modified. Therefore there is no plain iterator type for result. However its const_iterator type can be used to inspect its tuples without changing them.

Member Typedef Documentation

Constructor & Destructor Documentation

Member Function Documentation

bool pqxx::result::const_iterator::operator!= ( const const_iterator i) const
reference pqxx::result::const_iterator::operator* ( ) const
result::const_iterator pqxx::result::const_iterator::operator+ ( difference_type  o) const
pqxx::result::const_iterator pqxx::result::const_iterator::operator++ ( int  )
const_iterator& pqxx::result::const_iterator::operator++ ( )
const_iterator& pqxx::result::const_iterator::operator+= ( difference_type  i)
result::const_iterator pqxx::result::const_iterator::operator- ( difference_type  o) const
result::const_iterator::difference_type pqxx::result::const_iterator::operator- ( const_iterator  i) const
pqxx::result::const_iterator pqxx::result::const_iterator::operator-- ( int  )
const_iterator& pqxx::result::const_iterator::operator-- ( )
const_iterator& pqxx::result::const_iterator::operator-= ( difference_type  i)
pointer pqxx::result::const_iterator::operator-> ( ) const

The iterator "points to" its own tuple, which is also itself. This allows a result to be addressed as a two-dimensional container without going through the intermediate step of dereferencing the iterator. I hope this works out to be similar to C pointer/array semantics in useful cases.

IIRC Alex Stepanov, the inventor of the STL, once remarked that having this as standard behaviour for pointers would be useful in some algorithms. So even if this makes me look foolish, I would seem to be in distinguished company.

bool pqxx::result::const_iterator::operator< ( const const_iterator i) const
bool pqxx::result::const_iterator::operator<= ( const const_iterator i) const
bool pqxx::result::const_iterator::operator== ( const const_iterator i) const
bool pqxx::result::const_iterator::operator> ( const const_iterator i) const
bool pqxx::result::const_iterator::operator>= ( const const_iterator i) const

Friends And Related Function Documentation

const_iterator operator+ ( difference_type  o,
result::const_iterator  i 
)
friend
friend class pqxx::result
friend

The documentation for this class was generated from the following files: