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 // Common wxDataInputStream and wxDataOutputStream parameters.
22 class WXDLLIMPEXP_BASE wxDataStreamBase
25 void BigEndianOrdered(bool be_order
) { m_be_order
= be_order
; }
28 void SetConv( const wxMBConv
&conv
);
29 wxMBConv
*GetConv() const { return m_conv
; }
33 // Ctor and dtor are both protected, this class is never used directly but
34 // only by its derived classes.
35 wxDataStreamBase(const wxMBConv
& conv
);
45 wxDECLARE_NO_COPY_CLASS(wxDataStreamBase
);
49 class WXDLLIMPEXP_BASE wxDataInputStream
: public wxDataStreamBase
52 wxDataInputStream(wxInputStream
& s
, const wxMBConv
& conv
= wxConvUTF8
);
54 bool IsOk() { return m_input
->IsOk(); }
66 wxString
ReadString();
69 void Read64(wxUint64
*buffer
, size_t size
);
70 void Read64(wxInt64
*buffer
, size_t size
);
72 #if defined(wxLongLong_t) && wxUSE_LONGLONG
73 void Read64(wxULongLong
*buffer
, size_t size
);
74 void Read64(wxLongLong
*buffer
, size_t size
);
77 void ReadLL(wxULongLong
*buffer
, size_t size
);
78 void ReadLL(wxLongLong
*buffer
, size_t size
);
80 void Read32(wxUint32
*buffer
, size_t size
);
81 void Read16(wxUint16
*buffer
, size_t size
);
82 void Read8(wxUint8
*buffer
, size_t size
);
83 void ReadDouble(double *buffer
, size_t size
);
85 wxDataInputStream
& operator>>(wxString
& s
);
86 wxDataInputStream
& operator>>(wxInt8
& c
);
87 wxDataInputStream
& operator>>(wxInt16
& i
);
88 wxDataInputStream
& operator>>(wxInt32
& i
);
89 wxDataInputStream
& operator>>(wxUint8
& c
);
90 wxDataInputStream
& operator>>(wxUint16
& i
);
91 wxDataInputStream
& operator>>(wxUint32
& i
);
93 wxDataInputStream
& operator>>(wxUint64
& i
);
94 wxDataInputStream
& operator>>(wxInt64
& i
);
96 #if defined(wxLongLong_t) && wxUSE_LONGLONG
97 wxDataInputStream
& operator>>(wxULongLong
& i
);
98 wxDataInputStream
& operator>>(wxLongLong
& i
);
100 wxDataInputStream
& operator>>(double& i
);
101 wxDataInputStream
& operator>>(float& f
);
104 wxInputStream
*m_input
;
106 wxDECLARE_NO_COPY_CLASS(wxDataInputStream
);
109 class WXDLLIMPEXP_BASE wxDataOutputStream
: public wxDataStreamBase
112 wxDataOutputStream(wxOutputStream
& s
, const wxMBConv
& conv
= wxConvUTF8
);
114 bool IsOk() { return m_output
->IsOk(); }
117 void Write64(wxUint64 i
);
118 void Write64(wxInt64 i
);
121 void WriteLL(const wxLongLong
&ll
);
122 void WriteLL(const wxULongLong
&ll
);
124 void Write32(wxUint32 i
);
125 void Write16(wxUint16 i
);
126 void Write8(wxUint8 i
);
127 void WriteDouble(double d
);
128 void WriteString(const wxString
& string
);
131 void Write64(const wxUint64
*buffer
, size_t size
);
132 void Write64(const wxInt64
*buffer
, size_t size
);
134 #if defined(wxLongLong_t) && wxUSE_LONGLONG
135 void Write64(const wxULongLong
*buffer
, size_t size
);
136 void Write64(const wxLongLong
*buffer
, size_t size
);
139 void WriteLL(const wxULongLong
*buffer
, size_t size
);
140 void WriteLL(const wxLongLong
*buffer
, size_t size
);
142 void Write32(const wxUint32
*buffer
, size_t size
);
143 void Write16(const wxUint16
*buffer
, size_t size
);
144 void Write8(const wxUint8
*buffer
, size_t size
);
145 void WriteDouble(const double *buffer
, size_t size
);
147 wxDataOutputStream
& operator<<(const wxString
& string
);
148 wxDataOutputStream
& operator<<(wxInt8 c
);
149 wxDataOutputStream
& operator<<(wxInt16 i
);
150 wxDataOutputStream
& operator<<(wxInt32 i
);
151 wxDataOutputStream
& operator<<(wxUint8 c
);
152 wxDataOutputStream
& operator<<(wxUint16 i
);
153 wxDataOutputStream
& operator<<(wxUint32 i
);
155 wxDataOutputStream
& operator<<(wxUint64 i
);
156 wxDataOutputStream
& operator<<(wxInt64 i
);
158 #if defined(wxLongLong_t) && wxUSE_LONGLONG
159 wxDataOutputStream
& operator<<(const wxULongLong
&i
);
160 wxDataOutputStream
& operator<<(const wxLongLong
&i
);
162 wxDataOutputStream
& operator<<(double f
);
163 wxDataOutputStream
& operator<<(float f
);
166 wxOutputStream
*m_output
;
168 wxDECLARE_NO_COPY_CLASS(wxDataOutputStream
);