|
|
@@ -11,28 +11,28 @@
|
|
|
TypeHandle LwoGroupChunk::_type_handle;
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: LwoGroupChunk::get_num_children
|
|
|
+// Function: LwoGroupChunk::get_num_chunks
|
|
|
// Access: Public
|
|
|
// Description: Returns the number of child chunks of this group.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
int LwoGroupChunk::
|
|
|
-get_num_children() const {
|
|
|
- return _children.size();
|
|
|
+get_num_chunks() const {
|
|
|
+ return _chunks.size();
|
|
|
}
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: LwoGroupChunk::get_child
|
|
|
+// Function: LwoGroupChunk::get_chunk
|
|
|
// Access: Public
|
|
|
// Description: Returns the nth child chunk of this group.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
IffChunk *LwoGroupChunk::
|
|
|
-get_child(int n) const {
|
|
|
- nassertr(n >= 0 && n < (int)_children.size(), (IffChunk *)NULL);
|
|
|
- return _children[n];
|
|
|
+get_chunk(int n) const {
|
|
|
+ nassertr(n >= 0 && n < (int)_chunks.size(), (IffChunk *)NULL);
|
|
|
+ return _chunks[n];
|
|
|
}
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: LwoGroupChunk::read_children_iff
|
|
|
+// Function: LwoGroupChunk::read_chunks_iff
|
|
|
// Access: Public
|
|
|
// Description: Reads a sequence of child chunks, until byte stop_at
|
|
|
// has been been reached, and stores them as the
|
|
|
@@ -41,28 +41,47 @@ get_child(int n) const {
|
|
|
// otherwise.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
bool LwoGroupChunk::
|
|
|
-read_children_iff(IffInputFile *in, size_t stop_at) {
|
|
|
+read_chunks_iff(IffInputFile *in, size_t stop_at) {
|
|
|
while (in->get_bytes_read() < stop_at && !in->is_eof()) {
|
|
|
PT(IffChunk) chunk = in->get_chunk();
|
|
|
if (chunk == (IffChunk *)NULL) {
|
|
|
return false;
|
|
|
}
|
|
|
- _children.push_back(chunk);
|
|
|
+ _chunks.push_back(chunk);
|
|
|
}
|
|
|
|
|
|
return (in->get_bytes_read() == stop_at);
|
|
|
}
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: LwoGroupChunk::write_children
|
|
|
+// Function: LwoGroupChunk::read_subchunks_iff
|
|
|
// Access: Public
|
|
|
-// Description: Formats the list of children for output to the user
|
|
|
+// Description: Similar to read_chunks_iff(), but reads them as
|
|
|
+// subchunks.
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+bool LwoGroupChunk::
|
|
|
+read_subchunks_iff(IffInputFile *in, size_t stop_at) {
|
|
|
+ while (in->get_bytes_read() < stop_at && !in->is_eof()) {
|
|
|
+ PT(IffChunk) chunk = in->get_subchunk(this);
|
|
|
+ if (chunk == (IffChunk *)NULL) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ _chunks.push_back(chunk);
|
|
|
+ }
|
|
|
+
|
|
|
+ return (in->get_bytes_read() == stop_at);
|
|
|
+}
|
|
|
+
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+// Function: LwoGroupChunk::write_chunks
|
|
|
+// Access: Public
|
|
|
+// Description: Formats the list of chunks for output to the user
|
|
|
// (primarily for debugging), one per line.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
void LwoGroupChunk::
|
|
|
-write_children(ostream &out, int indent_level) const {
|
|
|
- Children::const_iterator ci;
|
|
|
- for (ci = _children.begin(); ci != _children.end(); ++ci) {
|
|
|
+write_chunks(ostream &out, int indent_level) const {
|
|
|
+ Chunks::const_iterator ci;
|
|
|
+ for (ci = _chunks.begin(); ci != _chunks.end(); ++ci) {
|
|
|
(*ci)->write(out, indent_level);
|
|
|
}
|
|
|
}
|