]> git.saurik.com Git - wxWidgets.git/blame - include/wx/datstrm.h
cleanup - added whitespace around operators, some blank lines, fixed comment typos...
[wxWidgets.git] / include / wx / datstrm.h
CommitLineData
cf447356
GL
1/////////////////////////////////////////////////////////////////////////////
2// Name: datstrm.h
3// Purpose: Data stream classes
4// Author: Guilhem Lavaux
53663be8 5// Modified by: Mickael Gilabert
cf447356
GL
6// Created: 28/06/1998
7// RCS-ID: $Id$
8// Copyright: (c) Guilhem Lavaux
68379eaf 9// Licence: wxWindows licence
cf447356
GL
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_DATSTREAM_H_
13#define _WX_DATSTREAM_H_
cf447356 14
ed58dbea 15#include "wx/stream.h"
41b0a113 16#include "wx/longlong.h"
830f8f11 17#include "wx/convauto.h"
cf447356 18
ce4169a4
RR
19#if wxUSE_STREAMS
20
bddd7a8d 21class WXDLLIMPEXP_BASE wxDataInputStream
4c075b70 22{
cf447356 23public:
a99acbb0 24#if wxUSE_UNICODE
830f8f11 25 wxDataInputStream(wxInputStream& s, const wxMBConv& conv = wxConvAuto());
a99acbb0 26#else
4c075b70 27 wxDataInputStream(wxInputStream& s);
a99acbb0 28#endif
d36c9347 29 ~wxDataInputStream();
68379eaf 30
7eb0e037 31 bool IsOk() { return m_input->IsOk(); }
cf447356 32
216a72f3 33#if wxHAS_INT64
41b0a113 34 wxUint64 Read64();
216a72f3
VZ
35#endif
36#if wxUSE_LONGLONG
37 wxLongLong ReadLL();
38#endif
4c075b70
RR
39 wxUint32 Read32();
40 wxUint16 Read16();
41 wxUint8 Read8();
42 double ReadDouble();
43 wxString ReadString();
fae05df5 44
216a72f3 45#if wxHAS_INT64
53663be8 46 void Read64(wxUint64 *buffer, size_t size);
216a72f3
VZ
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
53663be8
VZ
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
4c075b70
RR
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);
216a72f3 69#if wxHAS_INT64
41b0a113 70 wxDataInputStream& operator>>(wxUint64& i);
216a72f3
VZ
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
4c075b70
RR
77 wxDataInputStream& operator>>(double& i);
78 wxDataInputStream& operator>>(float& f);
5a96d2f4 79
4c075b70 80 void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
38caaa61 81
4c075b70
RR
82protected:
83 wxInputStream *m_input;
84 bool m_be_order;
a99acbb0 85#if wxUSE_UNICODE
d36c9347 86 wxMBConv *m_conv;
a99acbb0 87#endif
22f3361e
VZ
88
89 DECLARE_NO_COPY_CLASS(wxDataInputStream)
3d4c6a21
GL
90};
91
bddd7a8d 92class WXDLLIMPEXP_BASE wxDataOutputStream
4c075b70
RR
93{
94public:
a99acbb0 95#if wxUSE_UNICODE
830f8f11 96 wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv = wxConvAuto());
a99acbb0 97#else
4c075b70 98 wxDataOutputStream(wxOutputStream& s);
a99acbb0 99#endif
d36c9347 100 ~wxDataOutputStream();
cf447356 101
7eb0e037
RR
102 bool IsOk() { return m_output->IsOk(); }
103
216a72f3 104#if wxHAS_INT64
41b0a113 105 void Write64(wxUint64 i);
216a72f3
VZ
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
4c075b70
RR
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);
fae05df5 117
216a72f3 118#if wxHAS_INT64
53663be8 119 void Write64(const wxUint64 *buffer, size_t size);
216a72f3
VZ
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
53663be8
VZ
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
4c075b70 135 wxDataOutputStream& operator<<(const wxChar *string);
38caaa61 136 wxDataOutputStream& operator<<(const wxString& string);
4c075b70
RR
137 wxDataOutputStream& operator<<(wxInt8 c);
138 wxDataOutputStream& operator<<(wxInt16 i);
139 wxDataOutputStream& operator<<(wxInt32 i);
140 wxDataOutputStream& operator<<(wxUint8 c);
141 wxDataOutputStream& operator<<(wxUint16 i);
142 wxDataOutputStream& operator<<(wxUint32 i);
216a72f3 143#if wxHAS_INT64
41b0a113 144 wxDataOutputStream& operator<<(wxUint64 i);
216a72f3
VZ
145 wxDataOutputStream& operator<<(wxInt64 i);
146#endif
147#if defined(wxLongLong_t) && wxUSE_LONGLONG
148 wxDataOutputStream& operator<<(const wxULongLong &i);
149 wxDataOutputStream& operator<<(const wxLongLong &i);
150#endif
4c075b70
RR
151 wxDataOutputStream& operator<<(double f);
152 wxDataOutputStream& operator<<(float f);
fae05df5 153
38caaa61
KB
154 void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
155
4c075b70
RR
156protected:
157 wxOutputStream *m_output;
158 bool m_be_order;
a99acbb0 159#if wxUSE_UNICODE
d36c9347 160 wxMBConv *m_conv;
a99acbb0 161#endif
22f3361e
VZ
162
163 DECLARE_NO_COPY_CLASS(wxDataOutputStream)
cf447356
GL
164};
165
ce4169a4
RR
166#endif
167 // wxUSE_STREAMS
168
cf447356 169#endif
34138703 170 // _WX_DATSTREAM_H_