Top Description Fields Constructors Methods
com.jogamp.gluegen.jcpp

public Class CppReader

extends Reader
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.Closeable, .IOException, .Reader, javax.annotation.Nonnull

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

Modifier and TypeField and Description
private final Preprocessor
private int
private String
Inherited from java.io.Reader:
lock

Constructor Summary

AccessConstructor and Description
public
CppReader(final Reader r)

public

Method Summary

Modifier and TypeMethod and Description
public void
addMacro(String name)

Defines the given name as a macro.

public void
addMacro(String name, String value)

Defines the given name as a macro.

public void
close()

Implements abstract java.io.Reader.close.

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.
public Preprocessor
getPreprocessor()

Returns the Preprocessor used by this CppReader.

public int
read()

Overrides java.io.Reader.read.

Reads a single character.
public int
read(char[]
Destination buffer
cbuf
,
int
Offset at which to start storing characters
off
,
int
Maximum number of characters to read
len
)

Implements abstract java.io.Reader.read.

Reads characters into a portion of an array.
private boolean
Inherited from java.io.Reader:
markmarkSupportednullReaderreadreadreadyresetskiptransferTo

Field Detail

cppback to summary
private final Preprocessor cpp
idxback to summary
private int idx
tokenback to summary
private String token

Constructor Detail

CppReaderback to summary
public CppReader(final Reader r)
CppReaderback to summary
public CppReader(Preprocessor p)

Method Detail

addMacroback to summary
public void addMacro(String name) throws LexerException

Defines the given name as a macro. This is a convnience method.

addMacroback to summary
public void addMacro(String name, String value) throws LexerException

Defines the given name as a macro. This is a convnience method.

closeback to summary
public void close() throws IOException

Implements abstract java.io.Reader.close.

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
getPreprocessorback to summary
public Preprocessor getPreprocessor()

Returns the Preprocessor used by this CppReader.

Annotations
@Nonnull
readback to summary
public int read() throws IOException

Overrides java.io.Reader.read.

Doc from java.io.Reader.read.

Reads a single character. This method will block until a character is available, an I/O error occurs, or the end of the stream is reached.

Subclasses that intend to support efficient single-character input should override this method.

Returns:int

The character read, as an integer in the range 0 to 65535 (0x00-0xffff), or -1 if the end of the stream has been reached

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
readback to summary
public int read(char[] cbuf, int off, int len) throws IOException

Implements abstract java.io.Reader.read.

Doc from java.io.Reader.read.

Reads characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

If len is zero, then no characters are read and 0 is returned; otherwise, there is an attempt to read at least one character. If no character is available because the stream is at its end, the value -1 is returned; otherwise, at least one character is read and stored into cbuf.

Parameters
cbuf:char[]

Destination buffer

off:int

Offset at which to start storing characters

len:int

Maximum number of characters to read

Returns:int

The number of characters read, or -1 if the end of the stream has been reached

Exceptions
IOException:
If an I/O error occurs
refillback to summary
private boolean refill() throws IOException