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/strconv.h"
21 class WXDLLIMPEXP_BASE wxDataInputStream
25 wxDataInputStream(wxInputStream
& s
, wxMBConv
& conv
= wxConvUTF8
);
27 wxDataInputStream(wxInputStream
& s
);
29 ~wxDataInputStream(){}
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 wxInputStream
*m_input
;
89 DECLARE_NO_COPY_CLASS(wxDataInputStream
)
92 class WXDLLIMPEXP_BASE wxDataOutputStream
96 wxDataOutputStream(wxOutputStream
& s
, wxMBConv
& conv
= wxConvUTF8
);
98 wxDataOutputStream(wxOutputStream
& s
);
100 ~wxDataOutputStream(){}
102 bool IsOk() { return m_output
->IsOk(); }
105 void Write64(wxUint64 i
);
106 void Write64(wxInt64 i
);
109 void WriteLL(const wxLongLong
&ll
);
110 void WriteLL(const wxULongLong
&ll
);
112 void Write32(wxUint32 i
);
113 void Write16(wxUint16 i
);
114 void Write8(wxUint8 i
);
115 void WriteDouble(double d
);
116 void WriteString(const wxString
& string
);
119 void Write64(const wxUint64
*buffer
, size_t size
);
120 void Write64(const wxInt64
*buffer
, size_t size
);
122 #if defined(wxLongLong_t) && wxUSE_LONGLONG
123 void Write64(const wxULongLong
*buffer
, size_t size
);
124 void Write64(const wxLongLong
*buffer
, size_t size
);
127 void WriteLL(const wxULongLong
*buffer
, size_t size
);
128 void WriteLL(const wxLongLong
*buffer
, size_t size
);
130 void Write32(const wxUint32
*buffer
, size_t size
);
131 void Write16(const wxUint16
*buffer
, size_t size
);
132 void Write8(const wxUint8
*buffer
, size_t size
);
133 void WriteDouble(const double *buffer
, size_t size
);
135 wxDataOutputStream
& operator<<(const wxChar
*string
);
136 wxDataOutputStream
& operator<<(const wxString
& string
);
137 wxDataOutputStream
& operator<<(wxInt8 c
);
138 wxDataOutputStream
& operator<<(wxInt16 i
);
139 wxDataOutputStream
& operator<<(wxInt32 i
);
140 wxDataOutputStream
& operator<<(wxUint8 c
);
141 wxDataOutputStream
& operator<<(wxUint16 i
);
142 wxDataOutputStream
& operator<<(wxUint32 i
);
144 wxDataOutputStream
& operator<<(wxUint64 i
);
145 wxDataOutputStream
& operator<<(wxInt64 i
);
147 #if defined(wxLongLong_t) && wxUSE_LONGLONG
148 wxDataOutputStream
& operator<<(const wxULongLong
&i
);
149 wxDataOutputStream
& operator<<(const wxLongLong
&i
);
151 wxDataOutputStream
& operator<<(double f
);
152 wxDataOutputStream
& operator<<(float f
);
154 void BigEndianOrdered(bool be_order
) { m_be_order
= be_order
; }
157 wxOutputStream
*m_output
;
163 DECLARE_NO_COPY_CLASS(wxDataOutputStream
)