62 lines
1.1 KiB
C++
62 lines
1.1 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);
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
virtual ~Parser();
|
|
|
|
///
|
|
/// doParse is the entry and re-entry point method to continue the parsing process.
|
|
///
|
|
|
|
int 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 int parse();
|
|
|
|
protected:
|
|
MString buffer;
|
|
|
|
private:
|
|
Parser *parser;
|
|
vector<Parser *> chain;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|