SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
|
Input iterator necessary for providing a range-like interface in input file. More...
#include <seqan3/io/detail/in_file_iterator.hpp>
Public Types | |
Member types | |
The associated types are derived from the | |
using | value_type = typename file_type::value_type |
The value type. | |
using | reference = typename file_type::reference |
The reference type. | |
using | const_reference = typename file_type::reference |
The const reference type. | |
using | size_type = typename file_type::size_type |
The size type. | |
using | difference_type = typename file_type::difference_type |
The difference type. A signed integer type, usually std::ptrdiff_t. | |
using | pointer = typename file_type::value_type * |
The pointer type. | |
using | iterator_category = std::input_iterator_tag |
Tag this class as an input iterator. | |
Public Member Functions | |
Constructors, destructor and assignment. | |
constexpr | in_file_iterator ()=default |
Default constructor. | |
constexpr | in_file_iterator (in_file_iterator const &)=default |
Copy constructor. | |
constexpr in_file_iterator & | operator= (in_file_iterator const &)=default |
Copy construction via assignment. | |
constexpr | in_file_iterator (in_file_iterator &&)=default |
Move constructor. | |
constexpr in_file_iterator & | operator= (in_file_iterator &&)=default |
Move assignment. | |
~in_file_iterator ()=default | |
Use default deconstructor. | |
constexpr | in_file_iterator (file_type &_host) noexcept |
Construct with reference to host. | |
Iterator operations | |
in_file_iterator & | operator++ () |
Move to the next record in the file and return a reference to it. | |
void | operator++ (int) |
Post-increment is the same as pre-increment, but returns void. | |
reference | operator* () noexcept |
Dereference returns the currently buffered record. | |
reference | operator* () const noexcept |
Dereference returns the currently buffered record. | |
File position functionality | |
Low level API. Enables seeking to and returning specific file positions from the iterator. | |
std::streampos | file_position () const |
Returns the current position in the file via std::streampos . | |
in_file_iterator & | seek_to (std::streampos const &pos) |
Low level API. Sets the current position of the iterator to the given position, throws if at end of file. | |
Private Attributes | |
file_type * | host {} |
Pointer to file host. | |
Comparison operators | |
Only (in-)equality comparison of iterator with end() is supported. | |
constexpr bool | operator== (std::default_sentinel_t const &) const noexcept |
Checks whether *this is equal to the sentinel. | |
constexpr bool | operator!= (std::default_sentinel_t const &) const noexcept |
Checks whether *this is not equal to the sentinel. | |
constexpr friend bool | operator== (std::default_sentinel_t const &, in_file_iterator const &it) noexcept |
Checks whether it is equal to the sentinel. | |
constexpr friend bool | operator!= (std::default_sentinel_t const &, in_file_iterator const &it) noexcept |
Checks whether it is not equal to the sentinel. | |
Input iterator necessary for providing a range-like interface in input file.
file_type | The data structure on which the iterator operates, e.g. std::vector<int> . |
This iterator is a single-pass input iterator for input files. All member types are resolved via file_type
's member types, dereference is implemented via file's front()
member function and increment calls the buffer_next_record()
member of file.
Note that since this is a single-pass input iterator, post-increment returns void because previous iterators are always invalid (all iterators point to the current position in single-pass ranges).
This iterator may be compared against std::default_sentinel_t, this check delegates to calling the eof()
member function on the file's stream.