Parser Class Reference

Parse a bit of file into an object. More...

#include <parser.h>

Inherited by ContainerParser, and SimpleParser.

List of all members.

Public Member Functions

virtual ~Parser ()
virtual void parseHead ()
 Parse what must be parsed as soon as possible.
virtual void parse ()
 Parse everything except the tail.
virtual bool parseSome (int hint)
 Parse the amount indicated by the hint.
virtual void parseTail ()
 parse the tail
bool headParsed () const
 Check if the head has been parsed.
bool parsed () const
 Check if the parsing is done except the tail.
bool tailParsed () const
 Check if the tail has been parsed.
Objectobject ()
 Get the object manipulated by the parser.
const Objectobject () const

Protected Member Functions

 Parser (Object &object)
ObjectTypemodifiableType ()
 Get the type of the object.
const ObjectTypeconstType () const
int64_t availableSize () const
 Get the number of bits between the current position in the file and the end of the object.
void setHeadParsed ()
 Mark the head as parsed.
void setParsed ()
 Mark the parser as done.
void setNoHead ()
 Mark the parser as headless, meaning that no operation have to be executed as soon as possible.
void setNoTail ()
 Mark the parser as tailless.
virtual void doParseHead ()
 [Virtual] Parse what must be parsed as soon as possible (do nothing by default)
virtual void doParse ()
 [Virtual] Parse everything remaining except the tail, assuming that the head and only the head as been parsed (do nothing by default)
virtual bool doParseSome (int hint)
 [Virtual] Parse the amount indicated by the hint (if not reimplemented calls doParse)
virtual void doParseTail ()
 [Virtual] Parse the tail

Friends

class SimpleParser
class ContainerParser
class BlockExecution
class ParserTypeScope

Detailed Description

Parse a bit of file into an object.

The parsing is done in two phases : first the head is parse, which correspond to the operations that must be executed as soon as possible which donne with parseHead and then the rest can be parsed whenever either full with parse or little by little with parseSome. For a parser that is always parsed fully as soon as possible subclass SimpleParser for convenience.

The parser can modify most of the object's attributes, however it cannot add children : for this functionnality subclass ContainerParser.

The class is virtual and needs to be reimplemented


Constructor & Destructor Documentation

virtual Parser::~Parser ( ) [inline, virtual]
Parser::Parser ( Object object) [protected]

Member Function Documentation

int64_t Parser::availableSize ( ) const [protected]

Get the number of bits between the current position in the file and the end of the object.

const ObjectType& Parser::constType ( ) const [protected]
virtual void Parser::doParse ( ) [protected, virtual]

[Virtual] Parse everything remaining except the tail, assuming that the head and only the head as been parsed (do nothing by default)

virtual void Parser::doParseHead ( ) [protected, virtual]

[Virtual] Parse what must be parsed as soon as possible (do nothing by default)

virtual bool Parser::doParseSome ( int  hint) [protected, virtual]

[Virtual] Parse the amount indicated by the hint (if not reimplemented calls doParse)

Parameters:
hintThe exact meaning of the hint is to be defined by the subclass implementing the function, for most container parsers it simply is the number of children to be added. However the only requirement is that for any hint>0, "while(doParseSome(hint)){}" finishes.
Returns:
true if the parsing is done false otherwise
virtual void Parser::doParseTail ( ) [protected, virtual]

[Virtual] Parse the tail

The tail will be parsed after every subsequent parsers have been parsed including their tails

bool Parser::headParsed ( ) const

Check if the head has been parsed.

Get the type of the object.

Get the object manipulated by the parser.

const Object& Parser::object ( ) const
virtual void Parser::parse ( ) [virtual]

Parse everything except the tail.

bool Parser::parsed ( ) const

Check if the parsing is done except the tail.

virtual void Parser::parseHead ( ) [virtual]

Parse what must be parsed as soon as possible.

Reimplemented in SimpleParser.

virtual bool Parser::parseSome ( int  hint) [virtual]

Parse the amount indicated by the hint.

virtual void Parser::parseTail ( ) [virtual]

parse the tail

void Parser::setHeadParsed ( ) [protected]

Mark the head as parsed.

void Parser::setNoHead ( ) [protected]

Mark the parser as headless, meaning that no operation have to be executed as soon as possible.

void Parser::setNoTail ( ) [protected]

Mark the parser as tailless.

void Parser::setParsed ( ) [protected]

Mark the parser as done.

bool Parser::tailParsed ( ) const

Check if the tail has been parsed.


Friends And Related Function Documentation

friend class BlockExecution [friend]
friend class ContainerParser [friend]
friend class ParserTypeScope [friend]
friend class SimpleParser [friend]

The documentation for this class was generated from the following file: