1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Text stream classes
4 // Author: Guilhem Lavaux
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_TXTSTREAM_H_
13 #define _WX_TXTSTREAM_H_
16 #pragma interface "txtstrm.h"
19 #include "wx/stream.h"
23 class WXDLLEXPORT wxTextInputStream
;
24 class WXDLLEXPORT wxTextOutputStream
;
26 typedef wxTextInputStream
& (*__wxTextInputManip
)(wxTextInputStream
&);
27 typedef wxTextOutputStream
& (*__wxTextOutputManip
)(wxTextOutputStream
&);
29 WXDLLEXPORT wxTextOutputStream
&endl( wxTextOutputStream
&stream
);
31 class WXDLLEXPORT wxTextInputStream
34 wxTextInputStream(wxInputStream
& s
, const wxString
&sep
=wxT(" \t") );
41 wxString
ReadString(); // deprecated use ReadLine or ReadWord instead
45 wxString
GetStringSeparators() const { return m_separators
; }
46 void SetStringSeparators(const wxString
&c
) { m_separators
= c
; }
49 wxTextInputStream
& operator>>(wxString
& word
);
50 wxTextInputStream
& operator>>(char& c
);
51 wxTextInputStream
& operator>>(wxInt16
& i
);
52 wxTextInputStream
& operator>>(wxInt32
& i
);
53 wxTextInputStream
& operator>>(wxUint16
& i
);
54 wxTextInputStream
& operator>>(wxUint32
& i
);
55 wxTextInputStream
& operator>>(double& i
);
56 wxTextInputStream
& operator>>(float& f
);
58 wxTextInputStream
& operator>>( __wxTextInputManip func
) { return func(*this); }
61 wxInputStream
&m_input
;
62 wxString m_separators
;
64 bool EatEOL(const wxChar
&c
);
65 wxChar
NextNonSeparators();
66 void SkipIfEndOfLine( wxChar c
);
76 class WXDLLEXPORT wxTextOutputStream
79 wxTextOutputStream( wxOutputStream
& s
, wxEOL mode
= wxEOL_NATIVE
);
80 virtual ~wxTextOutputStream();
82 void SetMode( wxEOL mode
= wxEOL_NATIVE
);
83 wxEOL
GetMode() { return m_mode
; }
85 void Write32(wxUint32 i
);
86 void Write16(wxUint16 i
);
87 void Write8(wxUint8 i
);
88 virtual void WriteDouble(double d
);
89 virtual void WriteString(const wxString
& string
);
91 wxTextOutputStream
& operator<<(const wxChar
*string
);
92 wxTextOutputStream
& operator<<(const wxString
& string
);
93 wxTextOutputStream
& operator<<(char c
);
94 wxTextOutputStream
& operator<<(wxInt16 c
);
95 wxTextOutputStream
& operator<<(wxInt32 c
);
96 wxTextOutputStream
& operator<<(wxUint16 c
);
97 wxTextOutputStream
& operator<<(wxUint32 c
);
98 wxTextOutputStream
& operator<<(double f
);
99 wxTextOutputStream
& operator<<(float f
);
101 wxTextOutputStream
& operator<<( __wxTextOutputManip func
) { return func(*this); }
104 wxOutputStream
&m_output
;