]> git.saurik.com Git - wxWidgets.git/blob - include/wx/datstrm.h
Do not reintroduce #pragma interface/implementation for html/helpdlg and mediactrl...
[wxWidgets.git] / include / wx / datstrm.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: datstrm.h
3 // Purpose: Data stream classes
4 // Author: Guilhem Lavaux
5 // Modified by: Mickael Gilabert
6 // Created: 28/06/1998
7 // RCS-ID: $Id$
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DATSTREAM_H_
13 #define _WX_DATSTREAM_H_
14
15 #include "wx/stream.h"
16 #include "wx/longlong.h"
17 #include "wx/strconv.h"
18
19 #if wxUSE_STREAMS
20
21 class WXDLLIMPEXP_BASE wxDataInputStream
22 {
23 public:
24 #if wxUSE_UNICODE
25 wxDataInputStream(wxInputStream& s, wxMBConv& conv = wxConvUTF8);
26 #else
27 wxDataInputStream(wxInputStream& s);
28 #endif
29 ~wxDataInputStream(){}
30
31 bool IsOk() { return m_input->IsOk(); }
32
33 wxUint64 Read64();
34 wxUint32 Read32();
35 wxUint16 Read16();
36 wxUint8 Read8();
37 double ReadDouble();
38 wxString ReadString();
39
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
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);
53 wxDataInputStream& operator>>(wxUint64& i);
54 wxDataInputStream& operator>>(double& i);
55 wxDataInputStream& operator>>(float& f);
56
57 void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
58
59 protected:
60 wxInputStream *m_input;
61 bool m_be_order;
62 #if wxUSE_UNICODE
63 wxMBConv& m_conv;
64 #endif
65
66 DECLARE_NO_COPY_CLASS(wxDataInputStream)
67 };
68
69 class WXDLLIMPEXP_BASE wxDataOutputStream
70 {
71 public:
72 #if wxUSE_UNICODE
73 wxDataOutputStream(wxOutputStream& s, wxMBConv& conv = wxConvUTF8);
74 #else
75 wxDataOutputStream(wxOutputStream& s);
76 #endif
77 ~wxDataOutputStream(){}
78
79 bool IsOk() { return m_output->IsOk(); }
80
81 void Write64(wxUint64 i);
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);
87
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
94 wxDataOutputStream& operator<<(const wxChar *string);
95 wxDataOutputStream& operator<<(const wxString& string);
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);
102 wxDataOutputStream& operator<<(wxUint64 i);
103 wxDataOutputStream& operator<<(double f);
104 wxDataOutputStream& operator<<(float f);
105
106 void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
107
108 protected:
109 wxOutputStream *m_output;
110 bool m_be_order;
111 #if wxUSE_UNICODE
112 wxMBConv& m_conv;
113 #endif
114
115 DECLARE_NO_COPY_CLASS(wxDataOutputStream)
116 };
117
118 #endif
119 // wxUSE_STREAMS
120
121 #endif
122 // _WX_DATSTREAM_H_