fs/io/TextFile: add method Check()
This commit is contained in:
parent
7cc25f91ff
commit
8283f23651
@ -61,3 +61,11 @@ TextFile::ReadLine()
|
|||||||
|
|
||||||
return buffered_reader->ReadLine();
|
return buffered_reader->ReadLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
TextFile::Check(Error &error) const
|
||||||
|
{
|
||||||
|
assert(buffered_reader != nullptr);
|
||||||
|
|
||||||
|
return buffered_reader->Check(error);
|
||||||
|
}
|
||||||
|
@ -56,10 +56,18 @@ public:
|
|||||||
* space. There is a reasonable maximum line length, only to
|
* space. There is a reasonable maximum line length, only to
|
||||||
* prevent denial of service.
|
* prevent denial of service.
|
||||||
*
|
*
|
||||||
|
* Use Check() after nullptr has been returned to check
|
||||||
|
* whether an error occurred or end-of-file has been reached.
|
||||||
|
*
|
||||||
* @param file the source file, opened in text mode
|
* @param file the source file, opened in text mode
|
||||||
* @return a pointer to the line, or nullptr on end-of-file or error
|
* @return a pointer to the line, or nullptr on end-of-file or error
|
||||||
*/
|
*/
|
||||||
char *ReadLine();
|
char *ReadLine();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether a ReadLine() call has thrown an error.
|
||||||
|
*/
|
||||||
|
bool Check(Error &error) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user