summaryrefslogtreecommitdiff
path: root/tools.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools.cpp')
-rw-r--r--tools.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools.cpp b/tools.cpp
index cca1b9d..8053c3d 100644
--- a/tools.cpp
+++ b/tools.cpp
@@ -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 {