00001 // Filename: iffId.h 00002 // Created by: drose (23Apr01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef IFFID_H 00020 #define IFFID_H 00021 00022 #include <pandatoolbase.h> 00023 00024 #include <numeric_types.h> 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : IffId 00028 // Description : A four-byte chunk ID appearing in an "IFF" file. 00029 // This is used to identify the meaning of each chunk, 00030 // and can be treated either as a concrete object or as 00031 // a string, something like a TypeHandle. 00032 //////////////////////////////////////////////////////////////////// 00033 class IffId { 00034 public: 00035 INLINE IffId(); 00036 INLINE IffId(const char id[4]); 00037 INLINE IffId(const IffId ©); 00038 INLINE void operator = (const IffId ©); 00039 00040 INLINE bool operator == (const IffId &other) const; 00041 INLINE bool operator != (const IffId &other) const; 00042 INLINE bool operator < (const IffId &other) const; 00043 00044 INLINE string get_name() const; 00045 00046 void output(ostream &out) const; 00047 00048 private: 00049 union { 00050 PN_uint32 _n; 00051 char _c[4]; 00052 } _id; 00053 }; 00054 00055 #include "iffId.I" 00056 00057 INLINE ostream &operator << (ostream &out, const IffId &id) { 00058 id.output(out); 00059 return out; 00060 } 00061 00062 #endif