]> git.saurik.com Git - wxWidgets.git/blame - include/wx/datstrm.h
Allow specifying non default port for wxFTP connections.
[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
107ea8f0 25 wxDataInputStream(wxInputStream& s, const wxMBConv& conv = wxConvUTF8 );
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; }
03647350 81
10c2f98a
RR
82#if wxUSE_UNICODE
83 void SetConv( const wxMBConv &conv );
84 wxMBConv *GetConv() const { return m_conv; }
85#endif
38caaa61 86
4c075b70
RR
87protected:
88 wxInputStream *m_input;
89 bool m_be_order;
a99acbb0 90#if wxUSE_UNICODE
d36c9347 91 wxMBConv *m_conv;
a99acbb0 92#endif
22f3361e 93
c0c133e1 94 wxDECLARE_NO_COPY_CLASS(wxDataInputStream);
3d4c6a21
GL
95};
96
bddd7a8d 97class WXDLLIMPEXP_BASE wxDataOutputStream
4c075b70
RR
98{
99public:
a99acbb0 100#if wxUSE_UNICODE
107ea8f0 101 wxDataOutputStream(wxOutputStream& s, const wxMBConv& conv = wxConvUTF8 );
a99acbb0 102#else
4c075b70 103 wxDataOutputStream(wxOutputStream& s);
a99acbb0 104#endif
d36c9347 105 ~wxDataOutputStream();
cf447356 106
7eb0e037
RR
107 bool IsOk() { return m_output->IsOk(); }
108
216a72f3 109#if wxHAS_INT64
41b0a113 110 void Write64(wxUint64 i);
216a72f3
VZ
111 void Write64(wxInt64 i);
112#endif
113#if wxUSE_LONGLONG
114 void WriteLL(const wxLongLong &ll);
115 void WriteLL(const wxULongLong &ll);
116#endif
4c075b70
RR
117 void Write32(wxUint32 i);
118 void Write16(wxUint16 i);
119 void Write8(wxUint8 i);
120 void WriteDouble(double d);
121 void WriteString(const wxString& string);
fae05df5 122
216a72f3 123#if wxHAS_INT64
53663be8 124 void Write64(const wxUint64 *buffer, size_t size);
216a72f3
VZ
125 void Write64(const wxInt64 *buffer, size_t size);
126#endif
127#if defined(wxLongLong_t) && wxUSE_LONGLONG
128 void Write64(const wxULongLong *buffer, size_t size);
129 void Write64(const wxLongLong *buffer, size_t size);
130#endif
131#if wxUSE_LONGLONG
132 void WriteLL(const wxULongLong *buffer, size_t size);
133 void WriteLL(const wxLongLong *buffer, size_t size);
134#endif
53663be8
VZ
135 void Write32(const wxUint32 *buffer, size_t size);
136 void Write16(const wxUint16 *buffer, size_t size);
137 void Write8(const wxUint8 *buffer, size_t size);
138 void WriteDouble(const double *buffer, size_t size);
139
38caaa61 140 wxDataOutputStream& operator<<(const wxString& string);
4c075b70
RR
141 wxDataOutputStream& operator<<(wxInt8 c);
142 wxDataOutputStream& operator<<(wxInt16 i);
143 wxDataOutputStream& operator<<(wxInt32 i);
144 wxDataOutputStream& operator<<(wxUint8 c);
145 wxDataOutputStream& operator<<(wxUint16 i);
146 wxDataOutputStream& operator<<(wxUint32 i);
216a72f3 147#if wxHAS_INT64
41b0a113 148 wxDataOutputStream& operator<<(wxUint64 i);
216a72f3
VZ
149 wxDataOutputStream& operator<<(wxInt64 i);
150#endif
151#if defined(wxLongLong_t) && wxUSE_LONGLONG
152 wxDataOutputStream& operator<<(const wxULongLong &i);
153 wxDataOutputStream& operator<<(const wxLongLong &i);
154#endif
4c075b70
RR
155 wxDataOutputStream& operator<<(double f);
156 wxDataOutputStream& operator<<(float f);
fae05df5 157
38caaa61
KB
158 void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
159
10c2f98a
RR
160#if wxUSE_UNICODE
161 void SetConv( const wxMBConv &conv );
162 wxMBConv *GetConv() const { return m_conv; }
163#endif
164
4c075b70
RR
165protected:
166 wxOutputStream *m_output;
167 bool m_be_order;
a99acbb0 168#if wxUSE_UNICODE
d36c9347 169 wxMBConv *m_conv;
a99acbb0 170#endif
22f3361e 171
c0c133e1 172 wxDECLARE_NO_COPY_CLASS(wxDataOutputStream);
cf447356
GL
173};
174
ce4169a4
RR
175#endif
176 // wxUSE_STREAMS
177
cf447356 178#endif
34138703 179 // _WX_DATSTREAM_H_