Panda3D
|
00001 // Filename: iffId.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 IFFID_H 00016 #define IFFID_H 00017 00018 #include "pandatoolbase.h" 00019 00020 #include "numeric_types.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : IffId 00024 // Description : A four-byte chunk ID appearing in an "IFF" file. 00025 // This is used to identify the meaning of each chunk, 00026 // and can be treated either as a concrete object or as 00027 // a string, something like a TypeHandle. 00028 //////////////////////////////////////////////////////////////////// 00029 class IffId { 00030 public: 00031 INLINE IffId(); 00032 INLINE IffId(const char id[4]); 00033 INLINE IffId(const IffId ©); 00034 INLINE void operator = (const IffId ©); 00035 00036 INLINE bool operator == (const IffId &other) const; 00037 INLINE bool operator != (const IffId &other) const; 00038 INLINE bool operator < (const IffId &other) const; 00039 00040 INLINE string get_name() const; 00041 00042 void output(ostream &out) const; 00043 00044 private: 00045 union { 00046 PN_uint32 _n; 00047 char _c[4]; 00048 } _id; 00049 }; 00050 00051 #include "iffId.I" 00052 00053 INLINE ostream &operator << (ostream &out, const IffId &id) { 00054 id.output(out); 00055 return out; 00056 } 00057 00058 #endif