// METHOD NAME : EachLine::EachLine
// METHOD TYPE : Ctor
//
- EachLine::EachLine( std::istream & str_r )
+ EachLine::EachLine( std::istream & str_r, unsigned lineNo_r )
: _str( str_r )
- , _lineNo( 0 )
+ , _lineNo( lineNo_r )
, _valid( true )
{
next();
public:
/** Ctor taking a stream and reading the 1st line from it. */
- EachLine( std::istream & str_r );
+ EachLine( std::istream & str_r, unsigned lineNo_r = 0 );
- /** Evaluate class in a boolean context. */
+ /** Evaluate class in a boolean context. */
using SafeBool::operator bool_type;
/** Whether \c this contains a valid line to consume. */
unsigned lineNo() const
{ return _lineNo; }
+ /** Set current line number. */
+ void setLineNo( unsigned lineNo_r )
+ { _lineNo = lineNo_r; }
+
/** Access the current line. */
const std::string & operator*() const
{ return _line; }
{ return *_stream; }
/** Allow implicit conversion to std::istream.*/
- operator std::istream &()
+ operator std::istream &() const
{ return *_stream; }
/** Name of the std::istream.