ITS.ITU.PSeries.P2108 1.0
Part of the NTIA/ITS Propagation Library
Loading...
Searching...
No Matches
CommaSeparatedIterator Class Reference

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.
 
CommaSeparatedIteratoroperator++ ()
 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.
 

Private Attributes

std::istream & stream_
 Reference to the input stream.
 
std::string line_
 Current line read from the stream.
 
std::string first_
 First string from the current line.
 
std::string second_
 Second string from the current line.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ CommaSeparatedIterator()

CommaSeparatedIterator::CommaSeparatedIterator ( std::istream & stream)

Constructor method.

Parameters
[in]streamThe input stream which will be read

Member Function Documentation

◆ operator bool()

CommaSeparatedIterator::operator bool ( ) const
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).

Returns
True if there are still lines to read, otherwise false.

◆ operator*()

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).

Returns
A pair containing the two substrings from the current line.

◆ operator++()

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.

Returns
A reference to the updated iterator.

The documentation for this class was generated from the following files:
Privacy Policy FOIA Accessibility Information Quality