org.anarres.cpp
Class CppReader

java.lang.Object
  extended by java.io.Reader
      extended by org.anarres.cpp.CppReader
All Implemented Interfaces:
Closeable, Readable

public class CppReader
extends Reader

A Reader wrapper around the Preprocessor. This is a utility class to provide a transparent Reader which preprocesses the input text.

See Also:
Preprocessor, Reader

Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
CppReader(Preprocessor p)
           
CppReader(Reader r)
           
 
Method Summary
 void addMacro(String name)
          Defines the given name as a macro.
 void addMacro(String name, String value)
          Defines the given name as a macro.
 void close()
           
 Preprocessor getPreprocessor()
          Returns the Preprocessor used by this CppReader.
 int read()
           
 int read(char[] cbuf, int off, int len)
           
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CppReader

public CppReader(Reader r)

CppReader

public CppReader(Preprocessor p)
Method Detail

getPreprocessor

public Preprocessor getPreprocessor()
Returns the Preprocessor used by this CppReader.


addMacro

public void addMacro(String name)
              throws LexerException
Defines the given name as a macro. This is a convnience method.

Throws:
LexerException

addMacro

public void addMacro(String name,
                     String value)
              throws LexerException
Defines the given name as a macro. This is a convnience method.

Throws:
LexerException

read

public int read()
         throws IOException
Overrides:
read in class Reader
Throws:
IOException

read

public int read(char[] cbuf,
                int off,
                int len)
         throws IOException
Specified by:
read in class Reader
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Specified by:
close in class Reader
Throws:
IOException


Copyright © 2007 Shevek, Anarres. All Rights Reserved.