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