]> git.saurik.com Git - wxWidgets.git/blob - include/wx/protocol/protocol.h
Added GetMessage to those that are undef'ed and reimplemented as
[wxWidgets.git] / include / wx / protocol / protocol.h
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
18 #include "wx/object.h"
19 #include "wx/string.h"
20 #include "wx/stream.h"
21 #include "wx/socket.h"
22
23 typedef enum {
24 wxPROTO_NOERR = 0,
25 wxPROTO_NETERR,
26 wxPROTO_PROTERR,
27 wxPROTO_CONNERR,
28 wxPROTO_INVVAL,
29 wxPROTO_NOHNDLR,
30 wxPROTO_NOFILE,
31 wxPROTO_ABRT,
32 wxPROTO_RCNCT,
33 wxPROTO_STREAMING
34 } wxProtocolError;
35
36 // For protocols
37 #define DECLARE_PROTOCOL(class) \
38 public: \
39 static wxProtoInfo g_proto_##class;
40
41 #define IMPLEMENT_PROTOCOL(class, name, serv, host) \
42 wxProtoInfo class::g_proto_##class(name, serv, host, CLASSINFO(class));
43
44 class WXDLLEXPORT wxProtoInfo : public wxObject {
45 DECLARE_DYNAMIC_CLASS(wxProtoInfo)
46 protected:
47 wxProtoInfo *next;
48 wxString m_protoname;
49 wxString prefix;
50 wxString m_servname;
51 wxClassInfo *m_cinfo;
52 bool m_needhost;
53
54 friend class wxURL;
55 public:
56 wxProtoInfo(const wxChar *name, const wxChar *serv_name, const bool need_host1,
57 wxClassInfo *info);
58 };
59
60 class WXDLLEXPORT wxProtocol : public wxSocketClient {
61 DECLARE_ABSTRACT_CLASS(wxProtocol)
62 public:
63 wxProtocol();
64
65 bool Reconnect();
66 virtual bool Connect( const wxString& WXUNUSED(host) ) { return FALSE; }
67 virtual bool Connect( wxSockAddress& addr, bool WXUNUSED(wait) = TRUE) { return wxSocketClient::Connect(addr); }
68
69 virtual bool Abort() = 0;
70 virtual wxInputStream *GetInputStream(const wxString& path) = 0;
71 virtual wxProtocolError GetError() = 0;
72 virtual wxString GetContentType() { return wxEmptyString; }
73 virtual void SetUser(const wxString& WXUNUSED(user)) {}
74 virtual void SetPassword(const wxString& WXUNUSED(passwd) ) {}
75 };
76
77 wxProtocolError WXDLLEXPORT GetLine(wxSocketBase *sock, wxString& result);
78
79 #endif