]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/txtstrm.tex
removed extra (non existing) Prepend() parameter
[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
b2cf617c 16problems (here and elsewhere), make use of wxInt32, wxUint32 and similar types.
a3c1786d
GL
17
18For example:
b2cf617c 19
a3c1786d 20\begin{verbatim}
b453e1b2 21 wxFileInputStream input( "mytext.txt" );
a3c1786d
GL
22 wxTextInputStream text( input );
23 wxUint8 i1;
24 float f2;
25 wxString line;
26
27 text >> i1; // read a 8 bit integer.
3660fc40 28 text >> i1 >> f2; // read a 8 bit integer followed by float.
a3c1786d
GL
29 text >> line; // read a text line
30\end{verbatim}
31
32\wxheading{Include files}
33
34<wx/txtstrm.h>
35
36\latexignore{\rtfignore{\wxheading{Members}}}
37
38\membersection{wxTextInputStream::wxTextInputStream}\label{wxtextinputstreamconstr}
39
40\func{}{wxTextInputStream}{\param{wxInputStream\&}{ stream}}
41
42Constructs a text stream object from an input stream. Only read methods will
43be available.
44
45\wxheading{Parameters}
46
47\docparam{stream}{The input stream.}
48
49\membersection{wxTextInputStream::\destruct{wxTextInputStream}}
50
51\func{}{\destruct{wxTextInputStream}}{\void}
52
53Destroys the wxTextInputStream object.
54
55\membersection{wxTextInputStream::Read8}
56
b453e1b2 57\func{wxUint8}{Read8}{\void}
a3c1786d
GL
58
59Reads a single byte from the stream.
60
61\membersection{wxTextInputStream::Read16}
62
b453e1b2 63\func{wxUint16}{Read16}{\void}
a3c1786d
GL
64
65Reads a 16 bit integer from the stream.
66
67\membersection{wxTextInputStream::Read32}
68
17046ed6 69\func{wxUint32}{Read32}{\void}
a3c1786d
GL
70
71Reads a 32 bit integer from the stream.
72
73\membersection{wxTextInputStream::ReadDouble}
74
75\func{double}{ReadDouble}{\void}
76
77Reads a double (IEEE encoded) from the stream.
78
f6bcfd97
BP
79\membersection{wxTextInputStream::ReadLine}\label{wxtextinputstreamreadline}
80
81\func{wxString}{wxTextInputStream::ReadLine}{\void}
82
83Reads a line from the input stream and returns it (without the end of line
84character).
85
a3c1786d
GL
86\membersection{wxTextInputStream::ReadString}
87
88\func{wxString}{wxTextInputStream::ReadString}{\void}
89
f6bcfd97
BP
90{\bf NB:} This method is deprecated, use \helpref{ReadLine}{wxtextinputstreamreadline}
91or \helpref{ReadWord}{wxtextinputstreamreadword} instead.
92
93Same as \helpref{ReadLine}{wxtextinputstreamreadline}.
94
95\membersection{wxTextInputStream::ReadWord}\label{wxtextinputstreamreadword}
96
97\func{wxString}{wxTextInputStream::ReadWord}{\void}
98
99Reads a word (a sequence of characters until the next separator) from the
100input stream.
101
102\wxheading{See also}
103
104\helpref{SetStringSeparators}{wxtextinputstreamsetstringseparators}
105
106\membersection{wxTextInputStream::SetStringSeparators}\label{wxtextinputstreamsetstringseparators}
107
108\func{void}{SetStringSeparators}{\param{const wxString\& }{sep}}
109
110Sets the characters which are used to define the word boundaries in
111\helpref{ReadWord}{wxtextinputstreamreadword}.
112
113The default separators are the space and {\tt TAB} characters.
a3c1786d
GL
114
115% ----------------------------------------------------------------------------
116% wxTextOutputStream
117% ----------------------------------------------------------------------------
118
119\section{\class{wxTextOutputStream}}\label{wxtextoutputstream}
120
121This class provides functions that write text datas using an output stream.
28c9c76e 122So, you can write {\it text} floats, integers.
a3c1786d 123
65045edd 124You can also simulate the C++ cout class:
b2cf617c 125
a3c1786d 126\begin{verbatim}
65045edd
RR
127 wxFFileOutputStream output( stderr );
128 wxTextOutputStream cout( output );
a3c1786d 129
65045edd
RR
130 cout << "This is a text line" << endl;
131 cout << 1234;
132 cout << 1.23456;
a3c1786d 133\end{verbatim}
3660fc40 134
7ff14117
RR
135The wxTextOutputStream writes text files (or streams) on DOS, Macintosh
136and Unix in their native formats (concerning the line ending).
137
a3c1786d
GL
138\latexignore{\rtfignore{\wxheading{Members}}}
139
d7cb14ce 140\membersection{wxTextOutputStream::wxTextOutputStream}\label{wxtextoutputstreamconstr}
a3c1786d 141
605d715d 142\func{}{wxTextOutputStream}{\param{wxOutputStream\&}{ stream}, \param{wxEOL}{ mode = wxEOL\_NATIVE}}
a3c1786d
GL
143
144Constructs a text stream object from an output stream. Only write methods will
145be available.
146
147\wxheading{Parameters}
148
149\docparam{stream}{The output stream.}
150
b2cf617c 151\docparam{mode}{The end-of-line mode. One of {\bf wxEOL\_NATIVE}, {\bf wxEOL\_DOS}, {\bf wxEOL\_MAC} and {\bf wxEOL\_UNIX}.}
28c9c76e 152
a3c1786d
GL
153\membersection{wxTextOutputStream::\destruct{wxTextOutputStream}}
154
155\func{}{\destruct{wxTextOutputStream}}{\void}
156
157Destroys the wxTextOutputStream object.
158
28c9c76e
RR
159\membersection{wxTextOutputStream::GetMode}
160
161\func{wxEOL}{wxTextOutputStream::GetMode}{\void}
162
b2cf617c 163Returns the end-of-line mode. One of {\bf wxEOL\_DOS}, {\bf wxEOL\_MAC} and {\bf wxEOL\_UNIX}.
28c9c76e
RR
164
165\membersection{wxTextOutputStream::SetMode}
166
605d715d 167\func{void}{wxTextOutputStream::SetMode}{{\param wxEOL}{ mode = wxEOL\_NATIVE}}
28c9c76e 168
b2cf617c 169Set the end-of-line mode. One of {\bf wxEOL\_NATIVE}, {\bf wxEOL\_DOS}, {\bf wxEOL\_MAC} and {\bf wxEOL\_UNIX}.
28c9c76e 170
a3c1786d
GL
171\membersection{wxTextOutputStream::Write8}
172
b453e1b2 173\func{void}{wxTextOutputStream::Write8}{{\param wxUint8 }{i8}}
a3c1786d
GL
174
175Writes the single byte {\it i8} to the stream.
176
177\membersection{wxTextOutputStream::Write16}
178
b453e1b2 179\func{void}{wxTextOutputStream::Write16}{{\param wxUint16 }{i16}}
a3c1786d
GL
180
181Writes the 16 bit integer {\it i16} to the stream.
182
183\membersection{wxTextOutputStream::Write32}
184
b453e1b2 185\func{void}{wxTextOutputStream::Write32}{{\param wxUint32 }{i32}}
a3c1786d
GL
186
187Writes the 32 bit integer {\it i32} to the stream.
188
189\membersection{wxTextOutputStream::WriteDouble}
190
28c9c76e 191\func{virtual void}{wxTextOutputStream::WriteDouble}{{\param double }{f}}
a3c1786d
GL
192
193Writes the double {\it f} to the stream using the IEEE format.
194
195\membersection{wxTextOutputStream::WriteString}
196
28c9c76e 197\func{virtual void}{wxTextOutputStream::WriteString}{{\param const wxString\& }{string}}
a3c1786d 198
b2cf617c 199Writes {\it string} as a line. Depending on the end-of-line mode, it adds
28c9c76e 200$\backslash$n, $\backslash$r or $\backslash$r$\backslash$n.
22d6efa8 201