Panda3D
Loading...
Searching...
No Matches
iffChunk.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file iffChunk.h
10 * @author drose
11 * @date 2001-04-23
12 */
13
14#ifndef IFFCHUNK_H
15#define IFFCHUNK_H
16
17#include "pandatoolbase.h"
18
19#include "iffId.h"
20
21#include "typedObject.h"
22#include "typedReferenceCount.h"
23
24class IffInputFile;
25
26/**
27 * The basic kind of record in an EA "IFF" file, which the LightWave object
28 * file is based on.
29 */
30class IffChunk : public TypedReferenceCount {
31public:
32 INLINE IffChunk();
33
34 INLINE IffId get_id() const;
35 INLINE void set_id(IffId id);
36
37 virtual bool read_iff(IffInputFile *in, size_t stop_at)=0;
38
39 virtual void output(std::ostream &out) const;
40 virtual void write(std::ostream &out, int indent_level = 0) const;
41
42 virtual IffChunk *make_new_chunk(IffInputFile *in, IffId id);
43
44private:
45 IffId _id;
46
47public:
48 virtual TypeHandle get_type() const {
49 return get_class_type();
50 }
51 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
52 static TypeHandle get_class_type() {
53 return _type_handle;
54 }
55 static void init_type() {
56 TypedReferenceCount::init_type();
57 register_type(_type_handle, "IffChunk",
58 TypedReferenceCount::get_class_type());
59 }
60
61private:
62 static TypeHandle _type_handle;
63};
64
65#include "iffChunk.I"
66
67INLINE std::ostream &operator << (std::ostream &out, const IffChunk &chunk) {
68 chunk.output(out);
69 return out;
70}
71
72#endif
The basic kind of record in an EA "IFF" file, which the LightWave object file is based on.
Definition iffChunk.h:30
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...
Definition iffChunk.cxx:42
void set_id(IffId id)
Changes the ID associated with this chunk.
Definition iffChunk.I:33
IffId get_id() const
Returns the ID associated with this chunk.
Definition iffChunk.I:25
A four-byte chunk ID appearing in an "IFF" file.
Definition iffId.h:26
A wrapper around an istream used for reading an IFF file.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.