Panda3D
|
00001 // Filename: iffChunk.h 00002 // Created by: drose (23Apr01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef IFFCHUNK_H 00016 #define IFFCHUNK_H 00017 00018 #include "pandatoolbase.h" 00019 00020 #include "iffId.h" 00021 00022 #include "typedObject.h" 00023 #include "typedReferenceCount.h" 00024 00025 class IffInputFile; 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Class : IffChunk 00029 // Description : The basic kind of record in an EA "IFF" file, which 00030 // the LightWave object file is based on. 00031 //////////////////////////////////////////////////////////////////// 00032 class IffChunk : public TypedReferenceCount { 00033 public: 00034 INLINE IffChunk(); 00035 00036 INLINE IffId get_id() const; 00037 INLINE void set_id(IffId id); 00038 00039 virtual bool read_iff(IffInputFile *in, size_t stop_at)=0; 00040 00041 virtual void output(ostream &out) const; 00042 virtual void write(ostream &out, int indent_level = 0) const; 00043 00044 virtual IffChunk *make_new_chunk(IffInputFile *in, IffId id); 00045 00046 private: 00047 IffId _id; 00048 00049 public: 00050 virtual TypeHandle get_type() const { 00051 return get_class_type(); 00052 } 00053 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00054 static TypeHandle get_class_type() { 00055 return _type_handle; 00056 } 00057 static void init_type() { 00058 TypedReferenceCount::init_type(); 00059 register_type(_type_handle, "IffChunk", 00060 TypedReferenceCount::get_class_type()); 00061 } 00062 00063 private: 00064 static TypeHandle _type_handle; 00065 }; 00066 00067 #include "iffChunk.I" 00068 00069 INLINE ostream &operator << (ostream &out, const IffChunk &chunk) { 00070 chunk.output(out); 00071 return out; 00072 } 00073 00074 #endif 00075 00076