]>
Commit | Line | Data |
---|---|---|
cf447356 GL |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: datstrm.h | |
3 | // Purpose: Data stream classes | |
4 | // Author: Guilhem Lavaux | |
53663be8 | 5 | // Modified by: Mickael Gilabert |
cf447356 GL |
6 | // Created: 28/06/1998 |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Guilhem Lavaux | |
68379eaf | 9 | // Licence: wxWindows licence |
cf447356 GL |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
34138703 JS |
12 | #ifndef _WX_DATSTREAM_H_ |
13 | #define _WX_DATSTREAM_H_ | |
cf447356 | 14 | |
ed58dbea | 15 | #include "wx/stream.h" |
41b0a113 | 16 | #include "wx/longlong.h" |
a99acbb0 | 17 | #include "wx/strconv.h" |
cf447356 | 18 | |
ce4169a4 RR |
19 | #if wxUSE_STREAMS |
20 | ||
bddd7a8d | 21 | class WXDLLIMPEXP_BASE wxDataInputStream |
4c075b70 | 22 | { |
cf447356 | 23 | public: |
a99acbb0 VS |
24 | #if wxUSE_UNICODE |
25 | wxDataInputStream(wxInputStream& s, wxMBConv& conv = wxConvUTF8); | |
26 | #else | |
4c075b70 | 27 | wxDataInputStream(wxInputStream& s); |
a99acbb0 | 28 | #endif |
e4a4a50b | 29 | ~wxDataInputStream(){} |
68379eaf | 30 | |
7eb0e037 | 31 | bool IsOk() { return m_input->IsOk(); } |
cf447356 | 32 | |
41b0a113 | 33 | wxUint64 Read64(); |
4c075b70 RR |
34 | wxUint32 Read32(); |
35 | wxUint16 Read16(); | |
36 | wxUint8 Read8(); | |
37 | double ReadDouble(); | |
38 | wxString ReadString(); | |
fae05df5 | 39 | |
53663be8 VZ |
40 | void Read64(wxUint64 *buffer, size_t size); |
41 | void Read32(wxUint32 *buffer, size_t size); | |
42 | void Read16(wxUint16 *buffer, size_t size); | |
43 | void Read8(wxUint8 *buffer, size_t size); | |
44 | void ReadDouble(double *buffer, size_t size); | |
45 | ||
4c075b70 RR |
46 | wxDataInputStream& operator>>(wxString& s); |
47 | wxDataInputStream& operator>>(wxInt8& c); | |
48 | wxDataInputStream& operator>>(wxInt16& i); | |
49 | wxDataInputStream& operator>>(wxInt32& i); | |
50 | wxDataInputStream& operator>>(wxUint8& c); | |
51 | wxDataInputStream& operator>>(wxUint16& i); | |
52 | wxDataInputStream& operator>>(wxUint32& i); | |
41b0a113 | 53 | wxDataInputStream& operator>>(wxUint64& i); |
4c075b70 RR |
54 | wxDataInputStream& operator>>(double& i); |
55 | wxDataInputStream& operator>>(float& f); | |
5a96d2f4 | 56 | |
4c075b70 | 57 | void BigEndianOrdered(bool be_order) { m_be_order = be_order; } |
38caaa61 | 58 | |
4c075b70 RR |
59 | protected: |
60 | wxInputStream *m_input; | |
61 | bool m_be_order; | |
a99acbb0 VS |
62 | #if wxUSE_UNICODE |
63 | wxMBConv& m_conv; | |
64 | #endif | |
22f3361e VZ |
65 | |
66 | DECLARE_NO_COPY_CLASS(wxDataInputStream) | |
3d4c6a21 GL |
67 | }; |
68 | ||
bddd7a8d | 69 | class WXDLLIMPEXP_BASE wxDataOutputStream |
4c075b70 RR |
70 | { |
71 | public: | |
a99acbb0 VS |
72 | #if wxUSE_UNICODE |
73 | wxDataOutputStream(wxOutputStream& s, wxMBConv& conv = wxConvUTF8); | |
74 | #else | |
4c075b70 | 75 | wxDataOutputStream(wxOutputStream& s); |
a99acbb0 | 76 | #endif |
e4a4a50b | 77 | ~wxDataOutputStream(){} |
cf447356 | 78 | |
7eb0e037 RR |
79 | bool IsOk() { return m_output->IsOk(); } |
80 | ||
41b0a113 | 81 | void Write64(wxUint64 i); |
4c075b70 RR |
82 | void Write32(wxUint32 i); |
83 | void Write16(wxUint16 i); | |
84 | void Write8(wxUint8 i); | |
85 | void WriteDouble(double d); | |
86 | void WriteString(const wxString& string); | |
fae05df5 | 87 | |
53663be8 VZ |
88 | void Write64(const wxUint64 *buffer, size_t size); |
89 | void Write32(const wxUint32 *buffer, size_t size); | |
90 | void Write16(const wxUint16 *buffer, size_t size); | |
91 | void Write8(const wxUint8 *buffer, size_t size); | |
92 | void WriteDouble(const double *buffer, size_t size); | |
93 | ||
4c075b70 | 94 | wxDataOutputStream& operator<<(const wxChar *string); |
38caaa61 | 95 | wxDataOutputStream& operator<<(const wxString& string); |
4c075b70 RR |
96 | wxDataOutputStream& operator<<(wxInt8 c); |
97 | wxDataOutputStream& operator<<(wxInt16 i); | |
98 | wxDataOutputStream& operator<<(wxInt32 i); | |
99 | wxDataOutputStream& operator<<(wxUint8 c); | |
100 | wxDataOutputStream& operator<<(wxUint16 i); | |
101 | wxDataOutputStream& operator<<(wxUint32 i); | |
41b0a113 | 102 | wxDataOutputStream& operator<<(wxUint64 i); |
4c075b70 RR |
103 | wxDataOutputStream& operator<<(double f); |
104 | wxDataOutputStream& operator<<(float f); | |
fae05df5 | 105 | |
38caaa61 KB |
106 | void BigEndianOrdered(bool be_order) { m_be_order = be_order; } |
107 | ||
4c075b70 RR |
108 | protected: |
109 | wxOutputStream *m_output; | |
110 | bool m_be_order; | |
a99acbb0 VS |
111 | #if wxUSE_UNICODE |
112 | wxMBConv& m_conv; | |
113 | #endif | |
22f3361e VZ |
114 | |
115 | DECLARE_NO_COPY_CLASS(wxDataOutputStream) | |
cf447356 GL |
116 | }; |
117 | ||
ce4169a4 RR |
118 | #endif |
119 | // wxUSE_STREAMS | |
120 | ||
cf447356 | 121 | #endif |
34138703 | 122 | // _WX_DATSTREAM_H_ |