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