]>
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, const wxString &sep=wxT(" \t")); | |
34 | ~wxTextInputStream(); | |
35 | ||
36 | wxUint32 Read32(); | |
37 | wxUint16 Read16(); | |
38 | wxUint8 Read8(); | |
39 | double ReadDouble(); | |
40 | wxString ReadString(); // deprecated use ReadLine or ReadWord instead | |
41 | wxString ReadLine(); | |
42 | wxString ReadWord(); | |
43 | ||
44 | wxString GetStringSeparators() const { return m_separators;} | |
45 | void SetStringSeparators(const wxString &c) { m_separators=c;} | |
46 | ||
47 | // Operators | |
48 | wxTextInputStream& operator>>(wxString& word); | |
49 | wxTextInputStream& operator>>(wxChar& c); | |
50 | wxTextInputStream& operator>>(wxInt16& i); | |
51 | wxTextInputStream& operator>>(wxInt32& i); | |
52 | wxTextInputStream& operator>>(wxUint16& i); | |
53 | wxTextInputStream& operator>>(wxUint32& i); | |
54 | wxTextInputStream& operator>>(double& i); | |
55 | wxTextInputStream& operator>>(float& f); | |
56 | ||
57 | wxTextInputStream& operator>>( __wxTextInputManip func) { return func(*this); } | |
58 | ||
59 | protected: | |
60 | wxInputStream &m_input; | |
61 | wxString m_separators; | |
62 | ||
63 | bool EatEOL(const wxChar &c); | |
64 | wxChar NextNonSeparators(); | |
65 | void SkipIfEndOfLine( wxChar c ); | |
66 | }; | |
67 | ||
68 | class WXDLLEXPORT wxTextOutputStream { | |
69 | public: | |
70 | wxTextOutputStream(wxOutputStream& s); | |
71 | ~wxTextOutputStream(); | |
72 | ||
73 | void Write32(wxUint32 i); | |
74 | void Write16(wxUint16 i); | |
75 | void Write8(wxUint8 i); | |
76 | void WriteDouble(double d); | |
77 | void WriteString(const wxString& string); | |
78 | ||
79 | wxTextOutputStream& operator<<(const wxChar *string); | |
80 | wxTextOutputStream& operator<<(const wxString& string); | |
81 | wxTextOutputStream& operator<<(wxChar c); | |
82 | wxTextOutputStream& operator<<(wxInt16 c); | |
83 | wxTextOutputStream& operator<<(wxInt32 c); | |
84 | wxTextOutputStream& operator<<(wxUint16 c); | |
85 | wxTextOutputStream& operator<<(wxUint32 c); | |
86 | wxTextOutputStream& operator<<(double f); | |
87 | wxTextOutputStream& operator<<(float f); | |
88 | ||
89 | wxTextOutputStream& operator<<( __wxTextOutputManip func) { return func(*this); } | |
90 | ||
91 | protected: | |
92 | wxOutputStream &m_output; | |
93 | }; | |
94 | ||
95 | #endif | |
96 | // wxUSE_STREAMS | |
97 | ||
98 | #endif | |
99 | // _WX_DATSTREAM_H_ |