]> git.saurik.com Git - wxWidgets.git/blame - include/wx/protocol/ftp.h
Cleaned up the API for class/structure/function names to follow the wxWindows convent...
[wxWidgets.git] / include / wx / protocol / ftp.h
CommitLineData
f4ada568
GL
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/////////////////////////////////////////////////////////////////////////////
8e907a13 11
f4ada568
GL
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
8e907a13
VZ
24class WXDLLEXPORT wxFTP : public wxProtocol
25{
f4ada568
GL
26public:
27 typedef enum { ASCII, BINARY } wxFTPmode;
28
29 wxFTP();
8e907a13 30 virtual ~wxFTP();
f4ada568 31
8a2c6ef8 32 bool Connect(wxSockAddress& addr, bool wait = TRUE);
f4ada568
GL
33 bool Connect(const wxString& host);
34
8e907a13
VZ
35 // [forcibly] close the connection
36 bool Close(bool force = FALSE);
37
f4ada568
GL
38 void SetUser(const wxString& user) { m_user = user; }
39 void SetPassword(const wxString& passwd) { m_passwd = passwd; }
40
f4ada568
GL
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
8e907a13
VZ
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
f4ada568
GL
63 wxList *GetList(const wxString& wildcard);
64
65protected:
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);
8e907a13
VZ
76
77 DECLARE_DYNAMIC_CLASS(wxFTP)
78 DECLARE_PROTOCOL(wxFTP)
f4ada568
GL
79};
80
8e907a13 81#endif // __WX_FTP_H__