Panda3D
 All Classes Functions Variables Enumerations
iffId.I
1 // Filename: iffId.I
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 
16 ////////////////////////////////////////////////////////////////////
17 // Function: IffId::Default Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE IffId::
22 IffId() {
23  _id._c[0] = 0;
24  _id._c[1] = 0;
25  _id._c[2] = 0;
26  _id._c[3] = 0;
27 }
28 
29 ////////////////////////////////////////////////////////////////////
30 // Function: IffId::Constructor
31 // Access: Public
32 // Description:
33 ////////////////////////////////////////////////////////////////////
34 INLINE IffId::
35 IffId(const char id[4]) {
36  _id._c[0] = id[0];
37  _id._c[1] = id[1];
38  _id._c[2] = id[2];
39  _id._c[3] = id[3];
40 }
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: IffId::Copy Constructor
44 // Access: Public
45 // Description:
46 ////////////////////////////////////////////////////////////////////
47 INLINE IffId::
48 IffId(const IffId &copy) {
49  _id._n = copy._id._n;
50 }
51 
52 ////////////////////////////////////////////////////////////////////
53 // Function: IffId::Copy Assignment Operator
54 // Access: Public
55 // Description:
56 ////////////////////////////////////////////////////////////////////
57 INLINE void IffId::
58 operator = (const IffId &copy) {
59  _id._n = copy._id._n;
60 }
61 
62 ////////////////////////////////////////////////////////////////////
63 // Function: IffId::Equivalence Operator
64 // Access: Public
65 // Description:
66 ////////////////////////////////////////////////////////////////////
67 INLINE bool IffId::
68 operator == (const IffId &other) const {
69  return (_id._n == other._id._n);
70 }
71 
72 ////////////////////////////////////////////////////////////////////
73 // Function: IffId::Nonequivalence Operator
74 // Access: Public
75 // Description:
76 ////////////////////////////////////////////////////////////////////
77 INLINE bool IffId::
78 operator != (const IffId &other) const {
79  return (_id._n != other._id._n);
80 }
81 
82 ////////////////////////////////////////////////////////////////////
83 // Function: IffId::Ordering Operator
84 // Access: Public
85 // Description: The ordering is arbitrary, and may not even be
86 // consistent between different architectures
87 // (e.g. big-endian and little-endian). It is useful
88 // mainly for putting IffId's into a sorted container,
89 // like sets and maps.
90 ////////////////////////////////////////////////////////////////////
91 INLINE bool IffId::
92 operator < (const IffId &other) const {
93  return (_id._n < other._id._n);
94 }
95 
96 ////////////////////////////////////////////////////////////////////
97 // Function: IffId::get_name
98 // Access: Public
99 // Description: Returns the four-character name of the Id, for
100 // outputting.
101 ////////////////////////////////////////////////////////////////////
102 INLINE string IffId::
103 get_name() const {
104  return string(_id._c, 4);
105 }
string get_name() const
Returns the four-character name of the Id, for outputting.
Definition: iffId.I:103
bool operator<(const IffId &other) const
The ordering is arbitrary, and may not even be consistent between different architectures (e...
Definition: iffId.I:92
A four-byte chunk ID appearing in an &quot;IFF&quot; file.
Definition: iffId.h:29