]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/inputstr.tex
added new and improved wxFileCtrl implementation (patch 1763164)
[wxWidgets.git] / docs / latex / wx / inputstr.tex
1 % -----------------------------------------------------------------------------
2 % wxInputStream
3 % -----------------------------------------------------------------------------
4 \section{\class{wxInputStream}}\label{wxinputstream}
5
6 wxInputStream 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
29 Creates a dummy input stream.
30
31 \membersection{wxInputStream::\destruct{wxInputStream}}\label{wxinputstreamdtor}
32
33 \func{}{\destruct{wxInputStream}}{\void}
34
35 Destructor.
36
37 \membersection{wxInputStream::CanRead}\label{wxinputstreamcanread}
38
39 \constfunc{bool}{CanRead}{\void}
40
41 Returns true if some data is available in the stream right now, so that
42 calling \helpref{Read()}{wxinputstreamread} wouldn't block.
43
44 \membersection{wxInputStream::GetC}\label{wxinputstreamgetc}
45
46 \func{char}{GetC}{\void}
47
48 Returns the first character in the input queue and removes it,
49 blocking until it appears if necessary.
50
51 \wxheading{Note}
52
53 If 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
59 Returns true after an attempt has been made to read past the end of the
60 stream.
61
62 \wxheading{Note}
63
64 In wxWidgets 2.6.x and below some streams returned Eof() when the last
65 byte had been read rather than when an attempt had been made to read
66 past the last byte. If you want to avoid depending on one behaviour or
67 the other then call \helpref{LastRead()}{wxinputstreamlastread} to
68 check the number of bytes actually read.
69
70 \membersection{wxInputStream::LastRead}\label{wxinputstreamlastread}
71
72 \constfunc{size\_t}{LastRead}{\void}
73
74 Returns the last number of bytes read.
75
76 \membersection{wxInputStream::Peek}\label{wxinputstreampeek}
77
78 \func{char}{Peek}{\void}
79
80 Returns the first character in the input queue without removing it.
81
82 \wxheading{Note}
83
84 Blocks until something appears in the stream if necessary, if nothing
85 ever does (i.e. EOF) LastRead() will return 0 (and the return value is
86 undefined), otherwise LastRead() returns 1.
87
88 \membersection{wxInputStream::Read}\label{wxinputstreamread}
89
90 \func{wxInputStream\&}{Read}{\param{void *}{buffer}, \param{size\_t}{ size}}
91
92 Reads the specified amount of bytes and stores the data in {\it buffer}.
93
94 \wxheading{Warning}
95
96 The buffer absolutely needs to have at least the specified size.
97
98 \wxheading{Return value}
99
100 This function returns a reference on the current object, so the user can test
101 any states of the stream right away.
102
103 \func{wxInputStream\&}{Read}{\param{wxOutputStream\&}{ stream\_out}}
104
105 Reads data from the input queue and stores it in the specified output stream.
106 The data is read until an error is raised by one of the two streams.
107
108 \wxheading{Return value}
109
110 This function returns a reference on the current object, so the user can test
111 any 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
117 Changes 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
127 The new stream position or wxInvalidOffset on error.
128
129 \membersection{wxInputStream::TellI}\label{wxinputstreamtelli}
130
131 \constfunc{off\_t}{TellI}{\void}
132
133 Returns 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
139 This function is only useful in {\it read} mode. It is the manager of the "Write-Back"
140 buffer. This buffer acts like a temporary buffer where data which has to be
141 read during the next read IO call are put. This is useful when you get a big
142 block of data which you didn't want to read: you can replace them at the top
143 of the input queue by this way.
144
145 Be very careful about this call in connection with calling SeekI() on the same
146 stream. 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()
148 to another position and data would be either lost or corrupted).
149
150 \wxheading{Return value}
151
152 Returns the amount of bytes saved in the Write-Back buffer.
153
154 \func{bool}{Ungetch}{\param{char }{c}}
155
156 This function acts like the previous one except that it takes only one
157 character: it is sometimes shorter to use than the generic function.
158