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_
15 #if defined(__GNUG__) && !defined(__APPLE__)
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
);
32 class WXDLLEXPORT wxTextInputStream
36 wxTextInputStream(wxInputStream
& s
, const wxString
&sep
=wxT(" \t"), wxMBConv
& conv
= wxConvUTF8
);
38 wxTextInputStream(wxInputStream
& s
, const wxString
&sep
=wxT(" \t") );
46 wxString
ReadString(); // deprecated use ReadLine or ReadWord instead
50 wxString
GetStringSeparators() const { return m_separators
; }
51 void SetStringSeparators(const wxString
&c
) { m_separators
= c
; }
54 wxTextInputStream
& operator>>(wxString
& word
);
55 wxTextInputStream
& operator>>(char& c
);
56 wxTextInputStream
& operator>>(wxInt16
& i
);
57 wxTextInputStream
& operator>>(wxInt32
& i
);
58 wxTextInputStream
& operator>>(wxUint16
& i
);
59 wxTextInputStream
& operator>>(wxUint32
& i
);
60 wxTextInputStream
& operator>>(double& i
);
61 wxTextInputStream
& operator>>(float& f
);
63 wxTextInputStream
& operator>>( __wxTextInputManip func
) { return func(*this); }
66 wxInputStream
&m_input
;
67 wxString m_separators
;
73 bool EatEOL(const wxChar
&c
);
74 wxChar
NextNonSeparators();
75 void SkipIfEndOfLine( wxChar c
);
86 class WXDLLEXPORT wxTextOutputStream
90 wxTextOutputStream( wxOutputStream
& s
, wxEOL mode
= wxEOL_NATIVE
, wxMBConv
& conv
= wxConvUTF8
);
92 wxTextOutputStream( wxOutputStream
& s
, wxEOL mode
= wxEOL_NATIVE
);
94 virtual ~wxTextOutputStream();
96 void SetMode( wxEOL mode
= wxEOL_NATIVE
);
97 wxEOL
GetMode() { return m_mode
; }
99 void Write32(wxUint32 i
);
100 void Write16(wxUint16 i
);
101 void Write8(wxUint8 i
);
102 virtual void WriteDouble(double d
);
103 virtual void WriteString(const wxString
& string
);
105 wxTextOutputStream
& operator<<(const wxChar
*string
);
106 wxTextOutputStream
& operator<<(const wxString
& string
);
107 wxTextOutputStream
& operator<<(char c
);
108 wxTextOutputStream
& operator<<(wxInt16 c
);
109 wxTextOutputStream
& operator<<(wxInt32 c
);
110 wxTextOutputStream
& operator<<(wxUint16 c
);
111 wxTextOutputStream
& operator<<(wxUint32 c
);
112 wxTextOutputStream
& operator<<(double f
);
113 wxTextOutputStream
& operator<<(float f
);
115 wxTextOutputStream
& operator<<( __wxTextOutputManip func
) { return func(*this); }
118 wxOutputStream
&m_output
;