csvpp 1.2.0
CSV parsing / writing libraries
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
csv::Reader::Row::Iterator< T > Class Template Reference

Iterates over the fields within a Row. More...

#include <csv.hpp>

Public Types

using value_type = T
 
using difference_type = std::ptrdiff_t
 
using pointer = const T*
 
using reference = const T&
 
using iterator_category = std::input_iterator_tag
 

Public Member Functions

 Iterator ()
 Empty constructor.
 
 Iterator (Reader::Row &row)
 Creates an iterator from a Row, and parses the first field.
 
const Toperator* () const
 
const Toperator-> () const
 
Iteratoroperator++ ()
 Parse and iterate to next field.
 
bool equals (const Iterator< T > &rhs) const
 Compare to another Reader::Row::Iterator.
 

Detailed Description

template<typename T = std::string>
class csv::Reader::Row::Iterator< T >

Iterates over the fields within a Row.

Template Parameters
TType to convert fields to. Defaults to std::string

Constructor & Destructor Documentation

◆ Iterator() [1/2]

template<typename T = std::string>
csv::Reader::Row::Iterator< T >::Iterator ( )
inline

Empty constructor.

Denotes the end of iteration

◆ Iterator() [2/2]

template<typename T = std::string>
csv::Reader::Row::Iterator< T >::Iterator ( Reader::Row & row)
inlineexplicit

Creates an iterator from a Row, and parses the first field.

Parameters
rowRow to iterate over.
Warning
row must not be destroyed or read from during iteration
Exceptions
Parse_errorif error parsing first field (only when not parsing in lenient mode)
IO_errorif error reading CSV data
Type_conversion_errorif error converting to type T. Caller may call this again with a different type to try again

Member Function Documentation

◆ operator*()

template<typename T = std::string>
const T & csv::Reader::Row::Iterator< T >::operator* ( ) const
inline
Returns
Current field

◆ operator++()

template<typename T = std::string>
Iterator & csv::Reader::Row::Iterator< T >::operator++ ( )
inline

Parse and iterate to next field.

Exceptions
Parse_errorif error parsing field (only when not parsing in lenient mode)
IO_errorif error reading CSV data
Type_conversion_errorif error converting to type T. Caller may call this again with a different type to try again

◆ operator->()

template<typename T = std::string>
const T * csv::Reader::Row::Iterator< T >::operator-> ( ) const
inline
Returns
Pointer to current field

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