]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/inputstr.tex
fixed doc wrong position of \wxheading{Library}
[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\wxheading{Library}
17
18\helpref{wxBase}{librarieslist}
19
20\latexignore{\rtfignore{\wxheading{Members}}}
21
22% -----------
23% ctor & dtor
24% -----------
25\membersection{wxInputStream::wxInputStream}\label{wxinputstreamctor}
26
27\func{}{wxInputStream}{\void}
28
29Creates a dummy input stream.
30
31\membersection{wxInputStream::\destruct{wxInputStream}}\label{wxinputstreamdtor}
32
33\func{}{\destruct{wxInputStream}}{\void}
34
35Destructor.
36
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
44\membersection{wxInputStream::GetC}\label{wxinputstreamgetc}
45
46\func{char}{GetC}{\void}
47
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.
54
55\membersection{wxInputStream::Eof}\label{wxinputstreameof}
56
57\constfunc{bool}{Eof}{\void}
58
59Returns true after an attempt has been made to read past the end of the
60stream.
61
62\wxheading{Note}
63
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.
69
70\membersection{wxInputStream::LastRead}\label{wxinputstreamlastread}
71
72\constfunc{size\_t}{LastRead}{\void}
73
74Returns the last number of bytes read.
75
76\membersection{wxInputStream::Peek}\label{wxinputstreampeek}
77
78\func{char}{Peek}{\void}
79
80Returns the first character in the input queue without removing it.
81
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
88\membersection{wxInputStream::Read}\label{wxinputstreamread}
89
90\func{wxInputStream\&}{Read}{\param{void *}{buffer}, \param{size\_t}{ size}}
91
92Reads the specified amount of bytes and stores the data in {\it buffer}.
93
94\wxheading{Warning}
95
96The buffer absolutely needs to have at least the specified size.
97
98\wxheading{Return value}
99
100This function returns a reference on the current object, so the user can test
101any states of the stream right away.
102
103\func{wxInputStream\&}{Read}{\param{wxOutputStream\&}{ stream\_out}}
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
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
113\membersection{wxInputStream::SeekI}\label{wxinputstreamseeki}
114
115\func{off\_t}{SeekI}{\param{off\_t}{ pos}, \param{wxSeekMode}{ mode = wxFromStart}}
116
117Changes the stream current position.
118
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
129\membersection{wxInputStream::TellI}\label{wxinputstreamtelli}
130
131\constfunc{off\_t}{TellI}{\void}
132
133Returns the current stream position.
134
135\membersection{wxInputStream::Ungetch}\label{wxinputstreamungetch}
136
137\func{size\_t}{Ungetch}{\param{const char*}{ buffer}, \param{size\_t}{ size}}
138
139This function is only useful in {\it read} mode. It is the manager of the "Write-Back"
140buffer. This buffer acts like a temporary buffer where data which has to be
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
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
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