hgl 0.5.25
A compiler/interpreter suite for developing images
Public Member Functions | List of all members
HGL::Common::IParser< ProjectInterface, Factory > Interface Template Referenceabstract

Interface to a parsing subsystem. More...

#include "iparser.h"

Public Member Functions

virtual void cleanup () const =0
 Cleanup function after parsing or if an exception is thrown.
 
virtual const char * getMode () const =0
 Gets the opening mode of the input file. More...
 
virtual ProjectInterface * parse (const Common::URI &infile, Factory *const factory, ProjectInterface *const lib=0) const =0 throw (HGL::Exception::ParserException, HGL::Exception::IOException)
 Parses an input source and returns a type tree. More...
 
virtual ProjectInterface * parse (Factory *const factory, ProjectInterface *const lib) const =0 throw (HGL::Exception::ParserException, HGL::Exception::IOException)
 

Detailed Description

template<class ProjectInterface = HGL::Type::IProject, class Factory = HGL::Type::IProjectFactory>
interface HGL::Common::IParser< ProjectInterface, Factory >

Interface to a parsing subsystem.

This interface provides methods needed for HGL::Common::createProject Concrete subclasses should implement a parser, which returns the ProjectInterface as root of the type tree and use Factory to create the types.

See Also
HGL::Type::IProject
HGL::Type::IProjectFactory
HGL::Common::createProject
Template Parameters
ProjectInterfacethe type of root type
Factorytype of the factory to create types
Author
Heiko Schäfer heiko.nosp@m.@hgl.nosp@m..rang.nosp@m.un.d.nosp@m.e

Member Function Documentation

template<class ProjectInterface = HGL::Type::IProject, class Factory = HGL::Type::IProjectFactory>
virtual const char* HGL::Common::IParser< ProjectInterface, Factory >::getMode ( ) const
pure virtual

Gets the opening mode of the input file.

"rb" for binary input or "r" for text input

Returns
the opening mode of the input file
template<class ProjectInterface = HGL::Type::IProject, class Factory = HGL::Type::IProjectFactory>
virtual ProjectInterface* HGL::Common::IParser< ProjectInterface, Factory >::parse ( const Common::URI infile,
Factory *const  factory,
ProjectInterface *const  lib = 0 
) const
throw (HGL::Exception::ParserException,
HGL::Exception::IOException
)
pure virtual

Parses an input source and returns a type tree.

Exceptions
HGL::Exception::ParserExceptionif there has been a parsing error
HGL::Exception::IOExceptionif there has been an I/O error
Parameters
infilethe input file
factoryfactory to use to create types
libroot node of the standard library
Returns
the root node of the type tree
template<class ProjectInterface = HGL::Type::IProject, class Factory = HGL::Type::IProjectFactory>
virtual ProjectInterface* HGL::Common::IParser< ProjectInterface, Factory >::parse ( Factory *const  factory,
ProjectInterface *const  lib 
) const
throw (HGL::Exception::ParserException,
HGL::Exception::IOException
)
pure virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.