CoreUtils/Parser.h
2026-01-05 16:49:41 -08:00

73 lines
1.3 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 MString {
public:
///
///
///
Parser(int socket);
///
///
///
enum class Status {
COMPLETE,
INCOMPLETE,
DATA_AVAIL
};
///
///
///
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:
int socket;
Parser *parser;
vector<Parser *> chain;
};
}
#endif