00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00014
00015 #ifndef _WXCURLDAVTOOL_H__INCLUDED_
00016 #define _WXCURLDAVTOOL_H__INCLUDED_
00017
00018 #include <wx/curl/dav.h>
00019
00020
00021
00023
00024 class wxCurlDAVTool;
00025
00026 class WXDLLIMPEXP_CURL wxCurlDAVFs
00027 {
00028 friend class wxCurlDAVTool;
00029
00030 public:
00031 wxCurlDAVFs();
00032 wxCurlDAVFs(const wxString& szHREF ,
00033 const wxString& szStatus ,
00034 const wxString& szCreationDate ,
00035 const wxString& szLastModified ,
00036 const long& iContentLength ,
00037 const wxString& szContentType );
00038 ~wxCurlDAVFs();
00039
00040 bool IsDirectory() const { return m_szContentType == _T("httpd/unix-directory"); }
00041 bool IsOK() const { return m_szStatus.Right(6) == _T("200 OK"); }
00042
00043 wxString GetHREF() const { return m_szHREF; }
00044
00045 wxString GetStatus() const { return m_szStatus; }
00046
00047 wxDateTime GetCreationDate() const { return m_dtCreationDate; }
00048 wxDateTime GetLastModified() const { return m_dtLastModified; }
00049
00050 long GetContentLength() const { return m_iContentLength; }
00051
00052 wxString GetContentType() const { return m_szContentType; }
00053 wxString GetType() const { return m_szContentType.BeforeFirst('/'); }
00054 wxString GetSubType() const { return m_szContentType.AfterLast('/'); }
00055
00056
00057 protected:
00058 wxString m_szHREF;
00059
00060 wxString m_szStatus;
00061
00062 wxDateTime m_dtCreationDate;
00063 wxDateTime m_dtLastModified;
00064
00065 long m_iContentLength;
00066
00067 wxString m_szContentType;
00068 };
00069
00070 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxCurlDAVFs, wxArrayDAVFs, WXDLLIMPEXP_CURL);
00071
00072
00073
00075
00076 class WXDLLIMPEXP_CURL wxCurlDAVTool : public wxCurlDAV
00077 {
00078 public:
00079 wxCurlDAVTool(const wxString& szURL = wxEmptyString,
00080 const wxString& szUserName = wxEmptyString,
00081 const wxString& szPassword = wxEmptyString,
00082 wxEvtHandler* pEvtHandler = NULL,
00083 long flags = wxCURL_DEFAULT_FLAGS);
00084 virtual ~wxCurlDAVTool();
00085
00086
00087
00088 bool GetDAVFs(wxArrayDAVFs& fs, const wxString& szRemoteLoc = wxEmptyString);
00089 bool Exists(const wxString& szRemoteLoc = wxEmptyString);
00090 bool IsDirectory(const wxString& szRemoteLoc = wxEmptyString);
00091 bool HasDirectory(const wxString& szRemoteLoc = wxEmptyString) { return IsDirectory(szRemoteLoc); }
00092 bool IsOk(const wxString& szRemoteLoc = wxEmptyString);
00093 wxDateTime GetLastModified(const wxString& szRemoteLoc = wxEmptyString);
00094 wxDateTime GetCreationDate(const wxString& szRemoteLoc = wxEmptyString);
00095 long GetContentLength(const wxString& szRemoteLoc = wxEmptyString);
00096 wxString GetContentType(const wxString& szRemoteLoc = wxEmptyString);
00097
00098 protected:
00099
00100
00101 bool ParseResponseXml(wxCurlDAVFs& fsItem, wxXmlNode* pNode);
00102 bool ParsePropstatXml(wxCurlDAVFs& fsItem, wxXmlNode* pNode);
00103 bool ParsePropsXml(wxCurlDAVFs& fsItem, wxXmlNode* pNode);
00104
00105 private:
00106 };
00107
00108 #endif // _WXCURLDAVTOOL_H__INCLUDED_