libpqxx  4.0.1
pqxx::const_result_iterator Class Reference

Iterator for rows (tuples) in a result. Use as result::const_iterator. More...

#include <result.hxx>

Inheritance diagram for pqxx::const_result_iterator:
pqxx::tuple pqxx::const_reverse_result_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::tuple
typedef tuple_size_type size_type
 
typedef tuple_difference_type difference_type
 
typedef const_tuple_iterator const_iterator
 
typedef const_iterator iterator
 
typedef field reference
 
typedef const_tuple_iterator pointer
 
typedef const_reverse_tuple_iterator const_reverse_iterator
 
typedef const_reverse_iterator reverse_iterator
 

Public Member Functions

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

Friends

class pqxx::result
 

Arithmetic operators

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

Additional Inherited Members

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

Detailed Description

Iterator for rows (tuples) in a result. Use as result::const_iterator.

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

◆ difference_type

◆ pointer

◆ reference

◆ size_type

Constructor & Destructor Documentation

◆ const_result_iterator() [1/2]

pqxx::const_result_iterator::const_result_iterator ( )
throw (
)

◆ const_result_iterator() [2/2]

pqxx::const_result_iterator::const_result_iterator ( const tuple t)
throw (
)

Member Function Documentation

◆ operator!=()

bool pqxx::const_result_iterator::operator!= ( const const_result_iterator i) const

◆ operator*()

reference pqxx::const_result_iterator::operator* ( ) const

◆ operator+()

const_result_iterator pqxx::const_result_iterator::operator+ ( result::difference_type  o) const

◆ operator++() [1/2]

pqxx::const_result_iterator pqxx::const_result_iterator::operator++ ( int  )

◆ operator++() [2/2]

const_result_iterator& pqxx::const_result_iterator::operator++ ( )

◆ operator+=()

const_result_iterator& pqxx::const_result_iterator::operator+= ( difference_type  i)

◆ operator-() [1/2]

const_result_iterator pqxx::const_result_iterator::operator- ( result::difference_type  o) const

◆ operator-() [2/2]

result::difference_type pqxx::const_result_iterator::operator- ( const_result_iterator  i) const

References pqxx::tuple::num().

◆ operator--() [1/2]

pqxx::const_result_iterator pqxx::const_result_iterator::operator-- ( int  )

◆ operator--() [2/2]

const_result_iterator& pqxx::const_result_iterator::operator-- ( )

◆ operator-=()

const_result_iterator& pqxx::const_result_iterator::operator-= ( difference_type  i)

◆ operator->()

pointer pqxx::const_result_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.

◆ operator<()

bool pqxx::const_result_iterator::operator< ( const const_result_iterator i) const

◆ operator<=()

bool pqxx::const_result_iterator::operator<= ( const const_result_iterator i) const

◆ operator==()

bool pqxx::const_result_iterator::operator== ( const const_result_iterator i) const

◆ operator>()

bool pqxx::const_result_iterator::operator> ( const const_result_iterator i) const

◆ operator>=()

bool pqxx::const_result_iterator::operator>= ( const const_result_iterator i) const

References pqxx::operator+().

Friends And Related Function Documentation

◆ operator+

◆ pqxx::result

friend class pqxx::result
friend

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