]> git.saurik.com Git - wxWidgets.git/blame - include/wx/datstrm.h
fix memory leak as Dimitri suggested
[wxWidgets.git] / include / wx / datstrm.h
CommitLineData
cf447356
GL
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
371a5b4e 9// Licence: wxWindows licence
cf447356
GL
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_DATSTREAM_H_
13#define _WX_DATSTREAM_H_
cf447356 14
af49c4b8 15#if defined(__GNUG__) && !defined(__APPLE__)
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
4c075b70
RR
25class WXDLLEXPORT wxDataInputStream
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
4c075b70
RR
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);
41b0a113 51 wxDataInputStream& operator>>(wxUint64& i);
4c075b70
RR
52 wxDataInputStream& operator>>(double& i);
53 wxDataInputStream& operator>>(float& f);
5a96d2f4 54
4c075b70 55 void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
38caaa61 56
4c075b70
RR
57protected:
58 wxInputStream *m_input;
59 bool m_be_order;
a99acbb0
VS
60#if wxUSE_UNICODE
61 wxMBConv& m_conv;
62#endif
22f3361e
VZ
63
64 DECLARE_NO_COPY_CLASS(wxDataInputStream)
3d4c6a21
GL
65};
66
4c075b70
RR
67class WXDLLEXPORT wxDataOutputStream
68{
69public:
a99acbb0
VS
70#if wxUSE_UNICODE
71 wxDataOutputStream(wxOutputStream& s, wxMBConv& conv = wxConvUTF8);
72#else
4c075b70 73 wxDataOutputStream(wxOutputStream& s);
a99acbb0 74#endif
4c075b70 75 ~wxDataOutputStream();
cf447356 76
7eb0e037
RR
77 bool IsOk() { return m_output->IsOk(); }
78
41b0a113 79 void Write64(wxUint64 i);
4c075b70
RR
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);
fae05df5 85
4c075b70 86 wxDataOutputStream& operator<<(const wxChar *string);
38caaa61 87 wxDataOutputStream& operator<<(const wxString& string);
4c075b70
RR
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);
41b0a113 94 wxDataOutputStream& operator<<(wxUint64 i);
4c075b70
RR
95 wxDataOutputStream& operator<<(double f);
96 wxDataOutputStream& operator<<(float f);
fae05df5 97
38caaa61
KB
98 void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
99
4c075b70
RR
100protected:
101 wxOutputStream *m_output;
102 bool m_be_order;
a99acbb0
VS
103#if wxUSE_UNICODE
104 wxMBConv& m_conv;
105#endif
22f3361e
VZ
106
107 DECLARE_NO_COPY_CLASS(wxDataOutputStream)
cf447356
GL
108};
109
ce4169a4
RR
110#endif
111 // wxUSE_STREAMS
112
cf447356 113#endif
34138703 114 // _WX_DATSTREAM_H_