]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/datstrm.tex
added wxEVT_COMMAND_LIST_ITEM_FOCUSED event and implemented it for the generic version
[wxWidgets.git] / docs / latex / wx / datstrm.tex
... / ...
CommitLineData
1% ----------------------------------------------------------------------------
2% wxDataInputStream
3% ----------------------------------------------------------------------------
4\section{\class{wxDataInputStream}}\label{wxdatainputstream}
5
6This class provides functions that read binary data types in a
7portable way. Data can be read in either big-endian or litte-endian
8format, little-endian being the default on all architectures.
9
10If you want to read data from text files (or streams) use
11\helpref{wxTextInputStream}{wxtextinputstream} instead.
12
13The >> operator is overloaded and you can use this class like a standard C++ iostream.
14Note, however, that the arguments are the fixed size types wxUint32, wxInt32 etc
15and on a typical 32-bit computer, none of these match to the "long" type (wxInt32
16is defined as signed int on 32-bit architectures) so that you cannot use long. To avoid
17problems (here and elsewhere), make use of the wxInt32, wxUint32, etc types.
18
19For example:
20
21\begin{verbatim}
22 wxFileInputStream input( "mytext.dat" );
23 wxDataInputStream store( input );
24 wxUint8 i1;
25 float f2;
26 wxString line;
27
28 store >> i1; // read a 8 bit integer.
29 store >> i1 >> f2; // read a 8 bit integer followed by float.
30 store >> line; // read a text line
31\end{verbatim}
32
33See also \helpref{wxDataOutputStream}{wxdataoutputstream}.
34
35\wxheading{Derived from}
36
37None
38
39\wxheading{Include files}
40
41<wx/datstrm.h>
42
43\latexignore{\rtfignore{\wxheading{Members}}}
44
45\membersection{wxDataInputStream::wxDataInputStream}\label{wxdatainputstreamconstr}
46
47\func{}{wxDataInputStream}{\param{wxInputStream\&}{ stream}}
48
49Constructs a datastream object from an input stream. Only read methods will
50be available.
51
52\wxheading{Parameters}
53
54\docparam{stream}{The input stream.}
55
56\membersection{wxDataInputStream::\destruct{wxDataInputStream}}
57
58\func{}{\destruct{wxDataInputStream}}{\void}
59
60Destroys the wxDataInputStream object.
61
62\membersection{wxDataInputStream::BigEndianOrdered}
63
64\func{void}{BigEndianOrdered}{\param{bool}{ be\_order}}
65
66If {\it be\_order} is TRUE, all data will be read in big-endian
67order, such as written by programs on a big endian architecture
68(e.g. Sparc) or written by Java-Streams (which always use
69big-endian order).
70
71\membersection{wxDataInputStream::Read8}
72
73\func{wxUint8}{Read8}{\void}
74
75Reads a single byte from the stream.
76
77\membersection{wxDataInputStream::Read16}
78
79\func{wxUint16}{Read16}{\void}
80
81Reads a 16 bit integer from the stream.
82
83\membersection{wxDataInputStream::Read32}
84
85\func{wxUint32}{Read32}{\void}
86
87Reads a 32 bit integer from the stream.
88
89\membersection{wxDataInputStream::ReadDouble}
90
91\func{double}{ReadDouble}{\void}
92
93Reads a double (IEEE encoded) from the stream.
94
95\membersection{wxDataInputStream::ReadString}
96
97\func{wxString}{ReadString}{\void}
98
99Reads a string from a stream. Actually, this function first reads a long integer
100specifying the length of the string (without the last null character) and then
101reads the string.
102
103% ----------------------------------------------------------------------------
104% wxDataOutputStream
105% ----------------------------------------------------------------------------
106
107\section{\class{wxDataOutputStream}}\label{wxdataoutputstream}
108
109This class provides functions that write binary data types in a
110portable way. Data can be written in either big-endian or litte-endian
111format, little-endian being the default on all architectures.
112
113If you want to write data to text files (or streams) use
114\helpref{wxTextOutputStream}{wxtextoutputstream} instead.
115
116The << operator is overloaded and you can use this class like a standard
117C++ iostream. See \helpref{wxDataInputStream}{wxdatainputstream} for its
118usage and caveats.
119
120See also \helpref{wxDataInputStream}{wxdatainputstream}.
121
122\wxheading{Derived from}
123
124None
125
126\latexignore{\rtfignore{\wxheading{Members}}}
127
128\membersection{wxDataOutputStream::wxDataOutputStream}\label{wxdataoutputstreamconstr}
129
130\func{}{wxDataOutputStream}{\param{wxOutputStream\&}{ stream}}
131
132Constructs a datastream object from an output stream. Only write methods will
133be available.
134
135\wxheading{Parameters}
136
137\docparam{stream}{The output stream.}
138
139\membersection{wxDataOutputStream::\destruct{wxDataOutputStream}}
140
141\func{}{\destruct{wxDataOutputStream}}{\void}
142
143Destroys the wxDataOutputStream object.
144
145\membersection{wxDataOutputStream::BigEndianOrdered}
146
147\func{void}{BigEndianOrdered}{\param{bool}{ be\_order}}
148
149If {\it be\_order} is TRUE, all data will be written in big-endian
150order, e.g. for reading on a Sparc or from Java-Streams (which
151always use big-endian order), otherwise data will be written in
152little-endian order.
153
154\membersection{wxDataOutputStream::Write8}
155
156\func{void}{Write8}{{\param wxUint8 }{i8}}
157
158Writes the single byte {\it i8} to the stream.
159
160\membersection{wxDataOutputStream::Write16}
161
162\func{void}{Write16}{{\param wxUint16 }{i16}}
163
164Writes the 16 bit integer {\it i16} to the stream.
165
166\membersection{wxDataOutputStream::Write32}
167
168\func{void}{Write32}{{\param wxUint32 }{i32}}
169
170Writes the 32 bit integer {\it i32} to the stream.
171
172\membersection{wxDataOutputStream::WriteDouble}
173
174\func{void}{WriteDouble}{{\param double }{f}}
175
176Writes the double {\it f} to the stream using the IEEE format.
177
178\membersection{wxDataOutputStream::WriteString}
179
180\func{void}{WriteString}{{\param const wxString\& }{string}}
181
182Writes {\it string} to the stream. Actually, this method writes the size of
183the string before writing {\it string} itself.
184