CoreUtils/Parser.h
2025-12-31 16:56:00 -08:00

71 lines
1.2 KiB
C++

#ifndef __Parser_h__
#define __Parser_h__
#include <fstream>
#include <vector>
namespace coreutils {
///
/// Use the StreamReader to read data from a socket and buffer it for use by
/// various stream parsers such as IMFMessage. The reader maintains data
/// consistency regardless of the packet delivery for the stream.
///
class Parser {
public:
///
///
///
Parser(StreamReader &reader, Parser *parser);
///
///
///
enum class Status {
COMPLETE,
INCOMPLETE
};
///
///
///
virtual ~Parser();
///
/// doParse is the entry and re-entry point method to continue the parsing process.
///
Status doParse();
///
/// Inside of parse() you can call another parser object with the checkParse method to
/// determine if the parsing should branch to the new passed parsing object.
///
bool checkParse(Parser &parser); <--- can be called in parse to see if the parsing should branch
///
///
///
virtual Status parse();
protected:
MString buffer;
private:
Parser *parser;
vector<Parser *> chain;
};
}
#endif