Panda3D
|
00001 // Filename: subStream.I 00002 // Created by: drose (02Aug02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: ISubStream::Constructor 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE ISubStream:: 00022 ISubStream() : istream(&_buf) { 00023 } 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Function: ISubStream::Constructor 00027 // Access: Public 00028 // Description: 00029 //////////////////////////////////////////////////////////////////// 00030 INLINE ISubStream:: 00031 ISubStream(IStreamWrapper *source, streampos start, streampos end) : istream(&_buf) { 00032 open(source, start, end); 00033 } 00034 00035 //////////////////////////////////////////////////////////////////// 00036 // Function: ISubStream::open 00037 // Access: Public 00038 // Description: Starts the SubStream reading from the indicated 00039 // source, with the first character being the character 00040 // at position "start" within the source, for end - 00041 // start total characters. The character at "end" 00042 // within the source will never be read; this will 00043 // appear to be EOF. 00044 // 00045 // If end is zero, it indicates that the ISubStream will 00046 // continue until the end of the source stream. 00047 //////////////////////////////////////////////////////////////////// 00048 INLINE ISubStream &ISubStream:: 00049 open(IStreamWrapper *source, streampos start, streampos end) { 00050 clear((ios_iostate)0); 00051 _buf.open(source, start, end); 00052 return *this; 00053 } 00054 00055 //////////////////////////////////////////////////////////////////// 00056 // Function: ISubStream::close 00057 // Access: Public 00058 // Description: Resets the SubStream to empty, but does not actually 00059 // close the source istream. 00060 //////////////////////////////////////////////////////////////////// 00061 INLINE ISubStream &ISubStream:: 00062 close() { 00063 _buf.close(); 00064 return *this; 00065 } 00066