Panda3D

Loading...
Searching...
No Matches
subStream.I
Go to the documentation of this file.
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 subStream.I
10 * @author drose
11 * @date 2002-08-02
12 */
13
14/**
15 *
16 */
17INLINE ISubStream::
18ISubStream() : std::istream(&_buf) {
19}
20
21/**
22 *
23 */
24INLINE ISubStream::
25ISubStream(IStreamWrapper *source, std::streampos start, std::streampos end) : std::istream(&_buf) {
26 open(source, start, end);
27}
28
29/**
30 * Starts the SubStream reading from the indicated source, with the first
31 * character being the character at position "start" within the source, for
32 * end - start total characters. The character at "end" within the source
33 * will never be read; this will appear to be EOF.
34 *
35 * If end is zero, it indicates that the ISubStream will continue until the
36 * end of the source stream.
37 */
38INLINE ISubStream &ISubStream::
39 open(IStreamWrapper *source, std::streampos start, std::streampos end) {
40 clear((ios_iostate)0);
41 _buf.open(source, nullptr, start, end, false);
42 return *this;
43}
44
45/**
46 * Resets the SubStream to empty, but does not actually close the source
47 * istream.
48 */
49INLINE ISubStream &ISubStream::
50 close() {
51 _buf.close();
52 return *this;
53}
54
55/**
56 *
57 */
58INLINE OSubStream::
59OSubStream() : std::ostream(&_buf) {
60}
61
62/**
63 *
64 */
65INLINE OSubStream::
66OSubStream(OStreamWrapper *dest, std::streampos start, std::streampos end, bool append) : std::ostream(&_buf) {
67 open(dest, start, end, append);
68}
69
70/**
71 * Starts the SubStream reading from the indicated dest, with the first
72 * character being the character at position "start" within the dest, for end
73 * - start total characters. The character at "end" within the dest will
74 * never be read; this will appear to be EOF.
75 *
76 * If end is zero, it indicates that the OSubStream will continue until the
77 * end of the dest stream.
78 */
79INLINE OSubStream &OSubStream::
80 open(OStreamWrapper *dest, std::streampos start, std::streampos end, bool append) {
81 clear((ios_iostate)0);
82 _buf.open(nullptr, dest, start, end, append);
83 return *this;
84}
85
86/**
87 * Resets the SubStream to empty, but does not actually close the dest
88 * ostream.
89 */
90INLINE OSubStream &OSubStream::
91 close() {
92 _buf.close();
93 return *this;
94}
95
96/**
97 *
98 */
99INLINE SubStream::
100SubStream() : std::iostream(&_buf) {
101}
102
103/**
104 *
105 */
106INLINE SubStream::
107SubStream(StreamWrapper *nested, std::streampos start, std::streampos end, bool append) : std::iostream(&_buf) {
108 open(nested, start, end, append);
109}
110
111/**
112 * Starts the SubStream reading and writing from the indicated nested stream,
113 * within the indicated range. "end" is the first character outside of the
114 * range.
115 *
116 * If end is zero, it indicates that the SubStream will continue until the end
117 * of the nested stream.
118 */
119INLINE SubStream &SubStream::
120 open(StreamWrapper *nested, std::streampos start, std::streampos end, bool append) {
121 clear((ios_iostate)0);
122 _buf.open(nested, nested, start, end, append);
123 return *this;
124}
125
126/**
127 * Resets the SubStream to empty, but does not actually close the nested
128 * ostream.
129 */
130INLINE SubStream &SubStream::
131 close() {
132 _buf.close();
133 return *this;
134}
IStreamWrapper
This class provides a locking wrapper around an arbitrary istream pointer.
Definition streamWrapper.h:59
ISubStream::open
ISubStream & open(IStreamWrapper *source, std::streampos start, std::streampos end)
Starts the SubStream reading from the indicated source, with the first character being the character ...
Definition subStream.I:39
ISubStream::close
ISubStream & close()
Resets the SubStream to empty, but does not actually close the source istream.
Definition subStream.I:50
OStreamWrapper
This class provides a locking wrapper around an arbitrary ostream pointer.
Definition streamWrapper.h:86
OSubStream::close
OSubStream & close()
Resets the SubStream to empty, but does not actually close the dest ostream.
Definition subStream.I:91
OSubStream::open
OSubStream & open(OStreamWrapper *dest, std::streampos start, std::streampos end, bool append=false)
Starts the SubStream reading from the indicated dest, with the first character being the character at...
Definition subStream.I:80
StreamWrapper
This class provides a locking wrapper around a combination ostream/istream pointer.
Definition streamWrapper.h:122
SubStream::close
SubStream & close()
Resets the SubStream to empty, but does not actually close the nested ostream.
Definition subStream.I:131
SubStream::open
SubStream & open(StreamWrapper *nested, std::streampos start, std::streampos end, bool append=false)
Starts the SubStream reading and writing from the indicated nested stream, within the indicated range...
Definition subStream.I:120
iostream
istream
STL class.
ostream
STL class.
std
STL namespace.