Panda3D
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends | List of all members
IffInputFile Class Reference

A wrapper around an istream used for reading an IFF file. More...

#include "iffInputFile.h"

Inheritance diagram for IffInputFile:
TypedObject MemoryBase LwoInputFile

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.
 
virtual TypeHandle force_init_type ()
 
PN_stdfloat get_be_float32 ()
 Extracts a 32-bit big-endian single-precision floating-point number.
 
int16_t get_be_int16 ()
 Extracts a signed 16-bit big-endian integer.
 
int32_t get_be_int32 ()
 Extracts a signed 32-bit big-endian integer.
 
uint16_t get_be_uint16 ()
 Extracts an unsigned 16-bit big-endian integer.
 
uint32_t get_be_uint32 ()
 Extracts an unsigned 32-bit big-endian integer.
 
size_t get_bytes_read () const
 Returns the number of bytes read so far from the input file.
 
const Filenameget_filename () const
 Returns the filename that the InputFile is currently opened on, if available.
 
IffId get_id ()
 Extracts a 4-character IFF ID.
 
int8_t get_int8 ()
 Extracts a signed 8-bit integer.
 
std::string get_string ()
 Extracts a null-terminated string.
 
virtual TypeHandle get_type () const
 
uint8_t get_uint8 ()
 Extracts an unsigned 8-bit integer.
 
bool is_eof () const
 Returns true if the last read operation failed because of reaching EOF, false otherwise.
 
bool open_read (Filename filename)
 Attempts to open the indicated filename for reading.
 
 PT (IffChunk) get_chunk()
 
 PT (IffChunk) get_subchunk(IffChunk *context)
 
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.
 
void set_filename (const Filename &filename)
 Indicates the filename that the InputFile is currently opened on.
 
void set_input (std::istream *input, bool owns_istream)
 Sets up the input to use an arbitrary istream.
 
bool skip_bytes (int length)
 Reads a series of bytes, but does not store them.
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)=default
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer.
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer.
 
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.
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly.
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type.
 
TypedObjectoperator= (const TypedObject &copy)=default
 
- Public Member Functions inherited from MemoryBase
void operator delete (void *, void *)
 
void operator delete (void *ptr)
 
void operator delete[] (void *, void *)
 
void operator delete[] (void *ptr)
 
void * operator new (size_t size)
 
void * operator new (size_t size, void *ptr)
 
void * operator new[] (size_t size)
 
void * operator new[] (size_t size, void *ptr)
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedObject
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.
 

Friends

class IffChunk
 

Additional Inherited Members

- Public Attributes inherited from TypedObject
 get_type
 

Detailed Description

A wrapper around an istream used for reading an IFF file.

Definition at line 30 of file iffInputFile.h.

Constructor & Destructor Documentation

◆ IffInputFile()

IffInputFile::IffInputFile ( )

Definition at line 25 of file iffInputFile.cxx.

◆ ~IffInputFile()

IffInputFile::~IffInputFile ( )
virtual

Definition at line 37 of file iffInputFile.cxx.

Member Function Documentation

◆ align()

void IffInputFile::align ( )
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 52 of file iffInputFile.I.

References get_int8().

Referenced by get_string(), and IffGenericChunk::read_iff().

◆ force_init_type()

virtual TypeHandle IffInputFile::force_init_type ( )
inlinevirtual

Implements TypedObject.

Definition at line 80 of file iffInputFile.h.

◆ get_be_float32()

PN_stdfloat IffInputFile::get_be_float32 ( )

◆ get_be_int16()

int16_t IffInputFile::get_be_int16 ( )

Extracts a signed 16-bit big-endian integer.

Definition at line 112 of file iffInputFile.cxx.

References DatagramIterator::get_be_int16(), and read_bytes().

Referenced by LwoPolygons::read_iff(), LwoPolygonTags::read_iff(), and LwoSurfaceSidedness::read_iff().

◆ get_be_int32()

int32_t IffInputFile::get_be_int32 ( )

Extracts a signed 32-bit big-endian integer.

Definition at line 125 of file iffInputFile.cxx.

References DatagramIterator::get_be_int32(), and read_bytes().

Referenced by LwoClip::read_iff().

◆ get_be_uint16()

uint16_t IffInputFile::get_be_uint16 ( )

◆ get_be_uint32()

uint32_t IffInputFile::get_be_uint32 ( )

Extracts an unsigned 32-bit big-endian integer.

Definition at line 151 of file iffInputFile.cxx.

References DatagramIterator::get_be_uint32(), and read_bytes().

Referenced by PT().

◆ get_bytes_read()

size_t IffInputFile::get_bytes_read ( ) const
inline

◆ get_class_type()

static TypeHandle IffInputFile::get_class_type ( )
inlinestatic

Definition at line 81 of file iffInputFile.h.

◆ get_filename()

const Filename & IffInputFile::get_filename ( ) const
inline

Returns the filename that the InputFile is currently opened on, if available.

Definition at line 26 of file iffInputFile.I.

◆ get_id()

IffId IffInputFile::get_id ( )

◆ get_int8()

int8_t IffInputFile::get_int8 ( )

Extracts a signed 8-bit integer.

Definition at line 86 of file iffInputFile.cxx.

References DatagramIterator::get_int8(), and read_bytes().

Referenced by align().

◆ get_string()

std::string IffInputFile::get_string ( )

◆ get_type()

virtual TypeHandle IffInputFile::get_type ( ) const
inlinevirtual

Implements TypedObject.

Definition at line 77 of file iffInputFile.h.

◆ get_uint8()

uint8_t IffInputFile::get_uint8 ( )

Extracts an unsigned 8-bit integer.

Definition at line 99 of file iffInputFile.cxx.

References DatagramIterator::get_int8(), and read_bytes().

◆ init_type()

static void IffInputFile::init_type ( )
inlinestatic

Definition at line 84 of file iffInputFile.h.

◆ is_eof()

bool IffInputFile::is_eof ( ) const
inline

Returns true if the last read operation failed because of reaching EOF, false otherwise.

Definition at line 35 of file iffInputFile.I.

Referenced by PT(), read_byte(), read_bytes(), LwoDiscontinuousVertexMap::read_iff(), LwoPoints::read_iff(), LwoPolygons::read_iff(), LwoPolygonTags::read_iff(), LwoTags::read_iff(), LwoVertexMap::read_iff(), and skip_bytes().

◆ open_read()

bool IffInputFile::open_read ( Filename filename)

Attempts to open the indicated filename for reading.

Returns true if successful, false otherwise.

Definition at line 49 of file iffInputFile.cxx.

References VirtualFileSystem::get_global_ptr(), VirtualFileSystem::open_read_file(), Filename::set_binary(), set_filename(), and set_input().

Referenced by LwoToEggConverter::convert_file().

◆ read_byte()

bool IffInputFile::read_byte ( char & byte)

Reads a single byte.

Returns true if successful, false otherwise.

Definition at line 308 of file iffInputFile.cxx.

References is_eof().

Referenced by get_string(), and skip_bytes().

◆ read_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 324 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().

◆ set_filename()

void IffInputFile::set_filename ( const Filename & filename)
inline

Indicates the filename that the InputFile is currently opened on.

Definition at line 17 of file iffInputFile.I.

Referenced by open_read().

◆ set_input()

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 70 of file iffInputFile.cxx.

References VirtualFileSystem::close_read_file(), and VirtualFileSystem::get_global_ptr().

Referenced by open_read().

◆ skip_bytes()

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 347 of file iffInputFile.cxx.

References is_eof(), and read_byte().

Referenced by PT().

Friends And Related Symbol Documentation

◆ IffChunk

friend class IffChunk
friend

Definition at line 93 of file iffInputFile.h.


The documentation for this class was generated from the following files: