1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Protocol base class
4 // Author: Guilhem Lavaux
8 // Copyright: (c) 1997, 1998 Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_PROTOCOL_PROTOCOL_H
12 #define _WX_PROTOCOL_PROTOCOL_H
22 #include "wx/object.h"
23 #include "wx/string.h"
24 #include "wx/stream.h"
25 #include "wx/socket.h"
41 #define DECLARE_PROTOCOL(class) \
43 static wxProtoInfo g_proto_##class;
45 #define IMPLEMENT_PROTOCOL(class, name, serv, host) \
46 wxProtoInfo class::g_proto_##class(name, serv, host, CLASSINFO(class));
48 class WXDLLEXPORT wxProtoInfo
: public wxObject
{
49 DECLARE_DYNAMIC_CLASS(wxProtoInfo
)
60 wxProtoInfo(const wxChar
*name
, const wxChar
*serv_name
, const bool need_host1
,
64 class WXDLLEXPORT wxProtocol
: public wxSocketClient
{
65 DECLARE_ABSTRACT_CLASS(wxProtocol
)
70 virtual bool Connect( const wxString
& WXUNUSED(host
) ) { return FALSE
; }
71 virtual bool Connect( wxSockAddress
& addr
, bool WXUNUSED(wait
) = TRUE
) { return wxSocketClient::Connect(addr
); }
73 virtual bool Abort() = 0;
74 virtual wxInputStream
*GetInputStream(const wxString
& path
) = 0;
75 virtual wxProtocolError
GetError() = 0;
76 virtual wxString
GetContentType() { return wxEmptyString
; }
77 virtual void SetUser(const wxString
& WXUNUSED(user
)) {}
78 virtual void SetPassword(const wxString
& WXUNUSED(passwd
) ) {}
81 wxProtocolError WXDLLEXPORT
GetLine(wxSocketBase
*sock
, wxString
& result
);
83 #endif // wxUSE_SOCKETS
85 #endif // _WX_PROTOCOL_PROTOCOL_H