]> git.saurik.com Git - wxWidgets.git/blob - include/wx/protocol/ftp.h
Used old name SelectCell instead of new name SetCurrentCell
[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 #ifndef __WX_FTP_H__
12 #define __WX_FTP_H__
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "wx/object.h"
19 #include "wx/sckaddr.h"
20 #include "wx/protocol/protocol.h"
21 #include "wx/url.h"
22
23 class WXDLLEXPORT wxFTP : public wxProtocol {
24 DECLARE_DYNAMIC_CLASS(wxFTP)
25 DECLARE_PROTOCOL(wxFTP)
26 public:
27 typedef enum { ASCII, BINARY } wxFTPmode;
28
29 wxFTP();
30 ~wxFTP();
31
32 bool Close();
33 bool Connect(wxSockAddress& addr, bool wait = TRUE);
34 bool Connect(const wxString& host);
35
36 void SetUser(const wxString& user) { m_user = user; }
37 void SetPassword(const wxString& passwd) { m_passwd = passwd; }
38
39 // Low-level methods
40 bool SendCommand(const wxString& command, char exp_ret);
41 inline virtual wxProtocolError GetError()
42 { return m_lastError; }
43 const wxString& GetLastResult(); // Get the complete return
44
45 // Filesystem commands
46 bool ChDir(const wxString& dir);
47 bool MkDir(const wxString& dir);
48 bool RmDir(const wxString& dir);
49 wxString Pwd();
50 bool Rename(const wxString& src, const wxString& dst);
51 bool RmFile(const wxString& path);
52
53 // Download methods
54 bool Abort();
55 wxInputStream *GetInputStream(const wxString& path);
56 wxOutputStream *GetOutputStream(const wxString& path);
57
58 // List method
59 wxList *GetList(const wxString& wildcard);
60
61 protected:
62 wxString m_user, m_passwd;
63 wxString m_lastResult;
64 wxProtocolError m_lastError;
65 bool m_streaming;
66
67 friend class wxInputFTPStream;
68 friend class wxOutputFTPStream;
69
70 wxSocketClient *GetPort();
71 bool GetResult(char exp);
72 };
73
74 #endif