]>
Commit | Line | Data |
---|---|---|
e2a6f233 JS |
1 | % ----------------------------------------------------------------------------- |
2 | % wxInputStream | |
3 | % ----------------------------------------------------------------------------- | |
4 | \section{\class{wxInputStream}}\label{wxinputstream} | |
5 | ||
d984207c RR |
6 | wxInputStream is an abstract base class which may not be used directly. |
7 | ||
e2a6f233 JS |
8 | \wxheading{Derived from} |
9 | ||
10 | \helpref{wxStreamBase}{wxstreambase} | |
11 | ||
954b8ae6 JS |
12 | \wxheading{Include files} |
13 | ||
14 | <wx/stream.h> | |
15 | ||
fa482912 JS |
16 | \latexignore{\rtfignore{\wxheading{Members}}} |
17 | ||
e2a6f233 JS |
18 | % ----------- |
19 | % ctor & dtor | |
20 | % ----------- | |
f0e8a2d0 | 21 | \membersection{wxInputStream::wxInputStream}\label{wxinputstreamctor} |
e2a6f233 JS |
22 | |
23 | \func{}{wxInputStream}{\void} | |
24 | ||
25 | Creates a dummy input stream. | |
26 | ||
f0e8a2d0 | 27 | \membersection{wxInputStream::\destruct{wxInputStream}}\label{wxinputstreamdtor} |
e2a6f233 JS |
28 | |
29 | \func{}{\destruct{wxInputStream}}{\void} | |
30 | ||
31 | Destructor. | |
32 | ||
fc1f2899 WS |
33 | \membersection{wxInputStream::CanRead}\label{wxinputstreamcanread} |
34 | ||
35 | \constfunc{bool}{CanRead}{\void} | |
36 | ||
37 | Returns true if some data is available in the stream right now, so that | |
38 | calling \helpref{Read()}{wxinputstreamread} wouldn't block. | |
39 | ||
f0e8a2d0 | 40 | \membersection{wxInputStream::GetC}\label{wxinputstreamgetc} |
e2a6f233 JS |
41 | |
42 | \func{char}{GetC}{\void} | |
43 | ||
a84e46f2 VS |
44 | Returns the first character in the input queue and removes it, |
45 | blocking until it appears if necessary. | |
46 | ||
47 | \wxheading{Note} | |
48 | ||
49 | If EOF, return value is undefined and LastRead() will return 0 and not 1. | |
e2a6f233 | 50 | |
cd6ce4a9 VZ |
51 | \membersection{wxInputStream::Eof}\label{wxinputstreameof} |
52 | ||
fc1f2899 | 53 | \constfunc{bool}{Eof}{\void} |
cd6ce4a9 | 54 | |
cc81d32f | 55 | Returns true if the end of stream has been reached. |
cd6ce4a9 | 56 | |
a84e46f2 VS |
57 | \wxheading{Note} |
58 | ||
46e00cd7 VS |
59 | For some streams Eof() will not return true until an |
60 | attempt has been made to read past the end of the stream. | |
61 | \helpref{LastRead()}{wxinputstreamlastread} | |
62 | should be called after each read to check that | |
63 | a non-zero number of bytes have been read. | |
a84e46f2 | 64 | |
39b91eca | 65 | \membersection{wxInputStream::LastRead}\label{wxinputstreamlastread} |
40b480c3 JS |
66 | |
67 | \constfunc{size\_t}{LastRead}{\void} | |
68 | ||
69 | Returns the last number of bytes read. | |
70 | ||
f0e8a2d0 | 71 | \membersection{wxInputStream::Peek}\label{wxinputstreampeek} |
40b480c3 JS |
72 | |
73 | \func{char}{Peek}{\void} | |
74 | ||
75 | Returns the first character in the input queue without removing it. | |
76 | ||
a84e46f2 VS |
77 | \wxheading{Note} |
78 | ||
79 | Blocks until something appears in the stream if necessary, if nothing | |
80 | ever does (i.e. EOF) LastRead() will return 0 (and the return value is | |
81 | undefined), otherwise LastRead() returns 1. | |
82 | ||
f0e8a2d0 | 83 | \membersection{wxInputStream::Read}\label{wxinputstreamread} |
e2a6f233 | 84 | |
40b480c3 | 85 | \func{wxInputStream\&}{Read}{\param{void *}{buffer}, \param{size\_t}{ size}} |
e2a6f233 | 86 | |
605d715d | 87 | Reads the specified amount of bytes and stores the data in {\it buffer}. |
e2a6f233 | 88 | |
da3aea64 GL |
89 | \wxheading{Warning} |
90 | ||
91 | The buffer absolutely needs to have at least the specified size. | |
92 | ||
93 | \wxheading{Return value} | |
e2a6f233 JS |
94 | |
95 | This function returns a reference on the current object, so the user can test | |
96 | any states of the stream right away. | |
97 | ||
294e9a7a | 98 | \func{wxInputStream\&}{Read}{\param{wxOutputStream\&}{ stream\_out}} |
e2a6f233 JS |
99 | |
100 | Reads data from the input queue and stores it in the specified output stream. | |
101 | The data is read until an error is raised by one of the two streams. | |
102 | ||
da3aea64 GL |
103 | \wxheading{Return value} |
104 | ||
105 | This function returns a reference on the current object, so the user can test | |
106 | any states of the stream right away. | |
107 | ||
0915d0b2 | 108 | \membersection{wxInputStream::SeekI}\label{wxinputstreamseeki} |
e2a6f233 | 109 | |
40b480c3 | 110 | \func{off\_t}{SeekI}{\param{off\_t}{ pos}, \param{wxSeekMode}{ mode = wxFromStart}} |
e2a6f233 JS |
111 | |
112 | Changes the stream current position. | |
113 | ||
a84e46f2 VS |
114 | \wxheading{Parameters} |
115 | ||
116 | \docparam{pos}{Offset to seek to.} | |
117 | ||
118 | \docparam{mode}{One of {\bf wxFromStart}, {\bf wxFromEnd}, {\bf wxFromCurrent}.} | |
119 | ||
120 | \wxheading{Return value} | |
121 | ||
122 | The new stream position or wxInvalidOffset on error. | |
123 | ||
f0e8a2d0 | 124 | \membersection{wxInputStream::TellI}\label{wxinputstreamtelli} |
e2a6f233 | 125 | |
40b480c3 | 126 | \constfunc{off\_t}{TellI}{\void} |
e2a6f233 JS |
127 | |
128 | Returns the current stream position. | |
129 | ||
d9dd875f | 130 | \membersection{wxInputStream::Ungetch}\label{wxinputstreamungetch} |
c7d9131a GL |
131 | |
132 | \func{size\_t}{Ungetch}{\param{const char*}{ buffer}, \param{size\_t}{ size}} | |
133 | ||
605d715d | 134 | This function is only useful in {\it read} mode. It is the manager of the "Write-Back" |
2edb0bde | 135 | buffer. This buffer acts like a temporary buffer where data which has to be |
c7d9131a GL |
136 | read during the next read IO call are put. This is useful when you get a big |
137 | block of data which you didn't want to read: you can replace them at the top | |
138 | of the input queue by this way. | |
139 | ||
d984207c RR |
140 | Be very careful about this call in connection with calling SeekI() on the same |
141 | stream. Any call to SeekI() will invalidate any previous call to this method | |
142 | (otherwise you could SeekI() to one position, "unread" a few bytes there, SeekI() | |
143 | to another position and data would be either lost or corrupted). | |
144 | ||
c7d9131a GL |
145 | \wxheading{Return value} |
146 | ||
147 | Returns the amount of bytes saved in the Write-Back buffer. | |
148 | ||
149 | \func{bool}{Ungetch}{\param{char }{c}} | |
150 | ||
151 | This function acts like the previous one except that it takes only one | |
152 | character: it is sometimes shorter to use than the generic function. | |
153 |