1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/base/IOStream.cc
13 //#include "zypp/base/Logger.h"
15 #include "zypp/base/IOStream.h"
19 ///////////////////////////////////////////////////////////////////
21 { /////////////////////////////////////////////////////////////////
22 ///////////////////////////////////////////////////////////////////
24 { /////////////////////////////////////////////////////////////////
26 /******************************************************************
28 ** FUNCTION NAME : getline
29 ** FUNCTION TYPE : std::string
31 std::string getline( std::istream & str )
33 static const unsigned tmpBuffLen = 1024;
34 static char tmpBuff[tmpBuffLen];
38 str.getline( tmpBuff, tmpBuffLen ); // always writes '\0' terminated
40 } while( str.rdstate() == std::ios::failbit );
45 ///////////////////////////////////////////////////////////////////
47 // CLASS NAME : EachLine
49 ///////////////////////////////////////////////////////////////////
51 ///////////////////////////////////////////////////////////////////
53 // METHOD NAME : EachLine::EachLine
56 EachLine::EachLine( std::istream & str_r, unsigned lineNo_r )
65 ///////////////////////////////////////////////////////////////////
67 // METHOD NAME : EachLine::next
77 if ( ! _str ) // usg: saw EOF in previous read
80 return(_valid = false);
83 _lineStart = _str.tellg();
84 _line = iostr::getline( _str );
86 if ( _str.fail() || _str.bad() )
89 return(_valid = false);
91 return(_valid = true);
94 /////////////////////////////////////////////////////////////////
96 ///////////////////////////////////////////////////////////////////
97 /////////////////////////////////////////////////////////////////
99 ///////////////////////////////////////////////////////////////////