Main Page | Compound List | Compound Members | Examples

TPT::IParser Class Reference

List of all members.

Public Member Functions

 IParser (const char *filename, Symbols &st)
 IParser (const char *buf, unsigned long size, Symbols &st)
 IParser (Buffer &buf, Symbols &st)
 ~IParser ()
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 IParser class parses a template like the Parser class, except the IParser class allows the Symbols table to be modified by the template.

Author:
Isaac W. Foraker
Exceptions:
tptexception 


Constructor & Destructor Documentation

TPT::IParser::IParser const char *  filename,
Symbols st
 

Construct a IParser for the specified file and Symbols table.

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

TPT::IParser::IParser const char *  buffer,
unsigned long  size,
Symbols st
 

Construct a IParser 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 for read and write.

TPT::IParser::IParser Buffer buf,
Symbols st
 

Construct a IParser for a Buffer and Symbols table.

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

TPT::IParser::~IParser  ) 
 

Destruct this IParser.


Member Function Documentation

bool TPT::IParser::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::IParser::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::IParser::geterrorcount  )  const
 

Get the error count from a parse.

Get the number of errors and warnings.

Returns:
0 is good.

bool TPT::IParser::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::IParser::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::IParser::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::IParser::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