libvariant
 All Classes Namespaces Files Functions Enumerations Groups
Public Member Functions | Protected Attributes | List of all members
libvariant::ParserImpl Class Referenceabstract

The class that parser implementations override. More...

#include <Variant/Parser.h>

Inheritance diagram for libvariant::ParserImpl:
libvariant::BundleHdrParserImpl libvariant::EventBuffer libvariant::JSONParserImpl libvariant::MsgPackParserImpl libvariant::XMLPLISTParserImpl libvariant::YAMLParserImpl

Public Member Functions

virtual int Run ()=0
 
virtual void PushAction (shared_ptr< ParserActions > action)
 
virtual shared_ptr< ParserActionsPopAction ()
 
ParserActionsTopAction ()
 
virtual bool Done () const =0
 
virtual bool Error () const =0
 
virtual bool Ok () const =0
 
virtual std::string ErrorStr () const =0
 Return a string describing the last error suitable for presentation to a user.
 
virtual void Reset ()=0
 Reset the parser.
 

Protected Attributes

std::deque< shared_ptr
< ParserActions > > 
action_stack
 

Detailed Description

The class that parser implementations override.

Member Function Documentation

virtual bool libvariant::ParserImpl::Done ( ) const
pure virtual

These three functiosn can be used to query the state later. Done means that a call to Process will immediately return 1 Error if Process threw an exception last Ok if everything looks good (Process never been called, or last return 0 or possibly -1)

Implemented in libvariant::EventBuffer, libvariant::JSONParserImpl, libvariant::XMLPLISTParserImpl, libvariant::YAMLParserImpl, libvariant::BundleHdrParserImpl, and libvariant::MsgPackParserImpl.

virtual shared_ptr<ParserActions> libvariant::ParserImpl::PopAction ( )
inlinevirtual

Pop the top ParserActions handler off the action handler stack and return it.

virtual void libvariant::ParserImpl::PushAction ( shared_ptr< ParserActions action)
inlinevirtual

Push a new ParserActions handler onto the action handler stack.

virtual int libvariant::ParserImpl::Run ( )
pure virtual

Attempt to parse some actions. At least one ParserActions should be on the action stack.

Run is not guaranteed to be recursively callable from inside a ParserActions callback. Do not do that.

return 0 on success return 1 when done return -1 if needing more data is detected (not all parsers support this; can be treated as an error) throw on error

Implemented in libvariant::EventBuffer, libvariant::JSONParserImpl, libvariant::XMLPLISTParserImpl, libvariant::YAMLParserImpl, libvariant::BundleHdrParserImpl, and libvariant::MsgPackParserImpl.

ParserActions* libvariant::ParserImpl::TopAction ( )
inline

Access the top ParserActions


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