]>
Commit | Line | Data |
---|---|---|
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 | ||
19 | #include "wx/stream.h" | |
20 | ||
21 | #if wxUSE_STREAMS | |
22 | ||
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 | ||
31 | class WXDLLEXPORT wxTextInputStream { | |
32 | public: | |
33 | wxTextInputStream(wxInputStream& s); | |
34 | ~wxTextInputStream(); | |
35 | ||
36 | wxUint32 Read32(); | |
37 | wxUint16 Read16(); | |
38 | wxUint8 Read8(); | |
39 | double ReadDouble(); | |
40 | wxString ReadString(); | |
41 | ||
42 | // Operators | |
43 | wxTextInputStream& operator>>(wxString& line); | |
44 | wxTextInputStream& operator>>(wxChar& c); | |
45 | wxTextInputStream& operator>>(wxInt16& i); | |
46 | wxTextInputStream& operator>>(wxInt32& i); | |
47 | wxTextInputStream& operator>>(wxUint16& i); | |
48 | wxTextInputStream& operator>>(wxUint32& i); | |
49 | wxTextInputStream& operator>>(double& i); | |
50 | wxTextInputStream& operator>>(float& f); | |
51 | ||
52 | wxTextInputStream& operator>>( __wxTextInputManip func) { return func(*this); } | |
53 | ||
54 | protected: | |
55 | wxInputStream *m_input; | |
56 | ||
57 | wxChar NextNonWhiteSpace(); | |
58 | void SkipIfEndOfLine( wxChar c ); | |
59 | }; | |
60 | ||
61 | class WXDLLEXPORT wxTextOutputStream { | |
62 | public: | |
63 | wxTextOutputStream(wxOutputStream& s); | |
64 | ~wxTextOutputStream(); | |
65 | ||
66 | void Write32(wxUint32 i); | |
67 | void Write16(wxUint16 i); | |
68 | void Write8(wxUint8 i); | |
69 | void WriteDouble(double d); | |
70 | void WriteString(const wxString& string); | |
71 | ||
72 | wxTextOutputStream& operator<<(const wxChar *string); | |
73 | wxTextOutputStream& operator<<(const wxString& string); | |
74 | wxTextOutputStream& operator<<(wxChar c); | |
75 | wxTextOutputStream& operator<<(wxInt16 c); | |
76 | wxTextOutputStream& operator<<(wxInt32 c); | |
77 | wxTextOutputStream& operator<<(wxUint16 c); | |
78 | wxTextOutputStream& operator<<(wxUint32 c); | |
79 | wxTextOutputStream& operator<<(double f); | |
80 | wxTextOutputStream& operator<<(float f); | |
81 | ||
82 | wxTextOutputStream& operator<<( __wxTextOutputManip func) { return func(*this); } | |
83 | ||
84 | protected: | |
85 | wxOutputStream *m_output; | |
86 | }; | |
87 | ||
88 | #endif | |
89 | // wxUSE_STREAMS | |
90 | ||
91 | #endif | |
92 | // _WX_DATSTREAM_H_ |