]> git.saurik.com Git - wxWidgets.git/blob - include/wx/datstrm.h
use wxTextEntry in wxTextValidator (modified patch 1821743)
[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/convauto.h"
18
19 #if wxUSE_STREAMS
20
21 class WXDLLIMPEXP_BASE wxDataInputStream
22 {
23 public:
24 #if wxUSE_UNICODE
25 wxDataInputStream(wxInputStream& s, const wxMBConv& conv = wxConvAuto());
26 #else
27 wxDataInputStream(wxInputStream& s);
28 #endif
29 ~wxDataInputStream();
30
31 bool IsOk() { return m_input->IsOk(); }
32
33 #if wxHAS_INT64
34 wxUint64 Read64();
35 #endif
36 #if wxUSE_LONGLONG
37 wxLongLong ReadLL();
38 #endif
39 wxUint32 Read32();
40 wxUint16 Read16();
41 wxUint8 Read8();
42 double ReadDouble();
43 wxString ReadString();
44
45 #if wxHAS_INT64
46 void Read64(wxUint64 *buffer, size_t size);
47 void Read64(wxInt64 *buffer, size_t size);
48 #endif
49 #if defined(wxLongLong_t) && wxUSE_LONGLONG
50 void Read64(wxULongLong *buffer, size_t size);
51 void Read64(wxLongLong *buffer, size_t size);
52 #endif
53 #if wxUSE_LONGLONG
54 void ReadLL(wxULongLong *buffer, size_t size);
55 void ReadLL(wxLongLong *buffer, size_t size);
56 #endif
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);
61
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);
69 #if wxHAS_INT64
70 wxDataInputStream& operator>>(wxUint64& i);
71 wxDataInputStream& operator>>(wxInt64& i);
72 #endif
73 #if defined(wxLongLong_t) && wxUSE_LONGLONG
74 wxDataInputStream& operator>>(wxULongLong& i);
75 wxDataInputStream& operator>>(wxLongLong& i);
76 #endif
77 wxDataInputStream& operator>>(double& i);
78 wxDataInputStream& operator>>(float& f);
79
80 void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
81
82 protected:
83 wxInputStream *m_input;
84 bool m_be_order;
85 #if wxUSE_UNICODE
86 wxMBConv *m_conv;
87 #endif
88
89 DECLARE_NO_COPY_CLASS(wxDataInputStream)
90 };
91
92 class WXDLLIMPEXP_BASE wxDataOutputStream
93 {
94 public:
95 #if wxUSE_UNICODE
96 wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv = wxConvAuto());
97 #else
98 wxDataOutputStream(wxOutputStream& s);
99 #endif
100 ~wxDataOutputStream();
101
102 bool IsOk() { return m_output->IsOk(); }
103
104 #if wxHAS_INT64
105 void Write64(wxUint64 i);
106 void Write64(wxInt64 i);
107 #endif
108 #if wxUSE_LONGLONG
109 void WriteLL(const wxLongLong &ll);
110 void WriteLL(const wxULongLong &ll);
111 #endif
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);
117
118 #if wxHAS_INT64
119 void Write64(const wxUint64 *buffer, size_t size);
120 void Write64(const wxInt64 *buffer, size_t size);
121 #endif
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);
125 #endif
126 #if wxUSE_LONGLONG
127 void WriteLL(const wxULongLong *buffer, size_t size);
128 void WriteLL(const wxLongLong *buffer, size_t size);
129 #endif
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);
134
135 wxDataOutputStream& operator<<(const wxString& string);
136 wxDataOutputStream& operator<<(wxInt8 c);
137 wxDataOutputStream& operator<<(wxInt16 i);
138 wxDataOutputStream& operator<<(wxInt32 i);
139 wxDataOutputStream& operator<<(wxUint8 c);
140 wxDataOutputStream& operator<<(wxUint16 i);
141 wxDataOutputStream& operator<<(wxUint32 i);
142 #if wxHAS_INT64
143 wxDataOutputStream& operator<<(wxUint64 i);
144 wxDataOutputStream& operator<<(wxInt64 i);
145 #endif
146 #if defined(wxLongLong_t) && wxUSE_LONGLONG
147 wxDataOutputStream& operator<<(const wxULongLong &i);
148 wxDataOutputStream& operator<<(const wxLongLong &i);
149 #endif
150 wxDataOutputStream& operator<<(double f);
151 wxDataOutputStream& operator<<(float f);
152
153 void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
154
155 protected:
156 wxOutputStream *m_output;
157 bool m_be_order;
158 #if wxUSE_UNICODE
159 wxMBConv *m_conv;
160 #endif
161
162 DECLARE_NO_COPY_CLASS(wxDataOutputStream)
163 };
164
165 #endif
166 // wxUSE_STREAMS
167
168 #endif
169 // _WX_DATSTREAM_H_