Panda3D
iffId.h
1 // Filename: iffId.h
2 // Created by: drose (23Apr01)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef IFFID_H
16 #define IFFID_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "numeric_types.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : IffId
24 // Description : A four-byte chunk ID appearing in an "IFF" file.
25 // This is used to identify the meaning of each chunk,
26 // and can be treated either as a concrete object or as
27 // a string, something like a TypeHandle.
28 ////////////////////////////////////////////////////////////////////
29 class IffId {
30 public:
31  INLINE IffId();
32  INLINE IffId(const char id[4]);
33  INLINE IffId(const IffId &copy);
34  INLINE void operator = (const IffId &copy);
35 
36  INLINE bool operator == (const IffId &other) const;
37  INLINE bool operator != (const IffId &other) const;
38  INLINE bool operator < (const IffId &other) const;
39 
40  INLINE string get_name() const;
41 
42  void output(ostream &out) const;
43 
44 private:
45  union {
46  PN_uint32 _n;
47  char _c[4];
48  } _id;
49 };
50 
51 #include "iffId.I"
52 
53 INLINE ostream &operator << (ostream &out, const IffId &id) {
54  id.output(out);
55  return out;
56 }
57 
58 #endif
bool operator<(const IffId &other) const
The ordering is arbitrary, and may not even be consistent between different architectures (e...
Definition: iffId.I:92
string get_name() const
Returns the four-character name of the Id, for outputting.
Definition: iffId.I:103
A four-byte chunk ID appearing in an "IFF" file.
Definition: iffId.h:29