diff options
Diffstat (limited to 'tools.cpp')
-rw-r--r-- | tools.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -17,6 +17,7 @@ using namespace tnt; istream& operator>>( istream& is, tChannelID& ret ) { + /* alternativ implementation string line; if ( !getline( is, line ) ) { if ( !is.eof() ) @@ -28,6 +29,23 @@ istream& operator>>( istream& is, tChannelID& ret ) if ( !line.empty() && !( ret = tChannelID::FromString( line.c_str() ) ).Valid() ) is.setstate( ios::badbit ); return is; + */ + + string line; + if (!getline( is, line ) ) { + if (0 == is.gcount()) { + is.clear(is.rdstate() & ~ios::failbit); + return is; + } + if (!is.eof()) { + is.setstate( ios::badbit ); + return is; + } + } + + if ( !line.empty() && !( ret = tChannelID::FromString( line.c_str() ) ).Valid() ) + is.setstate( ios::badbit ); + return is; } namespace vdrlive { |