00001 // Filename: iffInputFile.I 00002 // Created by: drose (24Apr01) 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: IffInputFile::set_filename 00022 // Access: Public 00023 // Description: Indicates the filename that the InputFile is 00024 // currently opened on. 00025 //////////////////////////////////////////////////////////////////// 00026 INLINE void IffInputFile:: 00027 set_filename(const Filename &filename) { 00028 _filename = filename; 00029 } 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Function: IffInputFile::get_filename 00033 // Access: Public 00034 // Description: Returns the filename that the InputFile is 00035 // currently opened on, if available. 00036 //////////////////////////////////////////////////////////////////// 00037 INLINE const Filename &IffInputFile:: 00038 get_filename() const { 00039 return _filename; 00040 } 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: IffInputFile::is_eof 00044 // Access: Public 00045 // Description: Returns true if the last read operation failed 00046 // because of reaching EOF, false otherwise. 00047 //////////////////////////////////////////////////////////////////// 00048 INLINE bool IffInputFile:: 00049 is_eof() const { 00050 return _eof; 00051 } 00052 00053 //////////////////////////////////////////////////////////////////// 00054 // Function: IffInputFile::get_bytes_read 00055 // Access: Public 00056 // Description: Returns the number of bytes read so far from the 00057 // input file. 00058 //////////////////////////////////////////////////////////////////// 00059 INLINE size_t IffInputFile:: 00060 get_bytes_read() const { 00061 return _bytes_read; 00062 } 00063 00064 //////////////////////////////////////////////////////////////////// 00065 // Function: IffInputFile::align 00066 // Access: Public 00067 // Description: If the current file pointer is not positioned on an 00068 // even-byte boundary, reads and discards one byte so 00069 // that it is. 00070 //////////////////////////////////////////////////////////////////// 00071 INLINE void IffInputFile:: 00072 align() { 00073 if ((_bytes_read & 1) != 0) { 00074 get_int8(); 00075 } 00076 }