libpqxx
7.0.5
|
Iterator for rows in a result. Use as result::const_iterator. More...
#include <result_iterator.hxx>
Public Types | |
using | iterator_category = std::random_access_iterator_tag |
using | value_type = row const |
using | pointer = row const * |
using | reference = row |
using | size_type = result_size_type |
using | difference_type = result_difference_type |
Public Types inherited from pqxx::row | |
using | size_type = row_size_type |
using | difference_type = row_difference_type |
using | const_iterator = const_row_iterator |
using | iterator = const_iterator |
using | reference = field |
using | pointer = const_row_iterator |
using | const_reverse_iterator = const_reverse_row_iterator |
using | reverse_iterator = const_reverse_iterator |
Public Member Functions | |
const_result_iterator () noexcept=default | |
const_result_iterator (const_result_iterator const &) noexcept=default | |
const_result_iterator (const_result_iterator &&) noexcept=default | |
const_result_iterator (row const &t) noexcept | |
Dereferencing operators | |
pointer | operator-> () const |
reference | operator* () const |
Manipulations | |
const_result_iterator & | operator= (const_result_iterator const &rhs) |
const_result_iterator & | operator= (const_result_iterator &&rhs) |
const_result_iterator | operator++ (int) |
const_result_iterator & | operator++ () |
const_result_iterator | operator-- (int) |
const_result_iterator & | operator-- () |
const_result_iterator & | operator+= (difference_type i) |
const_result_iterator & | operator-= (difference_type i) |
void | swap (const_result_iterator &other) noexcept |
Comparisons | |
bool | operator== (const_result_iterator const &i) const |
bool | operator!= (const_result_iterator const &i) const |
bool | operator< (const_result_iterator const &i) const |
bool | operator<= (const_result_iterator const &i) const |
bool | operator> (const_result_iterator const &i) const |
bool | operator>= (const_result_iterator const &i) const |
Public Member Functions inherited from pqxx::row | |
row ()=default | |
row (row &&)=default | |
row (row const &)=default | |
row & | operator= (row const &)=default |
row & | operator= (row &&)=default |
const_iterator | begin () const noexcept |
const_iterator | cbegin () const noexcept |
const_iterator | end () const noexcept |
const_iterator | cend () const noexcept |
size_type | size () const noexcept |
void | swap (row &) noexcept |
result::size_type | rownumber () const noexcept |
Row number, assuming this is a real row and not end()/rend(). More... | |
result::size_type | num () const |
row | slice (size_type sbegin, size_type send) const |
PQXX_PURE bool | empty () const noexcept |
PQXX_PURE bool | operator== (row const &) const noexcept |
bool | operator!= (row const &rhs) const noexcept |
reference | front () const noexcept |
reference | back () const noexcept |
const_reverse_row_iterator | rbegin () const |
const_reverse_row_iterator | crbegin () const |
const_reverse_row_iterator | rend () const |
const_reverse_row_iterator | crend () const |
reference | operator[] (size_type) const noexcept |
reference | operator[] (char const []) const |
reference | operator[] (std::string const &s) const |
reference | at (size_type) const |
reference | at (char const []) const |
reference | at (std::string const &s) const |
size_type | column_number (std::string const &col_name) const |
Number of given column (throws exception if it doesn't exist). More... | |
size_type | column_number (char const []) const |
Number of given column (throws exception if it doesn't exist). More... | |
oid | column_type (size_type) const |
Return a column's type. More... | |
template<typename STRING > | |
oid | column_type (STRING col_name) const |
Return a column's type. More... | |
oid | column_table (size_type col_num) const |
What table did this column come from? More... | |
template<typename STRING > | |
oid | column_table (STRING col_name) 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... | |
template<typename STRING > | |
size_type | table_column (STRING col_name) 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 &) |
const_result_iterator | operator+ (difference_type) const |
const_result_iterator | operator- (difference_type) const |
difference_type | operator- (const_result_iterator const &) const |
Additional Inherited Members | |
Protected Member Functions inherited from pqxx::row | |
row (result const &r, result_size_type i) noexcept | |
Protected Attributes inherited from pqxx::row | |
result | m_result |
Result set of which this is one row. More... | |
result::size_type | m_index = 0 |
Row number. More... | |
size_type | m_begin = 0 |
First column in slice. This row ignores lower-numbered columns. More... | |
size_type | m_end = 0 |
End column in slice. This row only sees lower-numbered columns. More... | |
Iterator for rows 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 rows without changing them.
using pqxx::const_result_iterator::iterator_category = std::random_access_iterator_tag |
using pqxx::const_result_iterator::pointer = row const * |
using pqxx::const_result_iterator::value_type = row const |
|
defaultnoexcept |
|
defaultnoexcept |
|
defaultnoexcept |
|
noexcept |
bool pqxx::const_result_iterator::operator!= | ( | const_result_iterator const & | i | ) | const |
References pqxx::row::m_index.
reference pqxx::const_result_iterator::operator* | ( | ) | const |
References pqxx::row::at(), pqxx::row::back(), pqxx::row::front(), and pqxx::row::rownumber().
const_result_iterator pqxx::const_result_iterator::operator+ | ( | result::difference_type | o | ) | const |
Referenced by pqxx::const_reverse_result_iterator::operator>=().
pqxx::const_result_iterator pqxx::const_result_iterator::operator++ | ( | int | ) |
const_result_iterator& pqxx::const_result_iterator::operator++ | ( | ) |
const_result_iterator& pqxx::const_result_iterator::operator+= | ( | difference_type | i | ) |
const_result_iterator pqxx::const_result_iterator::operator- | ( | result::difference_type | o | ) | const |
Referenced by pqxx::operator+().
result::difference_type pqxx::const_result_iterator::operator- | ( | const_result_iterator const & | i | ) | const |
References pqxx::row::num().
pqxx::const_result_iterator pqxx::const_result_iterator::operator-- | ( | int | ) |
const_result_iterator& pqxx::const_result_iterator::operator-- | ( | ) |
const_result_iterator& pqxx::const_result_iterator::operator-= | ( | difference_type | i | ) |
pointer pqxx::const_result_iterator::operator-> | ( | ) | const |
The iterator "points to" its own row, 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::const_result_iterator::operator< | ( | const_result_iterator const & | i | ) | const |
References pqxx::row::m_index.
bool pqxx::const_result_iterator::operator<= | ( | const_result_iterator const & | i | ) | const |
References pqxx::row::m_index.
const_result_iterator& pqxx::const_result_iterator::operator= | ( | const_result_iterator const & | rhs | ) |
References pqxx::row::operator=().
const_result_iterator& pqxx::const_result_iterator::operator= | ( | const_result_iterator && | rhs | ) |
References pqxx::row::operator=().
bool pqxx::const_result_iterator::operator== | ( | const_result_iterator const & | i | ) | const |
References pqxx::row::m_index.
bool pqxx::const_result_iterator::operator> | ( | const_result_iterator const & | i | ) | const |
References pqxx::row::m_index.
bool pqxx::const_result_iterator::operator>= | ( | const_result_iterator const & | i | ) | const |
References pqxx::row::m_index, and pqxx::operator+().
|
noexcept |
References pqxx::row::swap().
Referenced by pqxx::const_reverse_result_iterator::swap().
|
friend |
|
friend |