#include <iffInputFile.h>
Inheritance diagram for IffInputFile:
Public Member Functions | |
IffInputFile () | |
virtual | ~IffInputFile () |
bool | open_read (Filename filename) |
Attempts to open the indicated filename for reading. | |
void | set_input (istream *input, bool owns_istream) |
Sets up the input to use an arbitrary istream. | |
void | set_filename (const Filename &filename) |
Indicates the filename that the InputFile is currently opened on. | |
const Filename & | get_filename () const |
Returns the filename that the InputFile is currently opened on, if available. | |
bool | is_eof () const |
Returns true if the last read operation failed because of reaching EOF, false otherwise. | |
size_t | get_bytes_read () const |
Returns the number of bytes read so far from the input file. | |
void | align () |
If the current file pointer is not positioned on an even-byte boundary, reads and discards one byte so that it is. | |
PN_int8 | get_int8 () |
Extracts a signed 8-bit integer. | |
PN_uint8 | get_uint8 () |
Extracts an unsigned 8-bit integer. | |
PN_int16 | get_be_int16 () |
Extracts a signed 16-bit big-endian integer. | |
PN_int32 | get_be_int32 () |
Extracts a signed 32-bit big-endian integer. | |
PN_uint16 | get_be_uint16 () |
Extracts an unsigned 16-bit big-endian integer. | |
PN_uint32 | get_be_uint32 () |
Extracts an unsigned 32-bit big-endian integer. | |
float | get_be_float32 () |
Extracts a 32-bit big-endian single-precision floating-point number. | |
string | get_string () |
Extracts a null-terminated string. | |
IffId | get_id () |
Extracts a 4-character IFF ID. | |
PointerTo< IffChunk > | get_chunk () |
Reads a single IffChunk, determining its type based on its ID. | |
PointerTo< IffChunk > | get_subchunk (IffChunk *context) |
Similar to get_chunk(), except the chunk size is only a 16-bit number instead of 32-bit, and it takes a context, which is the chunk in which this chunk is encountered. | |
bool | read_byte (char &byte) |
Reads a single byte. | |
bool | read_bytes (Datagram &datagram, int length) |
Reads a series of bytes, and stores them in the indicated Datagram. | |
bool | skip_bytes (int length) |
Reads a series of bytes, but does not store them. | |
virtual TypeHandle | get_type () const |
virtual TypeHandle | force_init_type () |
int | get_type_index () const |
bool | is_of_type (TypeHandle handle) const |
bool | is_exact_type (TypeHandle handle) const |
Static Public Member Functions | |
TypeHandle | get_class_type () |
void | init_type () |
Protected Member Functions | |
virtual IffChunk * | make_new_chunk (IffId id) |
Allocates and returns a new chunk of the appropriate type based on the given ID. | |
Protected Attributes | |
istream * | _input |
Filename | _filename |
bool | _owns_istream |
bool | _eof |
bool | _unexpected_eof |
size_t | _bytes_read |
Static Private Attributes | |
TypeHandle | _type_handle |
Friends | |
class | IffChunk |
Definition at line 44 of file iffInputFile.h.
|
Definition at line 38 of file iffInputFile.cxx. References _bytes_read. |
|
Definition at line 54 of file iffInputFile.cxx. References Filename::open_read(), Filename::set_binary(), set_filename(), and set_input(). |
|
If the current file pointer is not positioned on an even-byte boundary, reads and discards one byte so that it is.
Definition at line 96 of file iffInputFile.I. |
|
Implements TypedObject. Reimplemented in LwoInputFile. Definition at line 94 of file iffInputFile.h. |
|
Extracts a 32-bit big-endian single-precision floating-point number.
Definition at line 226 of file iffInputFile.cxx. Referenced by LwoVertexMap::get_value(). |
|
Extracts a signed 16-bit big-endian integer.
Definition at line 152 of file iffInputFile.cxx. References DatagramIterator::get_be_uint16(), PN_uint16, and read_bytes(). Referenced by LwoPolygonTags::get_tag(). |
|
Extracts a signed 32-bit big-endian integer.
Definition at line 170 of file iffInputFile.cxx. References DatagramIterator::get_be_uint32(), PN_uint32, and read_bytes(). |
|
Extracts an unsigned 16-bit big-endian integer.
Definition at line 188 of file iffInputFile.cxx. References DatagramIterator::get_be_float32(), and read_bytes(). Referenced by get_chunk(), LwoPolygons::get_polygon(), LwoVertexMap::get_value(), LwoLayer::make_generic(), and LwoInputFile::~LwoInputFile(). |
|
Extracts an unsigned 32-bit big-endian integer.
Definition at line 206 of file iffInputFile.cxx. |
|
Returns the number of bytes read so far from the input file.
Definition at line 79 of file iffInputFile.I. Referenced by LwoGroupChunk::get_chunk(), get_chunk(), LwoPoints::get_point(), LwoPolygons::get_polygon(), LwoTags::get_tag(), LwoPolygonTags::get_tag(), LwoVertexMap::get_value(), LwoLayer::make_generic(), and LwoGroupChunk::read_chunks_iff(). |
|
Reads a single IffChunk, determining its type based on its ID. Allocates and returns a new IffChunk object of the appropriate type. Returns NULL if EOF is reached before the chunk can be read completely, or if there is some other error in reading the chunk. Definition at line 293 of file iffInputFile.cxx. References _unexpected_eof, get_be_uint16(), get_bytes_read(), get_id(), is_eof(), length, IffChunk::make_new_chunk(), nout, NULL, PN_uint16, PT, size_t, and skip_bytes(). Referenced by LwoGroupChunk::get_chunk(). |
|
Reimplemented from TypedObject. Reimplemented in LwoInputFile. Definition at line 95 of file iffInputFile.h. |
|
Returns the filename that the InputFile is currently opened on, if available.
Definition at line 49 of file iffInputFile.I. References _eof. |
|
Extracts a 4-character IFF ID.
Definition at line 267 of file iffInputFile.cxx. References length, nout, and NULL. Referenced by get_chunk(), LwoPolygons::get_polygon(), LwoPolygonTags::get_tag(), LwoVertexMap::get_value(), and LwoHeader::LwoHeader(). |
|
Extracts a signed 8-bit integer.
Definition at line 116 of file iffInputFile.cxx. Referenced by is_eof(). |
|
Extracts a null-terminated string.
Definition at line 244 of file iffInputFile.cxx. References NULL. Referenced by LwoTags::get_tag(), LwoVertexMap::get_value(), LwoInputFile::get_vec3(), and LwoLayer::make_generic(). |
|
Similar to get_chunk(), except the chunk size is only a 16-bit number instead of 32-bit, and it takes a context, which is the chunk in which this chunk is encountered. The parent chunk may (or may not) decide what kind of chunk is meant by the various id's encountered. Definition at line 355 of file iffInputFile.cxx. Referenced by LwoGroupChunk::read_chunks_iff(). |
|
Implements TypedObject. Reimplemented in LwoInputFile. Definition at line 91 of file iffInputFile.h. References _type_handle, TypedObject::init_type(), and register_type(). |
|
Extracts an unsigned 8-bit integer.
Definition at line 134 of file iffInputFile.cxx. |
|
Reimplemented from TypedObject. Reimplemented in LwoInputFile. Definition at line 98 of file iffInputFile.h. References _type_handle. Referenced by ConfigureFn(), and LwoInputFile::get_type(). |
|
Returns true if the last read operation failed because of reaching EOF, false otherwise.
Definition at line 64 of file iffInputFile.I. References _bytes_read, get_int8(), and INLINE. Referenced by LwoGroupChunk::get_chunk(), get_chunk(), LwoPoints::get_point(), LwoPolygons::get_polygon(), LwoTags::get_tag(), LwoPolygonTags::get_tag(), LwoVertexMap::get_value(), and LwoGroupChunk::read_chunks_iff(). |
|
Allocates and returns a new chunk of the appropriate type based on the given ID.
Reimplemented in LwoInputFile. Definition at line 487 of file iffInputFile.cxx. Referenced by IffChunk::write(). |
|
Attempts to open the indicated filename for reading. Returns true if successful, false otherwise. Definition at line 71 of file iffInputFile.cxx. References _bytes_read, _eof, _input, _owns_istream, and _unexpected_eof. |
|
Reads a single byte. Returns true if successful, false otherwise. Definition at line 409 of file iffInputFile.cxx. |
|
Reads a series of bytes, and stores them in the indicated Datagram. Returns true if successful, false otherwise. Definition at line 433 of file iffInputFile.cxx. Referenced by get_be_int16(), get_be_int32(), get_be_uint16(), and set_input(). |
|
Indicates the filename that the InputFile is currently opened on.
Definition at line 34 of file iffInputFile.I. References _filename, and INLINE. Referenced by ~IffInputFile(). |
|
Sets up the input to use an arbitrary istream. If owns_istream is true, the istream will be deleted when the IffInputFile destructs. Definition at line 96 of file iffInputFile.cxx. References DatagramIterator::get_int8(), PN_int8, and read_bytes(). Referenced by ~IffInputFile(). |
|
Reads a series of bytes, but does not store them. Returns true if successful, false otherwise. Definition at line 462 of file iffInputFile.cxx. Referenced by get_chunk(). |
|
Definition at line 107 of file iffInputFile.h. |
|
Definition at line 88 of file iffInputFile.h. Referenced by IffInputFile(), is_eof(), and open_read(). |
|
Definition at line 86 of file iffInputFile.h. Referenced by get_filename(), and open_read(). |
|
Definition at line 84 of file iffInputFile.h. Referenced by set_filename(). |
|
Definition at line 83 of file iffInputFile.h. Referenced by open_read(). |
|
Definition at line 85 of file iffInputFile.h. Referenced by open_read(). |
|
Reimplemented from TypedObject. Reimplemented in LwoInputFile. Definition at line 28 of file iffInputFile.cxx. Referenced by get_type(), and init_type(). |
|
Definition at line 87 of file iffInputFile.h. Referenced by get_chunk(), and open_read(). |