]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/datstrm.tex
emphasize that wxFindReplaceDialog is always modeless
[wxWidgets.git] / docs / latex / wx / datstrm.tex
CommitLineData
c7d9131a
GL
1% ----------------------------------------------------------------------------
2% wxDataInputStream
3% ----------------------------------------------------------------------------
631f1bfe 4\section{\class{wxDataInputStream}}\label{wxdatainputstream}
4d1f281b 5
7ff14117
RR
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:
fa482912 20
7ff14117
RR
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}.
4d1f281b 34
36edded9
JS
35\wxheading{Derived from}
36
37None
38
954b8ae6
JS
39\wxheading{Include files}
40
41<wx/datstrm.h>
42
631f1bfe 43\latexignore{\rtfignore{\wxheading{Members}}}
4d1f281b 44
631f1bfe 45\membersection{wxDataInputStream::wxDataInputStream}\label{wxdatainputstreamconstr}
4d1f281b 46
631f1bfe 47\func{}{wxDataInputStream}{\param{wxInputStream\&}{ stream}}
4d1f281b 48
631f1bfe 49Constructs a datastream object from an input stream. Only read methods will
4d1f281b
GL
50be available.
51
52\wxheading{Parameters}
53
631f1bfe 54\docparam{stream}{The input stream.}
4d1f281b 55
631f1bfe 56\membersection{wxDataInputStream::\destruct{wxDataInputStream}}
4d1f281b 57
631f1bfe 58\func{}{\destruct{wxDataInputStream}}{\void}
4d1f281b 59
631f1bfe 60Destroys the wxDataInputStream object.
4d1f281b 61
d7cb14ce 62\membersection{wxDataInputStream::BigEndianOrdered}
7ff14117 63
605d715d 64\func{void}{BigEndianOrdered}{\param{bool}{ be\_order}}
7ff14117 65
605d715d 66If {\it be\_order} is TRUE, all data will be read in big-endian
7ff14117
RR
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
631f1bfe 71\membersection{wxDataInputStream::Read8}
4d1f281b 72
7ff14117 73\func{wxUint8}{Read8}{\void}
4d1f281b
GL
74
75Reads a single byte from the stream.
76
631f1bfe 77\membersection{wxDataInputStream::Read16}
4d1f281b 78
7ff14117 79\func{wxUint16}{Read16}{\void}
4d1f281b
GL
80
81Reads a 16 bit integer from the stream.
82
631f1bfe 83\membersection{wxDataInputStream::Read32}
4d1f281b 84
7ff14117 85\func{wxUint32}{Read32}{\void}
4d1f281b
GL
86
87Reads a 32 bit integer from the stream.
88
631f1bfe 89\membersection{wxDataInputStream::ReadDouble}
4d1f281b
GL
90
91\func{double}{ReadDouble}{\void}
92
93Reads a double (IEEE encoded) from the stream.
94
631f1bfe 95\membersection{wxDataInputStream::ReadString}
4d1f281b 96
775c1df4 97\func{wxString}{ReadString}{\void}
4d1f281b 98
631f1bfe 99Reads a string from a stream. Actually, this function first reads a long integer
4d1f281b
GL
100specifying the length of the string (without the last null character) and then
101reads the string.
102
c7d9131a
GL
103% ----------------------------------------------------------------------------
104% wxDataOutputStream
105% ----------------------------------------------------------------------------
106
631f1bfe
JS
107\section{\class{wxDataOutputStream}}\label{wxdataoutputstream}
108
7ff14117
RR
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}.
631f1bfe 121
36edded9
JS
122\wxheading{Derived from}
123
124None
125
631f1bfe
JS
126\latexignore{\rtfignore{\wxheading{Members}}}
127
128\membersection{wxDataOutputStream::wxDataOutputStream}\label{wxdataoutputstreamconstr}
129
d7cb14ce 130\func{}{wxDataOutputStream}{\param{wxOutputStream\&}{ stream}}
631f1bfe 131
7ff14117 132Constructs a datastream object from an output stream. Only write methods will
631f1bfe
JS
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
d7cb14ce 145\membersection{wxDataOutputStream::BigEndianOrdered}
7ff14117 146
605d715d 147\func{void}{BigEndianOrdered}{\param{bool}{ be\_order}}
7ff14117 148
605d715d 149If {\it be\_order} is TRUE, all data will be written in big-endian
7ff14117
RR
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
631f1bfe 154\membersection{wxDataOutputStream::Write8}
4d1f281b 155
775c1df4 156\func{void}{Write8}{{\param wxUint8 }{i8}}
4d1f281b
GL
157
158Writes the single byte {\it i8} to the stream.
159
631f1bfe 160\membersection{wxDataOutputStream::Write16}
4d1f281b 161
775c1df4 162\func{void}{Write16}{{\param wxUint16 }{i16}}
4d1f281b
GL
163
164Writes the 16 bit integer {\it i16} to the stream.
165
631f1bfe 166\membersection{wxDataOutputStream::Write32}
4d1f281b 167
775c1df4 168\func{void}{Write32}{{\param wxUint32 }{i32}}
4d1f281b
GL
169
170Writes the 32 bit integer {\it i32} to the stream.
171
631f1bfe 172\membersection{wxDataOutputStream::WriteDouble}
4d1f281b 173
775c1df4 174\func{void}{WriteDouble}{{\param double }{f}}
4d1f281b
GL
175
176Writes the double {\it f} to the stream using the IEEE format.
177
40b480c3
JS
178\membersection{wxDataOutputStream::WriteString}
179
775c1df4 180\func{void}{WriteString}{{\param const wxString\& }{string}}
40b480c3
JS
181
182Writes {\it string} to the stream. Actually, this method writes the size of
183the string before writing {\it string} itself.
22d6efa8 184