]> git.saurik.com Git - wxWidgets.git/blob - include/wx/datstrm.h
compilation fix for cygwin
[wxWidgets.git] / include / wx / datstrm.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: datstrm.h
3 // Purpose: Data stream classes
4 // Author: Guilhem Lavaux
5 // Modified by:
6 // Created: 28/06/1998
7 // RCS-ID: $Id$
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DATSTREAM_H_
13 #define _WX_DATSTREAM_H_
14
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "datstrm.h"
17 #endif
18
19 #include "wx/stream.h"
20 #include "wx/longlong.h"
21 #include "wx/strconv.h"
22
23 #if wxUSE_STREAMS
24
25 class WXDLLEXPORT wxDataInputStream
26 {
27 public:
28 #if wxUSE_UNICODE
29 wxDataInputStream(wxInputStream& s, wxMBConv& conv = wxConvUTF8);
30 #else
31 wxDataInputStream(wxInputStream& s);
32 #endif
33 ~wxDataInputStream();
34
35 bool IsOk() { return m_input->IsOk(); }
36
37 wxUint64 Read64();
38 wxUint32 Read32();
39 wxUint16 Read16();
40 wxUint8 Read8();
41 double ReadDouble();
42 wxString ReadString();
43
44 wxDataInputStream& operator>>(wxString& s);
45 wxDataInputStream& operator>>(wxInt8& c);
46 wxDataInputStream& operator>>(wxInt16& i);
47 wxDataInputStream& operator>>(wxInt32& i);
48 wxDataInputStream& operator>>(wxUint8& c);
49 wxDataInputStream& operator>>(wxUint16& i);
50 wxDataInputStream& operator>>(wxUint32& i);
51 wxDataInputStream& operator>>(wxUint64& i);
52 wxDataInputStream& operator>>(double& i);
53 wxDataInputStream& operator>>(float& f);
54
55 void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
56
57 protected:
58 wxInputStream *m_input;
59 bool m_be_order;
60 #if wxUSE_UNICODE
61 wxMBConv& m_conv;
62 #endif
63 };
64
65 class WXDLLEXPORT wxDataOutputStream
66 {
67 public:
68 #if wxUSE_UNICODE
69 wxDataOutputStream(wxOutputStream& s, wxMBConv& conv = wxConvUTF8);
70 #else
71 wxDataOutputStream(wxOutputStream& s);
72 #endif
73 ~wxDataOutputStream();
74
75 bool IsOk() { return m_output->IsOk(); }
76
77 void Write64(wxUint64 i);
78 void Write32(wxUint32 i);
79 void Write16(wxUint16 i);
80 void Write8(wxUint8 i);
81 void WriteDouble(double d);
82 void WriteString(const wxString& string);
83
84 wxDataOutputStream& operator<<(const wxChar *string);
85 wxDataOutputStream& operator<<(const wxString& string);
86 wxDataOutputStream& operator<<(wxInt8 c);
87 wxDataOutputStream& operator<<(wxInt16 i);
88 wxDataOutputStream& operator<<(wxInt32 i);
89 wxDataOutputStream& operator<<(wxUint8 c);
90 wxDataOutputStream& operator<<(wxUint16 i);
91 wxDataOutputStream& operator<<(wxUint32 i);
92 wxDataOutputStream& operator<<(wxUint64 i);
93 wxDataOutputStream& operator<<(double f);
94 wxDataOutputStream& operator<<(float f);
95
96 void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
97
98 protected:
99 wxOutputStream *m_output;
100 bool m_be_order;
101 #if wxUSE_UNICODE
102 wxMBConv& m_conv;
103 #endif
104 };
105
106 #endif
107 // wxUSE_STREAMS
108
109 #endif
110 // _WX_DATSTREAM_H_