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