]> git.saurik.com Git - wxWidgets.git/blame - include/wx/protocol/protocol.h
Added userData to wxSizerItems and other things to make sizers more
[wxWidgets.git] / include / wx / protocol / protocol.h
CommitLineData
f4ada568
GL
1/////////////////////////////////////////////////////////////////////////////
2// Name: protocol.h
3// Purpose: Protocol base class
4// Author: Guilhem Lavaux
5// Modified by:
6// Created: 10/07/1997
7// RCS-ID: $Id$
8// Copyright: (c) 1997, 1998 Guilhem Lavaux
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11#ifndef _WX_PROTOCOL_PROTOCOL_H
12#define _WX_PROTOCOL_PROTOCOL_H
13
14#ifdef __GNUG__
15#pragma interface
16#endif
17
e3e717ec
VZ
18#include "wx/defs.h"
19
e3e717ec 20
f4ada568
GL
21#include "wx/object.h"
22#include "wx/string.h"
23#include "wx/stream.h"
8a4df159
RR
24
25#if wxUSE_SOCKETS
f4ada568 26#include "wx/socket.h"
8a4df159 27#endif
f4ada568
GL
28
29typedef enum {
30 wxPROTO_NOERR = 0,
31 wxPROTO_NETERR,
32 wxPROTO_PROTERR,
33 wxPROTO_CONNERR,
34 wxPROTO_INVVAL,
35 wxPROTO_NOHNDLR,
36 wxPROTO_NOFILE,
37 wxPROTO_ABRT,
38 wxPROTO_RCNCT,
e3e717ec 39 wxPROTO_STREAMING
f4ada568
GL
40} wxProtocolError;
41
42// For protocols
43#define DECLARE_PROTOCOL(class) \
44public: \
45 static wxProtoInfo g_proto_##class;
46
47#define IMPLEMENT_PROTOCOL(class, name, serv, host) \
48wxProtoInfo class::g_proto_##class(name, serv, host, CLASSINFO(class));
49
50class WXDLLEXPORT wxProtoInfo : public wxObject {
51 DECLARE_DYNAMIC_CLASS(wxProtoInfo)
52protected:
53 wxProtoInfo *next;
54 wxString m_protoname;
55 wxString prefix;
56 wxString m_servname;
57 wxClassInfo *m_cinfo;
58 bool m_needhost;
59
60 friend class wxURL;
61public:
8bec6d4a 62 wxProtoInfo(const wxChar *name, const wxChar *serv_name, const bool need_host1,
f4ada568
GL
63 wxClassInfo *info);
64};
65
8a4df159
RR
66class WXDLLEXPORT wxProtocol
67#if wxUSE_SOCKETS
68 : public wxSocketClient {
69#else
70 : public wxObject {
71#endif
f4ada568
GL
72 DECLARE_ABSTRACT_CLASS(wxProtocol)
73public:
74 wxProtocol();
75
8a4df159 76#if wxUSE_SOCKETS
f4ada568 77 bool Reconnect();
8a2c6ef8
JS
78 virtual bool Connect( const wxString& WXUNUSED(host) ) { return FALSE; }
79 virtual bool Connect( wxSockAddress& addr, bool WXUNUSED(wait) = TRUE) { return wxSocketClient::Connect(addr); }
8a4df159 80#endif
f4ada568
GL
81
82 virtual bool Abort() = 0;
83 virtual wxInputStream *GetInputStream(const wxString& path) = 0;
84 virtual wxProtocolError GetError() = 0;
ce3ed50d 85 virtual wxString GetContentType() { return wxEmptyString; }
c058d771
RR
86 virtual void SetUser(const wxString& WXUNUSED(user)) {}
87 virtual void SetPassword(const wxString& WXUNUSED(passwd) ) {}
f4ada568
GL
88};
89
8a4df159 90#if wxUSE_SOCKETS
f4ada568 91wxProtocolError WXDLLEXPORT GetLine(wxSocketBase *sock, wxString& result);
8a4df159 92#endif
e3e717ec
VZ
93
94#endif // _WX_PROTOCOL_PROTOCOL_H