Panda3D
 All Classes Functions Variables Enumerations
subStream.I
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, NULL, start, end, false);
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 
00067 ////////////////////////////////////////////////////////////////////
00068 //     Function: OSubStream::Constructor
00069 //       Access: Public
00070 //  Description:
00071 ////////////////////////////////////////////////////////////////////
00072 INLINE OSubStream::
00073 OSubStream() : ostream(&_buf) {
00074 }
00075 
00076 ////////////////////////////////////////////////////////////////////
00077 //     Function: OSubStream::Constructor
00078 //       Access: Public
00079 //  Description:
00080 ////////////////////////////////////////////////////////////////////
00081 INLINE OSubStream::
00082 OSubStream(OStreamWrapper *dest, streampos start, streampos end, bool append) : ostream(&_buf) {
00083   open(dest, start, end, append);
00084 }
00085 
00086 ////////////////////////////////////////////////////////////////////
00087 //     Function: OSubStream::open
00088 //       Access: Public
00089 //  Description: Starts the SubStream reading from the indicated
00090 //               dest, with the first character being the character
00091 //               at position "start" within the dest, for end -
00092 //               start total characters.  The character at "end"
00093 //               within the dest will never be read; this will
00094 //               appear to be EOF.
00095 //
00096 //               If end is zero, it indicates that the OSubStream will
00097 //               continue until the end of the dest stream.
00098 ////////////////////////////////////////////////////////////////////
00099 INLINE OSubStream &OSubStream::
00100 open(OStreamWrapper *dest, streampos start, streampos end, bool append) {
00101   clear((ios_iostate)0);
00102   _buf.open(NULL, dest, start, end, append);
00103   return *this;
00104 }
00105 
00106 ////////////////////////////////////////////////////////////////////
00107 //     Function: OSubStream::close
00108 //       Access: Public
00109 //  Description: Resets the SubStream to empty, but does not actually
00110 //               close the dest ostream.
00111 ////////////////////////////////////////////////////////////////////
00112 INLINE OSubStream &OSubStream::
00113 close() {
00114   _buf.close();
00115   return *this;
00116 }
00117 
00118 ////////////////////////////////////////////////////////////////////
00119 //     Function: SubStream::Constructor
00120 //       Access: Public
00121 //  Description:
00122 ////////////////////////////////////////////////////////////////////
00123 INLINE SubStream::
00124 SubStream() : iostream(&_buf) {
00125 }
00126 
00127 ////////////////////////////////////////////////////////////////////
00128 //     Function: SubStream::Constructor
00129 //       Access: Public
00130 //  Description:
00131 ////////////////////////////////////////////////////////////////////
00132 INLINE SubStream::
00133 SubStream(StreamWrapper *nested, streampos start, streampos end, bool append) : iostream(&_buf) {
00134   open(nested, start, end, append);
00135 }
00136 
00137 ////////////////////////////////////////////////////////////////////
00138 //     Function: SubStream::open
00139 //       Access: Public
00140 //  Description: Starts the SubStream reading and writing from the
00141 //               indicated nested stream, within the indicated range.
00142 //               "end" is the first character outside of the range.
00143 //
00144 //               If end is zero, it indicates that the SubStream will
00145 //               continue until the end of the nested stream.
00146 ////////////////////////////////////////////////////////////////////
00147 INLINE SubStream &SubStream::
00148 open(StreamWrapper *nested, streampos start, streampos end, bool append) {
00149   clear((ios_iostate)0);
00150   _buf.open(nested, nested, start, end, append);
00151   return *this;
00152 }
00153 
00154 ////////////////////////////////////////////////////////////////////
00155 //     Function: SubStream::close
00156 //       Access: Public
00157 //  Description: Resets the SubStream to empty, but does not actually
00158 //               close the nested ostream.
00159 ////////////////////////////////////////////////////////////////////
00160 INLINE SubStream &SubStream::
00161 close() {
00162   _buf.close();
00163   return *this;
00164 }
00165 
00166 
 All Classes Functions Variables Enumerations