ITS.ITU.PSeries.P2108 1.0
Part of the NTIA/ITS Propagation Library
|
An iterator that reads lines from an input stream, splitting each line into two strings based on a comma delimiter. More...
#include <CommaSeparatedIterator.h>
Public Types | |
using | value_type = std::pair<std::string, std::string> |
Type alias for the value returned by the iterator (pair of strings) | |
Public Member Functions | |
CommaSeparatedIterator (std::istream &stream) | |
Constructor method. | |
CommaSeparatedIterator & | operator++ () |
Pre-increment operator to advance the iterator to the next line. | |
value_type | operator* () const |
Dereference operator to obtain the current pair of substrings. | |
operator bool () const | |
Conversion to boolean to check if the iterator is valid. | |
An iterator that reads lines from an input stream, splitting each line into two strings based on a comma delimiter.
This iterator can work with both std::stringstream
and std::ifstream
.
CommaSeparatedIterator::CommaSeparatedIterator | ( | std::istream & | stream | ) |
Constructor method.
[in] | stream | The input stream which will be read |
|
explicit |
Conversion to boolean to check if the iterator is valid.
Conversion to boolean.
Checks if the iterator is still valid (not at the end of the input).
CommaSeparatedIterator::value_type CommaSeparatedIterator::operator* | ( | ) | const |
Dereference operator to obtain the current pair of substrings.
Dereference operator.
Returns the current pair of substrings (first and second).
CommaSeparatedIterator & CommaSeparatedIterator::operator++ | ( | ) |
Pre-increment operator to advance the iterator to the next line.
Pre-increment operator.
Advances the iterator to the next line and splits it into two substrings. If the end of the stream is reached, both substrings will be empty. Both parsed substrings are converted to lowercase.