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