LineReader module

Module contents

template<class StringT = std::string>
class LineReader

Read data from a stream one line at a time.

This class is an adapter that takes a std::istream as input and provides an InputIterator that loops over the lines of the stream. In its current version it delegates to the getline() function to determine when a line has ended.

The behavior is meant to be the same as the Python idiom for line in file.

We do not expect you to instantiate this class directly. Instead, it shows up as part of PointReader where you put a stream in one end and get points out the other end.

Public Types

typedef StringT value_type
typedef StringT::value_type char_type
typedef StringT::traits_type traits_type
typedef std::basic_istream<char_type, traits_type> istream_type
typedef LineReaderIterator iterator
typedef LineReaderIterator const const_iterator

Public Functions

LineReader()
LineReader(const LineReader &other)
LineReader(istream_type &stream)
virtual ~LineReader()
LineReader &operator=(LineReader const &other)
void set_input(istream_type &stream)
istream_type &input() const
bool operator==(LineReader const &other) const
bool operator!=(LineReader const &other) const
iterator begin() const
iterator end() const
const_iterator const_begin() const
const_iterator const_end() const

Private Members

istream_type *Stream
class LineReaderIterator : public std::iterator<std::input_iterator_tag, StringT, std::ptrdiff_t, const StringT *, StringT const&>

Public Types

template<>
typedef StringT value_type
template<>
typedef StringT::value_type char_type
template<>
typedef StringT::traits_type traits_type

Public Functions

template<>
LineReaderIterator()
template<>
LineReaderIterator(istream_type *stream)
template<>
LineReaderIterator(LineReaderIterator const &other)
template<>
~LineReaderIterator()
template<>
LineReaderIterator &operator=(LineReaderIterator const &other)
template<>
value_type const &operator*() const
template<>
value_type *operator->() const
template<>
LineReaderIterator &operator++()
template<>
LineReaderIterator &operator++(int)
template<>
bool operator==(LineReaderIterator const &other) const
template<>
bool operator!=(LineReaderIterator const &other) const

Public Members

template<>
istream_type *Stream
template<>
value_type Value