iffInputFile.I 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 iffInputFile.I
  10. * @author drose
  11. * @date 2001-04-24
  12. */
  13. /**
  14. * Indicates the filename that the InputFile is currently opened on.
  15. */
  16. INLINE void IffInputFile::
  17. set_filename(const Filename &filename) {
  18. _filename = filename;
  19. }
  20. /**
  21. * Returns the filename that the InputFile is currently opened on, if
  22. * available.
  23. */
  24. INLINE const Filename &IffInputFile::
  25. get_filename() const {
  26. return _filename;
  27. }
  28. /**
  29. * Returns true if the last read operation failed because of reaching EOF,
  30. * false otherwise.
  31. */
  32. INLINE bool IffInputFile::
  33. is_eof() const {
  34. return _eof;
  35. }
  36. /**
  37. * Returns the number of bytes read so far from the input file.
  38. */
  39. INLINE size_t IffInputFile::
  40. get_bytes_read() const {
  41. return _bytes_read;
  42. }
  43. /**
  44. * If the current file pointer is not positioned on an even-byte boundary,
  45. * reads and discards one byte so that it is.
  46. */
  47. INLINE void IffInputFile::
  48. align() {
  49. if ((_bytes_read & 1) != 0) {
  50. get_int8();
  51. }
  52. }