Panda3D
iffId.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 iffId.h
10  * @author drose
11  * @date 2001-04-23
12  */
13 
14 #ifndef IFFID_H
15 #define IFFID_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "numeric_types.h"
20 
21 /**
22  * A four-byte chunk ID appearing in an "IFF" file. This is used to identify
23  * the meaning of each chunk, and can be treated either as a concrete object
24  * or as a string, something like a TypeHandle.
25  */
26 class IffId {
27 public:
28  INLINE IffId();
29  INLINE IffId(const char id[4]);
30  INLINE IffId(const IffId &copy);
31  INLINE void operator = (const IffId &copy);
32 
33  INLINE bool operator == (const IffId &other) const;
34  INLINE bool operator != (const IffId &other) const;
35  INLINE bool operator < (const IffId &other) const;
36 
37  INLINE std::string get_name() const;
38 
39  void output(std::ostream &out) const;
40 
41 private:
42  union {
43  uint32_t _n;
44  char _c[4];
45  } _id;
46 };
47 
48 #include "iffId.I"
49 
50 INLINE std::ostream &operator << (std::ostream &out, const IffId &id) {
51  id.output(out);
52  return out;
53 }
54 
55 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool operator<(const IffId &other) const
The ordering is arbitrary, and may not even be consistent between different architectures (e....
Definition: iffId.I:74
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::string get_name() const
Returns the four-character name of the Id, for outputting.
Definition: iffId.I:82
A four-byte chunk ID appearing in an "IFF" file.
Definition: iffId.h:26