A wrapper around an istream used for reading an IFF file. More...
#include "iffInputFile.h"
Public Member Functions | |
void | align () |
If the current file pointer is not positioned on an even-byte boundary, reads and discards one byte so that it is. More... | |
virtual TypeHandle | force_init_type () |
PN_stdfloat | get_be_float32 () |
Extracts a 32-bit big-endian single-precision floating-point number. More... | |
int16_t | get_be_int16 () |
Extracts a signed 16-bit big-endian integer. More... | |
int32_t | get_be_int32 () |
Extracts a signed 32-bit big-endian integer. More... | |
uint16_t | get_be_uint16 () |
Extracts an unsigned 16-bit big-endian integer. More... | |
uint32_t | get_be_uint32 () |
Extracts an unsigned 32-bit big-endian integer. More... | |
size_t | get_bytes_read () const |
Returns the number of bytes read so far from the input file. More... | |
const Filename & | get_filename () const |
Returns the filename that the InputFile is currently opened on, if available. More... | |
IffId | get_id () |
Extracts a 4-character IFF ID. More... | |
int8_t | get_int8 () |
Extracts a signed 8-bit integer. More... | |
std::string | get_string () |
Extracts a null-terminated string. More... | |
virtual TypeHandle | get_type () const |
uint8_t | get_uint8 () |
Extracts an unsigned 8-bit integer. More... | |
bool | is_eof () const |
Returns true if the last read operation failed because of reaching EOF, false otherwise. More... | |
bool | open_read (Filename filename) |
Attempts to open the indicated filename for reading. More... | |
PT (IffChunk) get_chunk() | |
PT (IffChunk) get_subchunk(IffChunk *context) | |
bool | read_byte (char &byte) |
Reads a single byte. More... | |
bool | read_bytes (Datagram &datagram, int length) |
Reads a series of bytes, and stores them in the indicated Datagram. More... | |
void | set_filename (const Filename &filename) |
Indicates the filename that the InputFile is currently opened on. More... | |
void | set_input (std::istream *input, bool owns_istream) |
Sets up the input to use an arbitrary istream. More... | |
bool | skip_bytes (int length) |
Reads a series of bytes, but does not store them. More... | |
![]() | |
TypedObject (const TypedObject ©)=default | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
int | get_best_parent_from_Set (const std::set< int > &) const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More... | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. More... | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. More... | |
TypedObject & | operator= (const TypedObject ©)=default |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. More... | |
Friends | |
class | IffChunk |
Additional Inherited Members | |
![]() | |
get_type | |
A wrapper around an istream used for reading an IFF file.
Definition at line 30 of file iffInputFile.h.
|
inline |
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 53 of file iffInputFile.I.
References get_int8().
Referenced by get_string(), and IffGenericChunk::read_iff().
PN_stdfloat IffInputFile::get_be_float32 | ( | ) |
Extracts a 32-bit big-endian single-precision floating-point number.
Definition at line 165 of file iffInputFile.cxx.
References DatagramIterator::get_be_float32(), and read_bytes().
Referenced by LwoInputFile::get_vec3().
int16_t IffInputFile::get_be_int16 | ( | ) |
Extracts a signed 16-bit big-endian integer.
Definition at line 113 of file iffInputFile.cxx.
References DatagramIterator::get_be_int16(), and read_bytes().
int32_t IffInputFile::get_be_int32 | ( | ) |
Extracts a signed 32-bit big-endian integer.
Definition at line 126 of file iffInputFile.cxx.
References DatagramIterator::get_be_int32(), and read_bytes().
Referenced by LwoClip::read_iff().
uint16_t IffInputFile::get_be_uint16 | ( | ) |
Extracts an unsigned 16-bit big-endian integer.
Definition at line 139 of file iffInputFile.cxx.
References DatagramIterator::get_be_uint16(), and read_bytes().
Referenced by LwoInputFile::get_vx().
uint32_t IffInputFile::get_be_uint32 | ( | ) |
Extracts an unsigned 32-bit big-endian integer.
Definition at line 152 of file iffInputFile.cxx.
References DatagramIterator::get_be_uint32(), and read_bytes().
Referenced by PT().
|
inline |
Returns the number of bytes read so far from the input file.
Definition at line 44 of file iffInputFile.I.
Referenced by PT(), and IffGenericChunk::read_iff().
|
inline |
Returns the filename that the InputFile is currently opened on, if available.
Definition at line 27 of file iffInputFile.I.
IffId IffInputFile::get_id | ( | ) |
Extracts a 4-character IFF ID.
Definition at line 196 of file iffInputFile.cxx.
References Datagram::get_data(), and read_bytes().
Referenced by PT().
int8_t IffInputFile::get_int8 | ( | ) |
Extracts a signed 8-bit integer.
Definition at line 87 of file iffInputFile.cxx.
References DatagramIterator::get_int8(), and read_bytes().
Referenced by align().
std::string IffInputFile::get_string | ( | ) |
Extracts a null-terminated string.
Definition at line 178 of file iffInputFile.cxx.
References align(), and read_byte().
Referenced by LwoInputFile::get_filename(), and LwoSurface::read_iff().
uint8_t IffInputFile::get_uint8 | ( | ) |
Extracts an unsigned 8-bit integer.
Definition at line 100 of file iffInputFile.cxx.
References DatagramIterator::get_int8(), and read_bytes().
|
inline |
Returns true if the last read operation failed because of reaching EOF, false otherwise.
Definition at line 36 of file iffInputFile.I.
Referenced by PT(), read_byte(), read_bytes(), and skip_bytes().
bool IffInputFile::open_read | ( | Filename | filename | ) |
Attempts to open the indicated filename for reading.
Returns true if successful, false otherwise.
Definition at line 50 of file iffInputFile.cxx.
References Filename::set_binary().
bool IffInputFile::read_byte | ( | char & | byte | ) |
Reads a single byte.
Returns true if successful, false otherwise.
Definition at line 309 of file iffInputFile.cxx.
References is_eof().
Referenced by get_string(), and skip_bytes().
bool IffInputFile::read_bytes | ( | Datagram & | datagram, |
int | length | ||
) |
Reads a series of bytes, and stores them in the indicated Datagram.
Returns true if successful, false otherwise.
Definition at line 325 of file iffInputFile.cxx.
References is_eof().
Referenced by get_be_float32(), get_be_int16(), get_be_int32(), get_be_uint16(), get_be_uint32(), get_id(), get_int8(), get_uint8(), and IffGenericChunk::read_iff().
|
inline |
Indicates the filename that the InputFile is currently opened on.
Definition at line 18 of file iffInputFile.I.
void IffInputFile::set_input | ( | std::istream * | input, |
bool | owns_istream | ||
) |
Sets up the input to use an arbitrary istream.
If owns_istream is true, the istream will be deleted (via vfs->close_read_file()) when the IffInputFile destructs.
Definition at line 71 of file iffInputFile.cxx.
bool IffInputFile::skip_bytes | ( | int | length | ) |
Reads a series of bytes, but does not store them.
Returns true if successful, false otherwise.
Definition at line 348 of file iffInputFile.cxx.
References is_eof(), and read_byte().