Puma Reference Manual Puma: Puma::CUnit Class Reference



Puma::CUnit Class Reference

#include <Puma/CUnit.h>

Inheritance diagram for Puma::CUnit:

Inheritance graph

List of all members.


Detailed Description

Specialized token unit for C/C++ tokens.

Provides a streaming interface for easy scanning of C/C++ tokens using a Puma::CScanner object. The input stream is scanned either by calling Puma::CUnit::scan() or by using the stream manipulator Puma::endu.

Example:

 Puma::ErrorStream es;
 Puma::CUnit unit(es)
 unit << "int main() {" << std::endl;
 unit << "  int fac0 = 1;" << std::endl;
 for (int i = 1; i < 10; i++) {
   unit << "  int fac" << i << " = " << i 
        << " * fac" << (i-1) << ";" << std::endl;
 }
 unit << "}\n" << Puma::endu;

Public Member Functions

 CUnit (ErrorSink &err)
 Constructor.
virtual ~CUnit ()
 Destructor.
CScannerscanner () const
 Get the scanner used to scan the string stream.
void scan ()
 Scan the stream now.

Constructor & Destructor Documentation

Puma::CUnit::CUnit ( ErrorSink err  )  [inline]

Constructor.

Parameters:
err The error stream on which to report errors.

virtual Puma::CUnit::~CUnit (  )  [inline, virtual]

Destructor.


Member Function Documentation

CScanner& Puma::CUnit::scanner (  )  const [inline]

Get the scanner used to scan the string stream.

void Puma::CUnit::scan (  ) 

Scan the stream now.

Produces the token chain.




Puma Reference Manual. Created on 5 Nov 2008.