]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/txtstrm.tex
Added project files for STC; fixed wxStringList memory leaks; small doc changes;
[wxWidgets.git] / docs / latex / wx / txtstrm.tex
CommitLineData
a3c1786d
GL
1% ----------------------------------------------------------------------------
2% wxTextInputStream
3% ----------------------------------------------------------------------------
4\section{\class{wxTextInputStream}}\label{wxtextinputstream}
5
6This class provides functions that read text datas using an input stream.
605d715d 7So, you can read {\it text} floats, integers.
a3c1786d 8
7ff14117
RR
9The wxTextInputStream correctly reads text files (or streams) in DOS, Macintosh
10and Unix formats and reports a single newline char as a line ending.
11
b453e1b2
RR
12Operator >> is overloaded and you can use this class like a standard C++ iostream.
13Note, however, that the arguments are the fixed size types wxUint32, wxInt32 etc
14and on a typical 32-bit computer, none of these match to the "long" type (wxInt32
15is defined as int on 32-bit architectures) so that you cannot use long. To avoid
16problems (here and elsewhere), make use of the wxInt32, wxUint32, etc types.
a3c1786d
GL
17
18For example:
19\begin{verbatim}
b453e1b2 20 wxFileInputStream input( "mytext.txt" );
a3c1786d
GL
21 wxTextInputStream text( input );
22 wxUint8 i1;
23 float f2;
24 wxString line;
25
26 text >> i1; // read a 8 bit integer.
3660fc40 27 text >> i1 >> f2; // read a 8 bit integer followed by float.
a3c1786d
GL
28 text >> line; // read a text line
29\end{verbatim}
30
31\wxheading{Include files}
32
33<wx/txtstrm.h>
34
35\latexignore{\rtfignore{\wxheading{Members}}}
36
37\membersection{wxTextInputStream::wxTextInputStream}\label{wxtextinputstreamconstr}
38
39\func{}{wxTextInputStream}{\param{wxInputStream\&}{ stream}}
40
41Constructs a text stream object from an input stream. Only read methods will
42be available.
43
44\wxheading{Parameters}
45
46\docparam{stream}{The input stream.}
47
48\membersection{wxTextInputStream::\destruct{wxTextInputStream}}
49
50\func{}{\destruct{wxTextInputStream}}{\void}
51
52Destroys the wxTextInputStream object.
53
54\membersection{wxTextInputStream::Read8}
55
b453e1b2 56\func{wxUint8}{Read8}{\void}
a3c1786d
GL
57
58Reads a single byte from the stream.
59
60\membersection{wxTextInputStream::Read16}
61
b453e1b2 62\func{wxUint16}{Read16}{\void}
a3c1786d
GL
63
64Reads a 16 bit integer from the stream.
65
66\membersection{wxTextInputStream::Read32}
67
b453e1b2 68\func{wxUint16}{Read32}{\void}
a3c1786d
GL
69
70Reads a 32 bit integer from the stream.
71
72\membersection{wxTextInputStream::ReadDouble}
73
74\func{double}{ReadDouble}{\void}
75
76Reads a double (IEEE encoded) from the stream.
77
78\membersection{wxTextInputStream::ReadString}
79
80\func{wxString}{wxTextInputStream::ReadString}{\void}
81
82Reads a line from the stream. A line is a string which ends with
3660fc40 83$\backslash$n or $\backslash$r$\backslash$n or $\backslash$r.
a3c1786d
GL
84
85% ----------------------------------------------------------------------------
86% wxTextOutputStream
87% ----------------------------------------------------------------------------
88
89\section{\class{wxTextOutputStream}}\label{wxtextoutputstream}
90
91This class provides functions that write text datas using an output stream.
28c9c76e 92So, you can write {\it text} floats, integers.
a3c1786d 93
65045edd 94You can also simulate the C++ cout class:
a3c1786d 95\begin{verbatim}
65045edd
RR
96 wxFFileOutputStream output( stderr );
97 wxTextOutputStream cout( output );
a3c1786d 98
65045edd
RR
99 cout << "This is a text line" << endl;
100 cout << 1234;
101 cout << 1.23456;
a3c1786d 102\end{verbatim}
3660fc40 103
7ff14117
RR
104The wxTextOutputStream writes text files (or streams) on DOS, Macintosh
105and Unix in their native formats (concerning the line ending).
106
a3c1786d
GL
107\latexignore{\rtfignore{\wxheading{Members}}}
108
d7cb14ce 109\membersection{wxTextOutputStream::wxTextOutputStream}\label{wxtextoutputstreamconstr}
a3c1786d 110
605d715d 111\func{}{wxTextOutputStream}{\param{wxOutputStream\&}{ stream}, \param{wxEOL}{ mode = wxEOL\_NATIVE}}
a3c1786d
GL
112
113Constructs a text stream object from an output stream. Only write methods will
114be available.
115
116\wxheading{Parameters}
117
118\docparam{stream}{The output stream.}
119
605d715d 120\docparam{mode}{The end-of-line mode. One of {\bf wxEOL\_NATIVE}, {\bf wxEOL\_DOS}, {\bf wxEOL\_MAC} or {\bf wxEOL\_UNIX}.}
28c9c76e 121
a3c1786d
GL
122\membersection{wxTextOutputStream::\destruct{wxTextOutputStream}}
123
124\func{}{\destruct{wxTextOutputStream}}{\void}
125
126Destroys the wxTextOutputStream object.
127
28c9c76e
RR
128\membersection{wxTextOutputStream::GetMode}
129
130\func{wxEOL}{wxTextOutputStream::GetMode}{\void}
131
605d715d 132Returns the end-of-line mode. One of {\bf wxEOL\_DOS}, {\bf wxEOL\_MAC} or {\bf wxEOL\_UNIX}.
28c9c76e
RR
133
134\membersection{wxTextOutputStream::SetMode}
135
605d715d 136\func{void}{wxTextOutputStream::SetMode}{{\param wxEOL}{ mode = wxEOL\_NATIVE}}
28c9c76e 137
605d715d 138Set the end-of-line mode. One of {\bf wxEOL\_NATIVE}, {\bf wxEOL\_DOS}, {\bf wxEOL\_MAC} or {\bf wxEOL\_UNIX}.
28c9c76e 139
a3c1786d
GL
140\membersection{wxTextOutputStream::Write8}
141
b453e1b2 142\func{void}{wxTextOutputStream::Write8}{{\param wxUint8 }{i8}}
a3c1786d
GL
143
144Writes the single byte {\it i8} to the stream.
145
146\membersection{wxTextOutputStream::Write16}
147
b453e1b2 148\func{void}{wxTextOutputStream::Write16}{{\param wxUint16 }{i16}}
a3c1786d
GL
149
150Writes the 16 bit integer {\it i16} to the stream.
151
152\membersection{wxTextOutputStream::Write32}
153
b453e1b2 154\func{void}{wxTextOutputStream::Write32}{{\param wxUint32 }{i32}}
a3c1786d
GL
155
156Writes the 32 bit integer {\it i32} to the stream.
157
158\membersection{wxTextOutputStream::WriteDouble}
159
28c9c76e 160\func{virtual void}{wxTextOutputStream::WriteDouble}{{\param double }{f}}
a3c1786d
GL
161
162Writes the double {\it f} to the stream using the IEEE format.
163
164\membersection{wxTextOutputStream::WriteString}
165
28c9c76e 166\func{virtual void}{wxTextOutputStream::WriteString}{{\param const wxString\& }{string}}
a3c1786d 167
28c9c76e
RR
168Writes {\it string} as a line. Depending on the end-of-line mode, it adds
169$\backslash$n, $\backslash$r or $\backslash$r$\backslash$n.
22d6efa8 170