Main Page | Compound List | Compound Members | Examples

TPT::Parser Class Reference

List of all members.

Public Member Functions

 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.

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

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

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

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

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

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


Detailed Description

The Parser class parses the specified template using the optional preconstructed Symbols table.

Author:
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.
st Symbols table of initial values.

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.


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.

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.

bool TPT::Parser::syntax  ) 
 

Just do a syntax check on template.

Perform only syntax checking on Buffer.

Returns:
false on success;

true if there were errors or warnings.


The documentation for this class was generated from the following files:
Generated on Sat Feb 7 16:06:08 2004 for LibTPT by doxygen 1.3.3