]> git.saurik.com Git - wxWidgets.git/blob - include/wx/datstrm.h
added raw key code and flags support (based on patch from Bryce Denney)
[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 #ifdef __GNUG__
16 #pragma interface "datstrm.h"
17 #endif
18
19 #include "wx/stream.h"
20 #include "wx/longlong.h"
21
22 #if wxUSE_STREAMS
23
24 class WXDLLEXPORT wxDataInputStream
25 {
26 public:
27 wxDataInputStream(wxInputStream& s);
28 ~wxDataInputStream();
29
30 bool IsOk() { return m_input->IsOk(); }
31
32 wxUint64 Read64();
33 wxUint32 Read32();
34 wxUint16 Read16();
35 wxUint8 Read8();
36 double ReadDouble();
37 wxString ReadString();
38
39 wxDataInputStream& operator>>(wxString& s);
40 wxDataInputStream& operator>>(wxInt8& c);
41 wxDataInputStream& operator>>(wxInt16& i);
42 wxDataInputStream& operator>>(wxInt32& i);
43 wxDataInputStream& operator>>(wxUint8& c);
44 wxDataInputStream& operator>>(wxUint16& i);
45 wxDataInputStream& operator>>(wxUint32& i);
46 wxDataInputStream& operator>>(wxUint64& i);
47 wxDataInputStream& operator>>(double& i);
48 wxDataInputStream& operator>>(float& f);
49
50 void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
51
52 protected:
53 wxInputStream *m_input;
54 bool m_be_order;
55 };
56
57 class WXDLLEXPORT wxDataOutputStream
58 {
59 public:
60 wxDataOutputStream(wxOutputStream& s);
61 ~wxDataOutputStream();
62
63 bool IsOk() { return m_output->IsOk(); }
64
65 void Write64(wxUint64 i);
66 void Write32(wxUint32 i);
67 void Write16(wxUint16 i);
68 void Write8(wxUint8 i);
69 void WriteDouble(double d);
70 void WriteString(const wxString& string);
71
72 wxDataOutputStream& operator<<(const wxChar *string);
73 wxDataOutputStream& operator<<(const wxString& string);
74 wxDataOutputStream& operator<<(wxInt8 c);
75 wxDataOutputStream& operator<<(wxInt16 i);
76 wxDataOutputStream& operator<<(wxInt32 i);
77 wxDataOutputStream& operator<<(wxUint8 c);
78 wxDataOutputStream& operator<<(wxUint16 i);
79 wxDataOutputStream& operator<<(wxUint32 i);
80 wxDataOutputStream& operator<<(wxUint64 i);
81 wxDataOutputStream& operator<<(double f);
82 wxDataOutputStream& operator<<(float f);
83
84 void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
85
86 protected:
87 wxOutputStream *m_output;
88 bool m_be_order;
89 };
90
91 #endif
92 // wxUSE_STREAMS
93
94 #endif
95 // _WX_DATSTREAM_H_