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 )
64 ///////////////////////////////////////////////////////////////////
66 // METHOD NAME : EachLine::next
76 if ( ! _str ) // usg: saw EOF in previous read
79 return(_valid = false);
82 _line = iostr::getline( _str );
83 if ( _str.fail() || _str.bad() )
86 return(_valid = false);
89 return(_valid = true);
92 /////////////////////////////////////////////////////////////////
94 ///////////////////////////////////////////////////////////////////
95 /////////////////////////////////////////////////////////////////
97 ///////////////////////////////////////////////////////////////////