From: Michael Andres Date: Thu, 19 Apr 2007 15:43:00 +0000 (+0000) Subject: support line numbers in lineparser X-Git-Tag: BASE-SuSE-Linux-10_3-Branch~842 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=597bfdb10ad0d14815c9d67786f3441f89621566;p=platform%2Fupstream%2Flibzypp.git support line numbers in lineparser --- diff --git a/zypp/base/IOStream.cc b/zypp/base/IOStream.cc index 2d65e4a..7d3b50f 100644 --- a/zypp/base/IOStream.cc +++ b/zypp/base/IOStream.cc @@ -53,9 +53,9 @@ namespace zypp // 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(); diff --git a/zypp/base/IOStream.h b/zypp/base/IOStream.h index 918d35b..fc43c28 100644 --- a/zypp/base/IOStream.h +++ b/zypp/base/IOStream.h @@ -63,9 +63,9 @@ namespace zypp 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. */ @@ -76,6 +76,10 @@ namespace zypp 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; } diff --git a/zypp/base/InputStream.h b/zypp/base/InputStream.h index c2f064a..60455f9 100644 --- a/zypp/base/InputStream.h +++ b/zypp/base/InputStream.h @@ -93,7 +93,7 @@ namespace zypp { return *_stream; } /** Allow implicit conversion to std::istream.*/ - operator std::istream &() + operator std::istream &() const { return *_stream; } /** Name of the std::istream.