Main Page   Class Hierarchy   Compound List   Compound Members   Examples  

TPT::Parser Class Reference

#include <parse.h>

List of all members.

Public Methods

 Parser (const char *filename)
 Parser (const char *filename, const Symbols &st)
 Parser (const char *buf, unsigned long size)
 Parser (const char *buf, unsigned long size, const Symbols &st)
 Parser (Buffer &buf)
 Parser (Buffer &buf, const Symbols &st)
 ~Parser ()
std::string run ()
 Parse template into a string. More...

bool run (std::ostream &os)
 Parse template directly to stream. More...

bool syntax ()
 Just do a syntax check on template. More...

unsigned geterrorcount () const
 Get the error count from a parse. More...

bool geterrorlist (ErrorList &errlist)
 Get the error list from a parse. More...

void addincludepath (const char *path)
 Add an include search path. More...

bool addfunction (const char *name, bool(*func)(std::ostream &, Object &))
 Add a callback function. More...


Detailed Description

The Parser class accepts a buffer of the template to be parsed.

Author(s):
Isaac W. Foraker
Exceptions:
tptexception  


Constructor & Destructor Documentation

TPT::Parser::Parser ( const char * filename )
 

Construct a Parser for the specified file.

Parameters:
filename   Path to TPT source file.

TPT::Parser::Parser ( const char * filename,
const Symbols & st )
 

Construct a Parser for the specified file and Symbols table.

Parameters:
filename   Path to TPT source file.
st   Reference to Symbols table.

TPT::Parser::Parser ( const char * buffer,
unsigned long size )
 

Construct a Parser for the specified fixed length buffer.

Parameters:
buffer   Pointer to buffer of TPT source.
size   Size of TPT source buffer.

TPT::Parser::Parser ( const char * buffer,
unsigned long size,
const Symbols & st )
 

Construct a Parser for the specified fixed length buffer and Symbols table.

Parameters:
buffer   Pointer to buffer of TPT source.
size   Size of TPT source buffer.

TPT::Parser::Parser ( Buffer & buf )
 

Construct a Parser for a Buffer.

Parameters:
buf   Reference to buffer containing source template.

TPT::Parser::Parser ( Buffer & buf,
const Symbols & st )
 

Construct a Parser for a Buffer and Symbols table.

Parameters:
buf   Reference to Buffer containing source template.
st   Reference to Symbols table.

TPT::Parser::~Parser ( )
 

Destruct this Parser.

Parameters:
none  


Member Function Documentation

bool TPT::Parser::addfunction ( const char * name,
bool(* func)(std::ostream &, Object &) )
 

Add a callback function.

Register a callback function to handle TPT calls to the specified function name.

See the LibTPT Documentation for details on how to write a a callback funcion.

Parameters:
name   Name of the function (without the @).
func   Function to use as callback.
Returns:
false on success; true if name already is registered to another function.

void TPT::Parser::addincludepath ( const char * path )
 

Add an include search path.

Add a path to the Include search list. By default, only ./ is searched.

Parameters:
path   Path to be searched for include files.
Returns:
nothing

unsigned TPT::Parser::geterrorcount ( ) const
 

Get the error count from a parse.

Get the number of errors and warnings.

Parameters:
none  
Returns:
0 is good.

bool TPT::Parser::geterrorlist ( ErrorList & errlist )
 

Get the error list from a parse.

Copy the errors and warnings generated by the last parse into the specified array.

Parameters:
errlist   Reference to array to receive list.
Returns:
false if no errors; true if errors copied.

bool TPT::Parser::run ( std::ostream & os )
 

Parse template directly to stream.

Parse the template in Buffer, outputing the result to the given stream while parsing.

Parameters:
os   Reference to an output stream to write.
Returns:
false on success; true if there were errors or warnings.

std::string TPT::Parser::run ( )
 

Parse template into a string.

Parse the template in Buffer and return the result as a string.

Note: This method is provided for completeness, but the preferred method of parsing is to use streams instead.

Parameters:
none  

bool TPT::Parser::syntax ( )
 

Just do a syntax check on template.

Perform only syntax checking on Buffer.

Parameters:
none  
Returns:
false on success; true if there were errors or warnings.


The documentation for this class was generated from the following files:
Generated at Tue Sep 10 23:32:47 2002 for LibTPT by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001