]>
Commit | Line | Data |
---|---|---|
cf447356 GL |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: datstrm.h | |
3 | // Purpose: Data 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 | ||
34138703 JS |
12 | #ifndef _WX_DATSTREAM_H_ |
13 | #define _WX_DATSTREAM_H_ | |
cf447356 GL |
14 | |
15 | #ifdef __GNUG__ | |
16 | #pragma interface "datstrm.h" | |
17 | #endif | |
18 | ||
ed58dbea | 19 | #include "wx/stream.h" |
41b0a113 | 20 | #include "wx/longlong.h" |
a99acbb0 | 21 | #include "wx/strconv.h" |
cf447356 | 22 | |
ce4169a4 RR |
23 | #if wxUSE_STREAMS |
24 | ||
4c075b70 RR |
25 | class WXDLLEXPORT wxDataInputStream |
26 | { | |
cf447356 | 27 | public: |
a99acbb0 VS |
28 | #if wxUSE_UNICODE |
29 | wxDataInputStream(wxInputStream& s, wxMBConv& conv = wxConvUTF8); | |
30 | #else | |
4c075b70 | 31 | wxDataInputStream(wxInputStream& s); |
a99acbb0 | 32 | #endif |
4c075b70 | 33 | ~wxDataInputStream(); |
7eb0e037 RR |
34 | |
35 | bool IsOk() { return m_input->IsOk(); } | |
cf447356 | 36 | |
41b0a113 | 37 | wxUint64 Read64(); |
4c075b70 RR |
38 | wxUint32 Read32(); |
39 | wxUint16 Read16(); | |
40 | wxUint8 Read8(); | |
41 | double ReadDouble(); | |
42 | wxString ReadString(); | |
fae05df5 | 43 | |
4c075b70 RR |
44 | wxDataInputStream& operator>>(wxString& s); |
45 | wxDataInputStream& operator>>(wxInt8& c); | |
46 | wxDataInputStream& operator>>(wxInt16& i); | |
47 | wxDataInputStream& operator>>(wxInt32& i); | |
48 | wxDataInputStream& operator>>(wxUint8& c); | |
49 | wxDataInputStream& operator>>(wxUint16& i); | |
50 | wxDataInputStream& operator>>(wxUint32& i); | |
41b0a113 | 51 | wxDataInputStream& operator>>(wxUint64& i); |
4c075b70 RR |
52 | wxDataInputStream& operator>>(double& i); |
53 | wxDataInputStream& operator>>(float& f); | |
5a96d2f4 | 54 | |
4c075b70 | 55 | void BigEndianOrdered(bool be_order) { m_be_order = be_order; } |
38caaa61 | 56 | |
4c075b70 RR |
57 | protected: |
58 | wxInputStream *m_input; | |
59 | bool m_be_order; | |
a99acbb0 VS |
60 | #if wxUSE_UNICODE |
61 | wxMBConv& m_conv; | |
62 | #endif | |
3d4c6a21 GL |
63 | }; |
64 | ||
4c075b70 RR |
65 | class WXDLLEXPORT wxDataOutputStream |
66 | { | |
67 | public: | |
a99acbb0 VS |
68 | #if wxUSE_UNICODE |
69 | wxDataOutputStream(wxOutputStream& s, wxMBConv& conv = wxConvUTF8); | |
70 | #else | |
4c075b70 | 71 | wxDataOutputStream(wxOutputStream& s); |
a99acbb0 | 72 | #endif |
4c075b70 | 73 | ~wxDataOutputStream(); |
cf447356 | 74 | |
7eb0e037 RR |
75 | bool IsOk() { return m_output->IsOk(); } |
76 | ||
41b0a113 | 77 | void Write64(wxUint64 i); |
4c075b70 RR |
78 | void Write32(wxUint32 i); |
79 | void Write16(wxUint16 i); | |
80 | void Write8(wxUint8 i); | |
81 | void WriteDouble(double d); | |
82 | void WriteString(const wxString& string); | |
fae05df5 | 83 | |
4c075b70 | 84 | wxDataOutputStream& operator<<(const wxChar *string); |
38caaa61 | 85 | wxDataOutputStream& operator<<(const wxString& string); |
4c075b70 RR |
86 | wxDataOutputStream& operator<<(wxInt8 c); |
87 | wxDataOutputStream& operator<<(wxInt16 i); | |
88 | wxDataOutputStream& operator<<(wxInt32 i); | |
89 | wxDataOutputStream& operator<<(wxUint8 c); | |
90 | wxDataOutputStream& operator<<(wxUint16 i); | |
91 | wxDataOutputStream& operator<<(wxUint32 i); | |
41b0a113 | 92 | wxDataOutputStream& operator<<(wxUint64 i); |
4c075b70 RR |
93 | wxDataOutputStream& operator<<(double f); |
94 | wxDataOutputStream& operator<<(float f); | |
fae05df5 | 95 | |
38caaa61 KB |
96 | void BigEndianOrdered(bool be_order) { m_be_order = be_order; } |
97 | ||
4c075b70 RR |
98 | protected: |
99 | wxOutputStream *m_output; | |
100 | bool m_be_order; | |
a99acbb0 VS |
101 | #if wxUSE_UNICODE |
102 | wxMBConv& m_conv; | |
103 | #endif | |
cf447356 GL |
104 | }; |
105 | ||
ce4169a4 RR |
106 | #endif |
107 | // wxUSE_STREAMS | |
108 | ||
cf447356 | 109 | #endif |
34138703 | 110 | // _WX_DATSTREAM_H_ |