]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/inputstr.tex
Underscore escaping fix from Angel Vidal Veiga
[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 after an attempt has been made to read past the end of the
56stream.
57
58\wxheading{Note}
59
60In wxWidgets 2.6.x and below some streams returned Eof() when the last
61byte had been read rather than when an attempt had been made to read
62past the last byte. If you want to avoid depending on one behaviour or
63the other then call \helpref{LastRead()}{wxinputstreamlastread} to
64check the number of bytes actually read.
65
66\membersection{wxInputStream::LastRead}\label{wxinputstreamlastread}
67
68\constfunc{size\_t}{LastRead}{\void}
69
70Returns the last number of bytes read.
71
72\membersection{wxInputStream::Peek}\label{wxinputstreampeek}
73
74\func{char}{Peek}{\void}
75
76Returns the first character in the input queue without removing it.
77
78\wxheading{Note}
79
80Blocks until something appears in the stream if necessary, if nothing
81ever does (i.e. EOF) LastRead() will return 0 (and the return value is
82undefined), otherwise LastRead() returns 1.
83
84\membersection{wxInputStream::Read}\label{wxinputstreamread}
85
86\func{wxInputStream\&}{Read}{\param{void *}{buffer}, \param{size\_t}{ size}}
87
88Reads the specified amount of bytes and stores the data in {\it buffer}.
89
90\wxheading{Warning}
91
92The buffer absolutely needs to have at least the specified size.
93
94\wxheading{Return value}
95
96This function returns a reference on the current object, so the user can test
97any states of the stream right away.
98
99\func{wxInputStream\&}{Read}{\param{wxOutputStream\&}{ stream\_out}}
100
101Reads data from the input queue and stores it in the specified output stream.
102The data is read until an error is raised by one of the two streams.
103
104\wxheading{Return value}
105
106This function returns a reference on the current object, so the user can test
107any states of the stream right away.
108
109\membersection{wxInputStream::SeekI}\label{wxinputstreamseeki}
110
111\func{off\_t}{SeekI}{\param{off\_t}{ pos}, \param{wxSeekMode}{ mode = wxFromStart}}
112
113Changes the stream current position.
114
115\wxheading{Parameters}
116
117\docparam{pos}{Offset to seek to.}
118
119\docparam{mode}{One of {\bf wxFromStart}, {\bf wxFromEnd}, {\bf wxFromCurrent}.}
120
121\wxheading{Return value}
122
123The new stream position or wxInvalidOffset on error.
124
125\membersection{wxInputStream::TellI}\label{wxinputstreamtelli}
126
127\constfunc{off\_t}{TellI}{\void}
128
129Returns the current stream position.
130
131\membersection{wxInputStream::Ungetch}\label{wxinputstreamungetch}
132
133\func{size\_t}{Ungetch}{\param{const char*}{ buffer}, \param{size\_t}{ size}}
134
135This function is only useful in {\it read} mode. It is the manager of the "Write-Back"
136buffer. This buffer acts like a temporary buffer where data which has to be
137read during the next read IO call are put. This is useful when you get a big
138block of data which you didn't want to read: you can replace them at the top
139of the input queue by this way.
140
141Be very careful about this call in connection with calling SeekI() on the same
142stream. Any call to SeekI() will invalidate any previous call to this method
143(otherwise you could SeekI() to one position, "unread" a few bytes there, SeekI()
144to another position and data would be either lost or corrupted).
145
146\wxheading{Return value}
147
148Returns the amount of bytes saved in the Write-Back buffer.
149
150\func{bool}{Ungetch}{\param{char }{c}}
151
152This function acts like the previous one except that it takes only one
153character: it is sometimes shorter to use than the generic function.
154