1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Data stream classes
4 // Author: Guilhem Lavaux
5 // Modified by: Mickael Gilabert
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_DATSTREAM_H_
13 #define _WX_DATSTREAM_H_
15 #include "wx/stream.h"
16 #include "wx/longlong.h"
17 #include "wx/convauto.h"
21 class WXDLLIMPEXP_BASE wxDataInputStream
25 wxDataInputStream(wxInputStream
& s
, const wxMBConv
& conv
= wxConvUTF8
);
27 wxDataInputStream(wxInputStream
& s
);
31 bool IsOk() { return m_input
->IsOk(); }
43 wxString
ReadString();
46 void Read64(wxUint64
*buffer
, size_t size
);
47 void Read64(wxInt64
*buffer
, size_t size
);
49 #if defined(wxLongLong_t) && wxUSE_LONGLONG
50 void Read64(wxULongLong
*buffer
, size_t size
);
51 void Read64(wxLongLong
*buffer
, size_t size
);
54 void ReadLL(wxULongLong
*buffer
, size_t size
);
55 void ReadLL(wxLongLong
*buffer
, size_t size
);
57 void Read32(wxUint32
*buffer
, size_t size
);
58 void Read16(wxUint16
*buffer
, size_t size
);
59 void Read8(wxUint8
*buffer
, size_t size
);
60 void ReadDouble(double *buffer
, size_t size
);
62 wxDataInputStream
& operator>>(wxString
& s
);
63 wxDataInputStream
& operator>>(wxInt8
& c
);
64 wxDataInputStream
& operator>>(wxInt16
& i
);
65 wxDataInputStream
& operator>>(wxInt32
& i
);
66 wxDataInputStream
& operator>>(wxUint8
& c
);
67 wxDataInputStream
& operator>>(wxUint16
& i
);
68 wxDataInputStream
& operator>>(wxUint32
& i
);
70 wxDataInputStream
& operator>>(wxUint64
& i
);
71 wxDataInputStream
& operator>>(wxInt64
& i
);
73 #if defined(wxLongLong_t) && wxUSE_LONGLONG
74 wxDataInputStream
& operator>>(wxULongLong
& i
);
75 wxDataInputStream
& operator>>(wxLongLong
& i
);
77 wxDataInputStream
& operator>>(double& i
);
78 wxDataInputStream
& operator>>(float& f
);
80 void BigEndianOrdered(bool be_order
) { m_be_order
= be_order
; }
83 void SetConv( const wxMBConv
&conv
);
84 wxMBConv
*GetConv() const { return m_conv
; }
88 wxInputStream
*m_input
;
94 wxDECLARE_NO_COPY_CLASS(wxDataInputStream
);
97 class WXDLLIMPEXP_BASE wxDataOutputStream
101 wxDataOutputStream(wxOutputStream
& s
, const wxMBConv
& conv
= wxConvUTF8
);
103 wxDataOutputStream(wxOutputStream
& s
);
105 ~wxDataOutputStream();
107 bool IsOk() { return m_output
->IsOk(); }
110 void Write64(wxUint64 i
);
111 void Write64(wxInt64 i
);
114 void WriteLL(const wxLongLong
&ll
);
115 void WriteLL(const wxULongLong
&ll
);
117 void Write32(wxUint32 i
);
118 void Write16(wxUint16 i
);
119 void Write8(wxUint8 i
);
120 void WriteDouble(double d
);
121 void WriteString(const wxString
& string
);
124 void Write64(const wxUint64
*buffer
, size_t size
);
125 void Write64(const wxInt64
*buffer
, size_t size
);
127 #if defined(wxLongLong_t) && wxUSE_LONGLONG
128 void Write64(const wxULongLong
*buffer
, size_t size
);
129 void Write64(const wxLongLong
*buffer
, size_t size
);
132 void WriteLL(const wxULongLong
*buffer
, size_t size
);
133 void WriteLL(const wxLongLong
*buffer
, size_t size
);
135 void Write32(const wxUint32
*buffer
, size_t size
);
136 void Write16(const wxUint16
*buffer
, size_t size
);
137 void Write8(const wxUint8
*buffer
, size_t size
);
138 void WriteDouble(const double *buffer
, size_t size
);
140 wxDataOutputStream
& operator<<(const wxString
& string
);
141 wxDataOutputStream
& operator<<(wxInt8 c
);
142 wxDataOutputStream
& operator<<(wxInt16 i
);
143 wxDataOutputStream
& operator<<(wxInt32 i
);
144 wxDataOutputStream
& operator<<(wxUint8 c
);
145 wxDataOutputStream
& operator<<(wxUint16 i
);
146 wxDataOutputStream
& operator<<(wxUint32 i
);
148 wxDataOutputStream
& operator<<(wxUint64 i
);
149 wxDataOutputStream
& operator<<(wxInt64 i
);
151 #if defined(wxLongLong_t) && wxUSE_LONGLONG
152 wxDataOutputStream
& operator<<(const wxULongLong
&i
);
153 wxDataOutputStream
& operator<<(const wxLongLong
&i
);
155 wxDataOutputStream
& operator<<(double f
);
156 wxDataOutputStream
& operator<<(float f
);
158 void BigEndianOrdered(bool be_order
) { m_be_order
= be_order
; }
161 void SetConv( const wxMBConv
&conv
);
162 wxMBConv
*GetConv() const { return m_conv
; }
166 wxOutputStream
*m_output
;
172 wxDECLARE_NO_COPY_CLASS(wxDataOutputStream
);