wxFTP::Close() shouldn't hide base wxSocket function
[wxWidgets.git] / include / wx / protocol / ftp.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: ftp.h
3 // Purpose: FTP protocol
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 07/07/1997
7 // RCS-ID: $Id$
8 // Copyright: (c) 1997, 1998 Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __WX_FTP_H__
13 #define __WX_FTP_H__
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "wx/object.h"
20 #include "wx/sckaddr.h"
21 #include "wx/protocol/protocol.h"
22 #include "wx/url.h"
23
24 class WXDLLEXPORT wxFTP : public wxProtocol
25 {
26 public:
27 typedef enum { ASCII, BINARY } wxFTPmode;
28
29 wxFTP();
30 virtual ~wxFTP();
31
32 bool Connect(wxSockAddress& addr, bool wait = TRUE);
33 bool Connect(const wxString& host);
34
35 // close the connection
36 virtual bool Close();
37
38 void SetUser(const wxString& user) { m_user = user; }
39 void SetPassword(const wxString& passwd) { m_passwd = passwd; }
40
41 // Filesystem commands
42 bool ChDir(const wxString& dir);
43 bool MkDir(const wxString& dir);
44 bool RmDir(const wxString& dir);
45 wxString Pwd();
46 bool Rename(const wxString& src, const wxString& dst);
47 bool RmFile(const wxString& path);
48
49 // Download methods
50 bool Abort();
51 wxInputStream *GetInputStream(const wxString& path);
52 wxOutputStream *GetOutputStream(const wxString& path);
53
54 // List method
55 bool GetList(wxArrayString& files, const wxString& wildcard = wxEmptyString);
56
57 // Low-level methods
58 bool SendCommand(const wxString& command, char exp_ret);
59 virtual wxProtocolError GetError() { return m_lastError; }
60 const wxString& GetLastResult(); // Get the complete return
61
62 // deprecated
63 wxList *GetList(const wxString& wildcard);
64
65 protected:
66 wxString m_user, m_passwd;
67 wxString m_lastResult;
68 wxProtocolError m_lastError;
69 bool m_streaming;
70
71 friend class wxInputFTPStream;
72 friend class wxOutputFTPStream;
73
74 wxSocketClient *GetPort();
75 bool GetResult(char exp);
76
77 DECLARE_DYNAMIC_CLASS(wxFTP)
78 DECLARE_PROTOCOL(wxFTP)
79 };
80
81 #endif // __WX_FTP_H__