#include <lwoInputFile.h>
Inheritance diagram for LwoInputFile:
Public Member Functions | |
LwoInputFile () | |
~LwoInputFile () | |
double | get_lwo_version () const |
Returns the version of the Lightwave file being read. | |
void | set_lwo_version (double version) |
Changes the version number reported for the Lightwave file. | |
int | get_vx () |
Reads a Lightwave variable-length index. | |
LVecBase3f | get_vec3 () |
Reads a three-component vector of floats. | |
Filename | get_filename () |
Reads a Lightwave platform-neutral filename and converts it to a Panda platform-neutral filename. | |
virtual TypeHandle | get_type () const |
virtual TypeHandle | force_init_type () |
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. | |
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 |
Private Attributes | |
double | _lwo_version |
Static Private Attributes | |
TypeHandle | _type_handle |
Definition at line 40 of file lwoInputFile.h.
|
Definition at line 45 of file lwoInputFile.cxx. |
|
Definition at line 56 of file lwoInputFile.cxx. References IffInputFile::get_be_uint16(), and PN_uint16. |
|
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. |
|
Reimplemented from IffInputFile. Definition at line 62 of file lwoInputFile.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 IffInputFile::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 IffInputFile::read_bytes(). |
|
Extracts an unsigned 16-bit big-endian integer.
Definition at line 188 of file iffInputFile.cxx. References DatagramIterator::get_be_float32(), and IffInputFile::read_bytes(). Referenced by IffInputFile::get_chunk(), LwoPolygons::get_polygon(), LwoVertexMap::get_value(), LwoLayer::make_generic(), and ~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(), IffInputFile::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 IffInputFile::_unexpected_eof, IffInputFile::get_be_uint16(), IffInputFile::get_bytes_read(), IffInputFile::get_id(), IffInputFile::is_eof(), length, IffChunk::make_new_chunk(), nout, NULL, PN_uint16, PT, size_t, and IffInputFile::skip_bytes(). Referenced by LwoGroupChunk::get_chunk(). |
|
Reimplemented from IffInputFile. Definition at line 63 of file lwoInputFile.h. |
|
Returns the filename that the InputFile is currently opened on, if available.
Definition at line 49 of file iffInputFile.I. References IffInputFile::_eof. |
|
Reads a Lightwave platform-neutral filename and converts it to a Panda platform-neutral filename.
Definition at line 112 of file lwoInputFile.cxx. |
|
Extracts a 4-character IFF ID.
Definition at line 267 of file iffInputFile.cxx. References length, nout, and NULL. Referenced by IffInputFile::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 IffInputFile::is_eof(). |
|
Returns the version of the Lightwave file being read. This is unknown until the header record has been read; then it will be set by the header. Definition at line 36 of file lwoInputFile.I. References _lwo_version, and INLINE. Referenced by LwoPolygons::get_polygon(). |
|
Extracts a null-terminated string.
Definition at line 244 of file iffInputFile.cxx. References NULL. Referenced by LwoTags::get_tag(), LwoVertexMap::get_value(), 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(). |
|
Reimplemented from IffInputFile. Definition at line 59 of file lwoInputFile.h. References _type_handle, IffInputFile::init_type(), and register_type(). |
|
Extracts an unsigned 8-bit integer.
Definition at line 134 of file iffInputFile.cxx. |
|
Reads a three-component vector of floats.
Definition at line 93 of file lwoInputFile.cxx. References Filename, IffInputFile::get_string(), nout, path, and size_t. Referenced by LwoPoints::get_point(), and LwoLayer::make_generic(). |
|
Reads a Lightwave variable-length index. This is either a 2-byte or 4-byte integer. Definition at line 70 of file lwoInputFile.cxx. Referenced by LwoPolygonTags::get_tag(), LwoVertexMap::get_value(), and LwoPolygons::read_iff(). |
|
Reimplemented from IffInputFile. Definition at line 66 of file lwoInputFile.h. References _type_handle. |
|
Returns true if the last read operation failed because of reaching EOF, false otherwise.
Definition at line 64 of file iffInputFile.I. References IffInputFile::_bytes_read, IffInputFile::get_int8(), and INLINE. Referenced by LwoGroupChunk::get_chunk(), IffInputFile::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 from IffInputFile. Definition at line 139 of file lwoInputFile.cxx. |
|
Attempts to open the indicated filename for reading. Returns true if successful, false otherwise. Definition at line 71 of file iffInputFile.cxx. References IffInputFile::_bytes_read, IffInputFile::_eof, IffInputFile::_input, IffInputFile::_owns_istream, and IffInputFile::_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 IffInputFile::get_be_int16(), IffInputFile::get_be_int32(), IffInputFile::get_be_uint16(), and IffInputFile::set_input(). |
|
Indicates the filename that the InputFile is currently opened on.
Definition at line 34 of file iffInputFile.I. References IffInputFile::_filename, and INLINE. Referenced by IffInputFile::~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 IffInputFile::read_bytes(). Referenced by IffInputFile::~IffInputFile(). |
|
Changes the version number reported for the Lightwave file. Normally this is only called by LwoHeader as it is read. Definition at line 54 of file lwoInputFile.I. Referenced by LwoHeader::read_iff(). |
|
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 IffInputFile::get_chunk(). |
|
Definition at line 88 of file iffInputFile.h. Referenced by IffInputFile::IffInputFile(), IffInputFile::is_eof(), and IffInputFile::open_read(). |
|
Definition at line 86 of file iffInputFile.h. Referenced by IffInputFile::get_filename(), and IffInputFile::open_read(). |
|
Definition at line 84 of file iffInputFile.h. Referenced by IffInputFile::set_filename(). |
|
Definition at line 83 of file iffInputFile.h. Referenced by IffInputFile::open_read(). |
|
Definition at line 56 of file lwoInputFile.h. Referenced by get_lwo_version(). |
|
Definition at line 85 of file iffInputFile.h. Referenced by IffInputFile::open_read(). |
|
Reimplemented from IffInputFile. Definition at line 35 of file lwoInputFile.cxx. Referenced by get_type(), and init_type(). |
|
Definition at line 87 of file iffInputFile.h. Referenced by IffInputFile::get_chunk(), and IffInputFile::open_read(). |