]> git.saurik.com Git - wxWidgets.git/blob - include/wx/datstrm.h
allow raw access to a part of the image only (faster when using alpha)
[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 licence
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 DECLARE_NO_COPY_CLASS(wxDataInputStream)
65 };
66
67 class WXDLLEXPORT wxDataOutputStream
68 {
69 public:
70 #if wxUSE_UNICODE
71 wxDataOutputStream(wxOutputStream& s, wxMBConv& conv = wxConvUTF8);
72 #else
73 wxDataOutputStream(wxOutputStream& s);
74 #endif
75 ~wxDataOutputStream();
76
77 bool IsOk() { return m_output->IsOk(); }
78
79 void Write64(wxUint64 i);
80 void Write32(wxUint32 i);
81 void Write16(wxUint16 i);
82 void Write8(wxUint8 i);
83 void WriteDouble(double d);
84 void WriteString(const wxString& string);
85
86 wxDataOutputStream& operator<<(const wxChar *string);
87 wxDataOutputStream& operator<<(const wxString& string);
88 wxDataOutputStream& operator<<(wxInt8 c);
89 wxDataOutputStream& operator<<(wxInt16 i);
90 wxDataOutputStream& operator<<(wxInt32 i);
91 wxDataOutputStream& operator<<(wxUint8 c);
92 wxDataOutputStream& operator<<(wxUint16 i);
93 wxDataOutputStream& operator<<(wxUint32 i);
94 wxDataOutputStream& operator<<(wxUint64 i);
95 wxDataOutputStream& operator<<(double f);
96 wxDataOutputStream& operator<<(float f);
97
98 void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
99
100 protected:
101 wxOutputStream *m_output;
102 bool m_be_order;
103 #if wxUSE_UNICODE
104 wxMBConv& m_conv;
105 #endif
106
107 DECLARE_NO_COPY_CLASS(wxDataOutputStream)
108 };
109
110 #endif
111 // wxUSE_STREAMS
112
113 #endif
114 // _WX_DATSTREAM_H_