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