c2ephp

IReader Interface Reference

Interface for reading data. More...

Inheritance diagram for IReader:

List of all members.

Public Member Functions

 ReadInt ($length)
 Reads an integer.
 Read ($length)
 Reads a string.
 GetSubString ($start, $length=FALSE)
 Gets a substring.
 GetPosition ()
 Gets the position of the cursor.
 Seek ($position)
 Changes the current position in the reader's stream.
 Skip ($count)
 Advances the position of the reader by $count.
 ReadCString ()
 Reads a c-style string at the current position.

Detailed Description

Interface for reading data.

This is implemented by StringReader and FileReader to allow the main c2ephp classes to read data from strings and files with a consistent and simple OO interface.
IReaders work a bit like file handles: they store a position and all their functions are based around that position.

Definition at line 12 of file IReader.php.


Member Function Documentation

IReader::GetPosition ( )

Gets the position of the cursor.

This is analagous to ftell in C or PHP.

Implemented in FileReader, and StringReader.

IReader::GetSubString ( start,
length = FALSE 
)

Gets a substring.

This function is to allow things like PRAYFile to pull out a big chunk of data and then initialise a new StringReader to deal with it. It's not the most efficient way of doing things memory-wise, but it simplifies the code and c2e files don't tend to get big enough to make this inefficiency a concern on any reasonably modern hardware.

Implemented in FileReader, and StringReader.

IReader::Read ( length)

Reads a string.

Parameters:
$lengthLength of the string to read in bytes

Implemented in FileReader, and StringReader.

IReader::ReadCString ( )

Reads a c-style string at the current position.

C-style means that the string is terminated by a NUL (0) character.

Implemented in FileReader, and StringReader.

IReader::ReadInt ( length)

Reads an integer.

Parameters:
$lengthLength of the integer in bytes.

Implemented in FileReader, and StringReader.

IReader::Seek ( position)

Changes the current position in the reader's stream.

This is analagous to fseek in C or PHP.

Implemented in FileReader, and StringReader.

IReader::Skip ( count)

Advances the position of the reader by $count.

Implemented in FileReader, and StringReader.


The documentation for this interface was generated from the following file:
 All Classes Files Functions Variables Enumerations