00001 // Filename: subStream.I 00002 // Created by: drose (02Aug02) 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: ISubStream::Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE ISubStream:: 00026 ISubStream() : istream(&_buf) { 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: ISubStream::Constructor 00031 // Access: Public 00032 // Description: 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE ISubStream:: 00035 ISubStream(istream *source, streampos start, streampos end) : istream(&_buf) { 00036 open(source, start, end); 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: ISubStream::open 00041 // Access: Public 00042 // Description: Starts the SubStream reading from the indicated 00043 // source, with the first character being the character 00044 // at position "start" within the source, for end - 00045 // start total characters. The character at "end" 00046 // within the source will never be read; this will 00047 // appear to be EOF. 00048 // 00049 // If end is zero, it indicates that the ISubStream will 00050 // continue until the end of the source stream. 00051 //////////////////////////////////////////////////////////////////// 00052 INLINE ISubStream &ISubStream:: 00053 open(istream *source, streampos start, streampos end) { 00054 clear((ios_iostate)0); 00055 _buf.open(source, start, end); 00056 return *this; 00057 } 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: ISubStream::close 00061 // Access: Public 00062 // Description: Resets the SubStream to empty, but does not actually 00063 // close the source istream. 00064 //////////////////////////////////////////////////////////////////// 00065 INLINE ISubStream &ISubStream:: 00066 close() { 00067 _buf.close(); 00068 return *this; 00069 } 00070