Go to the documentation of this file.
28 _owns_istream =
false;
30 _unexpected_eof =
false;
77 _owns_istream = owns_istream;
79 _unexpected_eof =
false;
201 const char *
id = (
const char *)dg.
get_data();
221 PT(
IffChunk) chunk = make_new_chunk(
id);
225 size_t end_point = start_point + length;
227 if (chunk->read_iff(
this, end_point)) {
229 if (!_unexpected_eof) {
230 nout <<
"Unexpected EOF on file reading " << *chunk <<
"\n";
231 _unexpected_eof =
true;
237 if (num_bytes_read > length) {
238 nout << *chunk <<
" read " << num_bytes_read
239 <<
" instead of " << length <<
" bytes.\n";
242 }
else if (num_bytes_read < length) {
243 size_t skip_count = length - num_bytes_read;
244 nout <<
"Ignoring " << skip_count <<
" bytes at the end of "
275 size_t end_point = start_point + length;
277 if (chunk->read_iff(
this, end_point)) {
279 if (!_unexpected_eof) {
280 nout <<
"Unexpected EOF on file reading " << *chunk <<
"\n";
281 _unexpected_eof =
true;
287 if (num_bytes_read > length) {
288 nout << *chunk <<
" read " << num_bytes_read
289 <<
" instead of " << length <<
" bytes.\n";
292 }
else if (num_bytes_read < length) {
293 size_t skip_count = length - num_bytes_read;
294 nout <<
"Ignoring " << skip_count <<
" bytes at the end of "
316 _eof = _input->eof() || _input->fail();
330 char *buffer =
new char[length];
331 _input->read(buffer, length);
332 _eof = (_input->gcount() != length);
337 _bytes_read += length;
338 datagram =
Datagram(buffer, length);
354 while (length > 0 && !
is_eof()) {
367 make_new_chunk(
IffId) {
int16_t get_be_int16()
Extracts a signed 16-bit big-endian integer.
A class to retrieve the individual data elements previously stored in a Datagram.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
A four-byte chunk ID appearing in an "IFF" file.
virtual IffChunk * make_new_chunk(IffInputFile *in, IffId id)
Allocates and returns a new chunk of the appropriate type based on the given ID, according to the con...
TypeHandle is the identifier used to differentiate C++ class types.
void set_id(IffId id)
Changes the ID associated with this chunk.
A hierarchy of directories and files that appears to be one continuous file system,...
int8_t get_int8()
Extracts a signed 8-bit integer.
int32_t get_be_int32()
Extracts a signed 32-bit big-endian integer.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static VirtualFileSystem * get_global_ptr()
Returns the default global VirtualFileSystem.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void close_read_file(std::istream *stream)
Closes a file opened by a previous call to open_read_file().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class for a generic kind of IffChunk that is not understood by a particular IffReader.
std::istream * open_read_file(const Filename &filename, bool auto_unwrap) const
Convenience function; returns a newly allocated istream if the file exists and can be read,...
PN_float32 get_be_float32()
Extracts a 32-bit big-endian single-precision floating-point number.
The basic kind of record in an EA "IFF" file, which the LightWave object file is based on.
const void * get_data() const
Returns a pointer to the beginning of the datagram's data.
The name of a file, such as a texture file or an Egg file.
void set_binary()
Indicates that the filename represents a binary file.