00001 // Filename: iffId.I 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 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: IffId::Default Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE IffId:: 00026 IffId() { 00027 _id._c[0] = 0; 00028 _id._c[1] = 0; 00029 _id._c[2] = 0; 00030 _id._c[3] = 0; 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: IffId::Constructor 00035 // Access: Public 00036 // Description: 00037 //////////////////////////////////////////////////////////////////// 00038 INLINE IffId:: 00039 IffId(const char id[4]) { 00040 _id._c[0] = id[0]; 00041 _id._c[1] = id[1]; 00042 _id._c[2] = id[2]; 00043 _id._c[3] = id[3]; 00044 } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function: IffId::Copy Constructor 00048 // Access: Public 00049 // Description: 00050 //////////////////////////////////////////////////////////////////// 00051 INLINE IffId:: 00052 IffId(const IffId ©) { 00053 _id._n = copy._id._n; 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: IffId::Copy Assignment Operator 00058 // Access: Public 00059 // Description: 00060 //////////////////////////////////////////////////////////////////// 00061 INLINE void IffId:: 00062 operator = (const IffId ©) { 00063 _id._n = copy._id._n; 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function: IffId::Equivalence Operator 00068 // Access: Public 00069 // Description: 00070 //////////////////////////////////////////////////////////////////// 00071 INLINE bool IffId:: 00072 operator == (const IffId &other) const { 00073 return (_id._n == other._id._n); 00074 } 00075 00076 //////////////////////////////////////////////////////////////////// 00077 // Function: IffId::Nonequivalence Operator 00078 // Access: Public 00079 // Description: 00080 //////////////////////////////////////////////////////////////////// 00081 INLINE bool IffId:: 00082 operator != (const IffId &other) const { 00083 return (_id._n != other._id._n); 00084 } 00085 00086 //////////////////////////////////////////////////////////////////// 00087 // Function: IffId::Ordering Operator 00088 // Access: Public 00089 // Description: The ordering is arbitrary, and may not even be 00090 // consistent between different architectures 00091 // (e.g. big-endian and little-endian). It is useful 00092 // mainly for putting IffId's into a sorted container, 00093 // like sets and maps. 00094 //////////////////////////////////////////////////////////////////// 00095 INLINE bool IffId:: 00096 operator < (const IffId &other) const { 00097 return (_id._n < other._id._n); 00098 } 00099 00100 //////////////////////////////////////////////////////////////////// 00101 // Function: IffId::get_name 00102 // Access: Public 00103 // Description: Returns the four-character name of the Id, for 00104 // outputting. 00105 //////////////////////////////////////////////////////////////////// 00106 INLINE string IffId:: 00107 get_name() const { 00108 return string(_id._c, 4); 00109 }