]> git.saurik.com Git - wxWidgets.git/blame - include/wx/datstrm.h
No real changes, just refactoring.
[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
371a5b4e 9// Licence: wxWindows licence
cf447356
GL
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_DATSTREAM_H_
13#define _WX_DATSTREAM_H_
cf447356 14
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
cf447356
GL
16#pragma interface "datstrm.h"
17#endif
18
ed58dbea 19#include "wx/stream.h"
41b0a113 20#include "wx/longlong.h"
a99acbb0 21#include "wx/strconv.h"
cf447356 22
ce4169a4
RR
23#if wxUSE_STREAMS
24
bddd7a8d 25class WXDLLIMPEXP_BASE wxDataInputStream
4c075b70 26{
cf447356 27public:
a99acbb0
VS
28#if wxUSE_UNICODE
29 wxDataInputStream(wxInputStream& s, wxMBConv& conv = wxConvUTF8);
30#else
4c075b70 31 wxDataInputStream(wxInputStream& s);
a99acbb0 32#endif
4c075b70 33 ~wxDataInputStream();
7eb0e037
RR
34
35 bool IsOk() { return m_input->IsOk(); }
cf447356 36
41b0a113 37 wxUint64 Read64();
4c075b70
RR
38 wxUint32 Read32();
39 wxUint16 Read16();
40 wxUint8 Read8();
41 double ReadDouble();
42 wxString ReadString();
fae05df5 43
53663be8
VZ
44 void Read64(wxUint64 *buffer, size_t size);
45 void Read32(wxUint32 *buffer, size_t size);
46 void Read16(wxUint16 *buffer, size_t size);
47 void Read8(wxUint8 *buffer, size_t size);
48 void ReadDouble(double *buffer, size_t size);
49
4c075b70
RR
50 wxDataInputStream& operator>>(wxString& s);
51 wxDataInputStream& operator>>(wxInt8& c);
52 wxDataInputStream& operator>>(wxInt16& i);
53 wxDataInputStream& operator>>(wxInt32& i);
54 wxDataInputStream& operator>>(wxUint8& c);
55 wxDataInputStream& operator>>(wxUint16& i);
56 wxDataInputStream& operator>>(wxUint32& i);
41b0a113 57 wxDataInputStream& operator>>(wxUint64& i);
4c075b70
RR
58 wxDataInputStream& operator>>(double& i);
59 wxDataInputStream& operator>>(float& f);
5a96d2f4 60
4c075b70 61 void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
38caaa61 62
4c075b70
RR
63protected:
64 wxInputStream *m_input;
65 bool m_be_order;
a99acbb0
VS
66#if wxUSE_UNICODE
67 wxMBConv& m_conv;
68#endif
22f3361e
VZ
69
70 DECLARE_NO_COPY_CLASS(wxDataInputStream)
3d4c6a21
GL
71};
72
bddd7a8d 73class WXDLLIMPEXP_BASE wxDataOutputStream
4c075b70
RR
74{
75public:
a99acbb0
VS
76#if wxUSE_UNICODE
77 wxDataOutputStream(wxOutputStream& s, wxMBConv& conv = wxConvUTF8);
78#else
4c075b70 79 wxDataOutputStream(wxOutputStream& s);
a99acbb0 80#endif
4c075b70 81 ~wxDataOutputStream();
cf447356 82
7eb0e037
RR
83 bool IsOk() { return m_output->IsOk(); }
84
41b0a113 85 void Write64(wxUint64 i);
4c075b70
RR
86 void Write32(wxUint32 i);
87 void Write16(wxUint16 i);
88 void Write8(wxUint8 i);
89 void WriteDouble(double d);
90 void WriteString(const wxString& string);
fae05df5 91
53663be8
VZ
92 void Write64(const wxUint64 *buffer, size_t size);
93 void Write32(const wxUint32 *buffer, size_t size);
94 void Write16(const wxUint16 *buffer, size_t size);
95 void Write8(const wxUint8 *buffer, size_t size);
96 void WriteDouble(const double *buffer, size_t size);
97
4c075b70 98 wxDataOutputStream& operator<<(const wxChar *string);
38caaa61 99 wxDataOutputStream& operator<<(const wxString& string);
4c075b70
RR
100 wxDataOutputStream& operator<<(wxInt8 c);
101 wxDataOutputStream& operator<<(wxInt16 i);
102 wxDataOutputStream& operator<<(wxInt32 i);
103 wxDataOutputStream& operator<<(wxUint8 c);
104 wxDataOutputStream& operator<<(wxUint16 i);
105 wxDataOutputStream& operator<<(wxUint32 i);
41b0a113 106 wxDataOutputStream& operator<<(wxUint64 i);
4c075b70
RR
107 wxDataOutputStream& operator<<(double f);
108 wxDataOutputStream& operator<<(float f);
fae05df5 109
38caaa61
KB
110 void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
111
4c075b70
RR
112protected:
113 wxOutputStream *m_output;
114 bool m_be_order;
a99acbb0
VS
115#if wxUSE_UNICODE
116 wxMBConv& m_conv;
117#endif
22f3361e
VZ
118
119 DECLARE_NO_COPY_CLASS(wxDataOutputStream)
cf447356
GL
120};
121
ce4169a4
RR
122#endif
123 // wxUSE_STREAMS
124
cf447356 125#endif
34138703 126 // _WX_DATSTREAM_H_