iffId.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. #ifndef IFFID_H
  14. #define IFFID_H
  15. #include "pandatoolbase.h"
  16. #include "numeric_types.h"
  17. /**
  18. * A four-byte chunk ID appearing in an "IFF" file. This is used to identify
  19. * the meaning of each chunk, and can be treated either as a concrete object
  20. * or as a string, something like a TypeHandle.
  21. */
  22. class IffId {
  23. public:
  24. INLINE IffId();
  25. INLINE IffId(const char id[4]);
  26. INLINE IffId(const IffId &copy);
  27. INLINE void operator = (const IffId &copy);
  28. INLINE bool operator == (const IffId &other) const;
  29. INLINE bool operator != (const IffId &other) const;
  30. INLINE bool operator < (const IffId &other) const;
  31. INLINE std::string get_name() const;
  32. void output(std::ostream &out) const;
  33. private:
  34. union {
  35. uint32_t _n;
  36. char _c[4];
  37. } _id;
  38. };
  39. #include "iffId.I"
  40. INLINE std::ostream &operator << (std::ostream &out, const IffId &id) {
  41. id.output(out);
  42. return out;
  43. }
  44. #endif