#ifndef __LineParser_h__ # define __LineParser_h__ #include "Parser.h" namespace coreutils { /// /// LineParser builds one line of text at a time from the shared /// StreamReader - terminated by LF or CRLF, either accepted, the /// terminator itself is not included in getLine(). Resumable: if no /// terminator has arrived yet, parse() reports INCOMPLETE and leaves the /// cursor exactly where it started, so the same unconsumed bytes are /// re-scanned (along with whatever new data arrived) on the next call. /// class LineParser : public Parser { public: LineParser(StreamReader &reader); /// /// Valid once doParse() has returned Status::COMPLETE - the line that /// was parsed, with its terminator stripped. /// ZString getLine(); protected: Status parse() override; private: ZString line; }; } #endif