]>
Commit | Line | Data |
---|---|---|
fae05df5 GL |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: txtstrm.h | |
3 | // Purpose: Text stream classes | |
4 | // Author: Guilhem Lavaux | |
5 | // Modified by: | |
6 | // Created: 28/06/1998 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Guilhem Lavaux | |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_TXTSTREAM_H_ | |
13 | #define _WX_TXTSTREAM_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "txtstrm.h" | |
17 | #endif | |
18 | ||
ed58dbea | 19 | #include "wx/stream.h" |
fae05df5 GL |
20 | |
21 | #if wxUSE_STREAMS | |
22 | ||
65045edd RR |
23 | class WXDLLEXPORT wxTextInputStream; |
24 | class WXDLLEXPORT wxTextOutputStream; | |
25 | ||
26 | typedef wxTextInputStream& (*__wxTextInputManip)(wxTextInputStream&); | |
27 | typedef wxTextOutputStream& (*__wxTextOutputManip)(wxTextOutputStream&); | |
28 | ||
29 | WXDLLEXPORT wxTextOutputStream &endl( wxTextOutputStream &stream ); | |
30 | ||
fae05df5 GL |
31 | class WXDLLEXPORT wxTextInputStream { |
32 | public: | |
9853d977 | 33 | wxTextInputStream(wxInputStream& s, const wxChar &sep=wxT(' ')); |
fae05df5 GL |
34 | ~wxTextInputStream(); |
35 | ||
36 | wxUint32 Read32(); | |
37 | wxUint16 Read16(); | |
9853d977 SB |
38 | wxUint8 Read8(); |
39 | double ReadDouble(); | |
40 | wxString ReadString(); // deprecated use ReadLine or ReadWord instead | |
41 | wxString ReadLine(); | |
42 | wxString ReadWord(); | |
43 | ||
44 | wxChar GetStringSeparator() const { return m_string_separator;} | |
45 | void SetStringSeparator(const wxChar &c) { m_string_separator=c;} | |
fae05df5 GL |
46 | |
47 | // Operators | |
9853d977 | 48 | wxTextInputStream& operator>>(wxString& word); |
940ddb19 | 49 | wxTextInputStream& operator>>(wxChar& c); |
fae05df5 GL |
50 | wxTextInputStream& operator>>(wxInt16& i); |
51 | wxTextInputStream& operator>>(wxInt32& i); | |
fae05df5 GL |
52 | wxTextInputStream& operator>>(wxUint16& i); |
53 | wxTextInputStream& operator>>(wxUint32& i); | |
54 | wxTextInputStream& operator>>(double& i); | |
55 | wxTextInputStream& operator>>(float& f); | |
65045edd RR |
56 | |
57 | wxTextInputStream& operator>>( __wxTextInputManip func) { return func(*this); } | |
58 | ||
fae05df5 GL |
59 | protected: |
60 | wxInputStream *m_input; | |
9853d977 | 61 | wxChar m_string_separator; |
cd25b18c RR |
62 | |
63 | wxChar NextNonWhiteSpace(); | |
64 | void SkipIfEndOfLine( wxChar c ); | |
fae05df5 GL |
65 | }; |
66 | ||
67 | class WXDLLEXPORT wxTextOutputStream { | |
68 | public: | |
69 | wxTextOutputStream(wxOutputStream& s); | |
70 | ~wxTextOutputStream(); | |
71 | ||
72 | void Write32(wxUint32 i); | |
73 | void Write16(wxUint16 i); | |
74 | void Write8(wxUint8 i); | |
75 | void WriteDouble(double d); | |
76 | void WriteString(const wxString& string); | |
cd25b18c | 77 | |
fae05df5 GL |
78 | wxTextOutputStream& operator<<(const wxChar *string); |
79 | wxTextOutputStream& operator<<(const wxString& string); | |
940ddb19 | 80 | wxTextOutputStream& operator<<(wxChar c); |
fae05df5 GL |
81 | wxTextOutputStream& operator<<(wxInt16 c); |
82 | wxTextOutputStream& operator<<(wxInt32 c); | |
fae05df5 GL |
83 | wxTextOutputStream& operator<<(wxUint16 c); |
84 | wxTextOutputStream& operator<<(wxUint32 c); | |
85 | wxTextOutputStream& operator<<(double f); | |
86 | wxTextOutputStream& operator<<(float f); | |
87 | ||
65045edd RR |
88 | wxTextOutputStream& operator<<( __wxTextOutputManip func) { return func(*this); } |
89 | ||
fae05df5 GL |
90 | protected: |
91 | wxOutputStream *m_output; | |
92 | }; | |
93 | ||
94 | #endif | |
95 | // wxUSE_STREAMS | |
96 | ||
97 | #endif | |
98 | // _WX_DATSTREAM_H_ |