BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
CSVIterator Class Reference
Collaboration diagram for CSVIterator:
[legend]

Public Types

typedef unsigned long difference_type
 
typedef std::input_iterator_tag iterator_category
 
typedef CSVRowpointer
 
typedef CSVRowreference
 
typedef CSVRow value_type
 

Public Member Functions

 CSVIterator ()
 
 CSVIterator (std::istream &str, char sep)
 
bool operator!= (CSVIterator const &rhs)
 
CSVRow const & operator* () const
 
CSVIteratoroperator++ ()
 
CSVIterator operator++ (int)
 
CSVRow const * operator-> () const
 
bool operator== (CSVIterator const &rhs)
 

Private Attributes

CSVRow m_row
 
char m_sep
 
std::istream * m_str
 

Detailed Description

Definition at line 46 of file CsvReader.h.

Member Typedef Documentation

◆ difference_type

typedef unsigned long CSVIterator::difference_type

Definition at line 50 of file CsvReader.h.

◆ iterator_category

typedef std::input_iterator_tag CSVIterator::iterator_category

Definition at line 48 of file CsvReader.h.

◆ pointer

Definition at line 51 of file CsvReader.h.

◆ reference

Definition at line 52 of file CsvReader.h.

◆ value_type

Definition at line 49 of file CsvReader.h.

Constructor & Destructor Documentation

◆ CSVIterator() [1/2]

CSVIterator::CSVIterator ( std::istream &  str,
char  sep 
)
inline

Definition at line 54 of file CsvReader.h.

54  : m_str(str.good() ? &str : nullptr)
55  {
56  m_sep = sep;
57  ++(*this);
58  }
char m_sep
Definition: CsvReader.h:90
std::istream * m_str
Definition: CsvReader.h:88

References m_sep.

◆ CSVIterator() [2/2]

CSVIterator::CSVIterator ( )
inline

Definition at line 59 of file CsvReader.h.

59 : m_str(nullptr) {}

Member Function Documentation

◆ operator!=()

bool CSVIterator::operator!= ( CSVIterator const &  rhs)
inline

Definition at line 85 of file CsvReader.h.

85 { return !((*this) == rhs); }

◆ operator*()

CSVRow const& CSVIterator::operator* ( ) const
inline

Definition at line 79 of file CsvReader.h.

79 { return m_row; }
CSVRow m_row
Definition: CsvReader.h:89

References m_row.

◆ operator++() [1/2]

CSVIterator& CSVIterator::operator++ ( )
inline

Definition at line 62 of file CsvReader.h.

63  {
64  if (m_str) {
66  if (!((*m_str) >> m_row)) {
67  m_str = nullptr;
68  }
69  }
70  return *this;
71  }
void setSeparator(char sep)
Definition: CsvReader.cpp:49

References m_row, m_sep, m_str, and CSVRow::setSeparator().

Here is the call graph for this function:

◆ operator++() [2/2]

CSVIterator CSVIterator::operator++ ( int  )
inline

Definition at line 73 of file CsvReader.h.

74  {
75  CSVIterator tmp(*this);
76  ++(*this);
77  return tmp;
78  }

◆ operator->()

CSVRow const* CSVIterator::operator-> ( ) const
inline

Definition at line 80 of file CsvReader.h.

80 { return &m_row; }

References m_row.

◆ operator==()

bool CSVIterator::operator== ( CSVIterator const &  rhs)
inline

Definition at line 81 of file CsvReader.h.

82  {
83  return ((this == &rhs) || ((this->m_str == nullptr) && (rhs.m_str == nullptr)));
84  }

References m_str.

Member Data Documentation

◆ m_row

CSVRow CSVIterator::m_row
private

Definition at line 89 of file CsvReader.h.

Referenced by operator*(), operator++(), and operator->().

◆ m_sep

char CSVIterator::m_sep
private

Definition at line 90 of file CsvReader.h.

Referenced by CSVIterator(), and operator++().

◆ m_str

std::istream* CSVIterator::m_str
private

Definition at line 88 of file CsvReader.h.

Referenced by operator++(), and operator==().


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