00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _WXCURLFTP_H__INCLUDED_
00012 #define _WXCURLFTP_H__INCLUDED_
00013
00014 #include <wx/curl/base.h>
00015
00016
00017
00019
00020 extern "C"
00021 {
00022 }
00023
00024
00025
00027
00029 class WXDLLIMPEXP_CURL wxCurlFTP : public wxCurlBase
00030 {
00031 public:
00032 enum TransferMode
00033 {
00034 kASCII,
00035 kBINARY
00036 };
00037
00038 wxCurlFTP(const wxString& szURL = wxEmptyString,
00039 const wxString& szUserName = wxEmptyString,
00040 const wxString& szPassword = wxEmptyString,
00041 wxEvtHandler* pEvtHandler = NULL, int id = wxID_ANY,
00042 long flags = wxCURL_DEFAULT_FLAGS);
00043 virtual ~wxCurlFTP();
00044
00045
00046
00047
00048 void SetTransferMode(const TransferMode& tmMode);
00049 TransferMode GetTransferMode() const;
00050
00051 void SetToBinary();
00052 void SetToAscii();
00053
00054 bool IsAscii() const;
00055 bool IsBinary() const;
00056
00057
00058 void UsePortOption(const bool& bUsePort);
00059 bool UsePortOption() const;
00060
00061 void SetPortParam(const wxString& szParam = _T("-"));
00062 wxString GetPortParam() const;
00063
00064
00065 void UseEPRT(const bool& bUseEPRT);
00066 bool UseEPRT() const;
00067
00068
00069 void UseEPSV(const bool& bUseEPSV);
00070 bool UseEPSV() const;
00071
00072
00073 void AppendOnUpload(const bool& bAppend);
00074 bool AppendOnUpload() const;
00075
00076
00077 void CreateMissingDirs(const bool& bCreateMissing);
00078 bool CreateMissingDirs() const;
00079
00080
00081 bool SetQuoteList(const wxArrayString& arrQuote);
00082 bool AppendQuote(const wxString& szQuote, const bool& bClear = false);
00083
00084
00085 bool SetPreQuoteList(const wxArrayString& arrQuote);
00086 bool AppendPreQuote(const wxString& szQuote, const bool& bClear = false);
00087
00088
00089 bool SetPostQuoteList(const wxArrayString& arrQuote);
00090 bool AppendPostQuote(const wxString& szQuote, const bool& bClear = false);
00091
00092
00093
00094
00095 bool Get(const wxString& szFilePath, const wxString& szRemoteFile = wxEmptyString);
00096 size_t Get(char*& buffer, const wxString& szRemoteFile = wxEmptyString);
00097 bool Get(wxOutputStream& buffer, const wxString& szRemoteFile = wxEmptyString);
00098
00099
00100 bool Put(const wxString& szFilePath, const wxString& szRemoteFile = wxEmptyString);
00101 bool Put(const char* buffer, size_t size, const wxString& szRemoteFile = wxEmptyString);
00102 bool Put(wxInputStream& buffer, const wxString& szRemoteFile = wxEmptyString);
00103
00104
00105 bool MkDir(const wxString& szRemoteLoc = wxEmptyString);
00106
00107
00108 bool RmDir(const wxString& szRemoteLoc = wxEmptyString);
00109
00110
00111 bool Delete(const wxString& szRemoteLoc = wxEmptyString);
00112
00113
00114 bool Rename(const wxString& szRemoteLocName, const wxString& szRemoteFile = wxEmptyString);
00115
00116
00117 bool List(const wxString& szRemoteLoc = wxEmptyString);
00118 bool Nlst(const wxString& szRemoteLoc = wxEmptyString);
00119
00120
00121 bool Info(const wxString& szRemoteLoc = wxEmptyString);
00122
00123 protected:
00124
00125 virtual void SetCurlHandleToDefaults(const wxString& relativeURL);
00126 virtual void SetCurlHandleQuoteOpts();
00127
00128 void ResetAllQuoteLists();
00129 void ResetQuoteList();
00130 void ResetPreQuoteList();
00131 void ResetPostQuoteList();
00132
00133 struct curl_slist* m_pQuote;
00134 struct curl_slist* m_pPreQuote;
00135 struct curl_slist* m_pPostQuote;
00136
00137 wxString m_szCurrFullPath;
00138 wxString m_szCurrFilename;
00139
00140 bool m_bCreateMissingDirs;
00141
00142 bool m_bAppend;
00143 bool m_bUsePortOption;
00144
00145 TransferMode m_tmMode;
00146
00147 bool m_bUseEPRT;
00148 bool m_bUseEPSV;
00149
00150 wxCharBuffer m_szPortParam;
00151
00152 private:
00153
00154 };
00155
00156 #endif // _WXCURLFTP_H__INCLUDED_