00001
00002
00003
00004
00005
00006
00007
00008
00012 #ifndef ZYPP_BASE_IOSTREAM_H
00013 #define ZYPP_BASE_IOSTREAM_H
00014
00015 #include <iosfwd>
00016 #include <boost/io/ios_state.hpp>
00017
00018 #include "zypp/base/PtrTypes.h"
00019
00021 namespace zypp
00022 {
00023
00024
00026 namespace iostr
00027 {
00028
00032 typedef boost::io::ios_base_all_saver IosFmtFlagsSaver;
00033
00034
00042 std::string getline( std::istream & str );
00043
00044
00066 template<class _Function>
00067 _Function & forEachLine( std::istream & str_r, _Function & consume_r )
00068 {
00069 while ( str_r )
00070 {
00071 std::string l = getline( str_r );
00072 if ( ! (str_r.fail() || str_r.bad()) )
00073 {
00074
00075 if ( ! consume_r( l ) )
00076 break;
00077 }
00078 }
00079 return consume_r;
00080 }
00081
00083 }
00086 }
00088 #endif // ZYPP_BASE_IOSTREAM_H