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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "datstrm.h"
19 #include "wx/stream.h"
20 #include "wx/longlong.h"
21 #include "wx/strconv.h"
25 class WXDLLIMPEXP_BASE wxDataInputStream
29 wxDataInputStream(wxInputStream
& s
, wxMBConv
& conv
= wxConvUTF8
);
31 wxDataInputStream(wxInputStream
& s
);
35 bool IsOk() { return m_input
->IsOk(); }
42 wxString
ReadString();
44 void Read64(wxUint64
*buffer
, size_t size
);
45 void Read32(wxUint32
*buffer
, size_t size
);
46 void Read16(wxUint16
*buffer
, size_t size
);
47 void Read8(wxUint8
*buffer
, size_t size
);
48 void ReadDouble(double *buffer
, size_t size
);
50 wxDataInputStream
& operator>>(wxString
& s
);
51 wxDataInputStream
& operator>>(wxInt8
& c
);
52 wxDataInputStream
& operator>>(wxInt16
& i
);
53 wxDataInputStream
& operator>>(wxInt32
& i
);
54 wxDataInputStream
& operator>>(wxUint8
& c
);
55 wxDataInputStream
& operator>>(wxUint16
& i
);
56 wxDataInputStream
& operator>>(wxUint32
& i
);
57 wxDataInputStream
& operator>>(wxUint64
& i
);
58 wxDataInputStream
& operator>>(double& i
);
59 wxDataInputStream
& operator>>(float& f
);
61 void BigEndianOrdered(bool be_order
) { m_be_order
= be_order
; }
64 wxInputStream
*m_input
;
70 DECLARE_NO_COPY_CLASS(wxDataInputStream
)
73 class WXDLLIMPEXP_BASE wxDataOutputStream
77 wxDataOutputStream(wxOutputStream
& s
, wxMBConv
& conv
= wxConvUTF8
);
79 wxDataOutputStream(wxOutputStream
& s
);
81 ~wxDataOutputStream();
83 bool IsOk() { return m_output
->IsOk(); }
85 void Write64(wxUint64 i
);
86 void Write32(wxUint32 i
);
87 void Write16(wxUint16 i
);
88 void Write8(wxUint8 i
);
89 void WriteDouble(double d
);
90 void WriteString(const wxString
& string
);
92 void Write64(const wxUint64
*buffer
, size_t size
);
93 void Write32(const wxUint32
*buffer
, size_t size
);
94 void Write16(const wxUint16
*buffer
, size_t size
);
95 void Write8(const wxUint8
*buffer
, size_t size
);
96 void WriteDouble(const double *buffer
, size_t size
);
98 wxDataOutputStream
& operator<<(const wxChar
*string
);
99 wxDataOutputStream
& operator<<(const wxString
& string
);
100 wxDataOutputStream
& operator<<(wxInt8 c
);
101 wxDataOutputStream
& operator<<(wxInt16 i
);
102 wxDataOutputStream
& operator<<(wxInt32 i
);
103 wxDataOutputStream
& operator<<(wxUint8 c
);
104 wxDataOutputStream
& operator<<(wxUint16 i
);
105 wxDataOutputStream
& operator<<(wxUint32 i
);
106 wxDataOutputStream
& operator<<(wxUint64 i
);
107 wxDataOutputStream
& operator<<(double f
);
108 wxDataOutputStream
& operator<<(float f
);
110 void BigEndianOrdered(bool be_order
) { m_be_order
= be_order
; }
113 wxOutputStream
*m_output
;
119 DECLARE_NO_COPY_CLASS(wxDataOutputStream
)