Mailinglist Archive: zypp-commit (149 mails)

< Previous Next >
[zypp-commit] r5428 - in /trunk/libzypp/zypp/base: IOStream.cc IOStream.h
  • From: mlandres@xxxxxxxxxxxxxxxx
  • Date: Fri, 20 Apr 2007 14:41:35 -0000
  • Message-id: <20070420144135.8D94C355C2@xxxxxxxxxxxxxxxx>
Author: mlandres
Date: Fri Apr 20 16:41:35 2007
New Revision: 5428

URL: http://svn.opensuse.org/viewcvs/zypp?rev=5428&view=rev
Log:
extend line parser to retrieve file position

Modified:
    trunk/libzypp/zypp/base/IOStream.cc
    trunk/libzypp/zypp/base/IOStream.h

Modified: trunk/libzypp/zypp/base/IOStream.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/IOStream.cc?rev=5428&r1=5427&r2=5428&view=diff
==============================================================================
--- trunk/libzypp/zypp/base/IOStream.cc (original)
+++ trunk/libzypp/zypp/base/IOStream.cc Fri Apr 20 16:41:35 2007
@@ -55,6 +55,7 @@
     //
     EachLine::EachLine( std::istream & str_r, unsigned lineNo_r )
       : _str( str_r )
+      , _lineStart( -1 )
       , _lineNo( lineNo_r )
       , _valid( true )
     {
@@ -79,13 +80,14 @@
        return(_valid = false);
       }
 
+      _lineStart = _str.tellg();
       _line = iostr::getline( _str );
+      ++_lineNo;
       if ( _str.fail() || _str.bad() )
       {
        _line.clear();
        return(_valid = false);
       }
-      ++_lineNo;
       return(_valid = true);
     }
 

Modified: trunk/libzypp/zypp/base/IOStream.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/IOStream.h?rev=5428&r1=5427&r2=5428&view=diff
==============================================================================
--- trunk/libzypp/zypp/base/IOStream.h (original)
+++ trunk/libzypp/zypp/base/IOStream.h Fri Apr 20 16:41:35 2007
@@ -76,6 +76,9 @@
        unsigned lineNo() const
        { return _lineNo; }
 
+       std::streamoff lineStart() const
+       { return _lineStart; };
+
        /** Set current line number. */
        void setLineNo( unsigned lineNo_r )
        { _lineNo = lineNo_r; }
@@ -102,9 +105,10 @@
 
       private:
        std::istream & _str;
-       std::string _line;
-       unsigned _lineNo;
-       bool _valid;
+       std::string    _line;
+       std::streamoff _lineStart;
+       unsigned       _lineNo;
+       bool           _valid;
     };
     ///////////////////////////////////////////////////////////////////
 

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages