]>
Commit | Line | Data |
---|---|---|
f4ada568 | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/url.h |
f4ada568 GL |
3 | // Purpose: URL parser |
4 | // Author: Guilhem Lavaux | |
b60b2ec8 | 5 | // Modified by: Ryan Norton |
f4ada568 GL |
6 | // Created: 20/07/1997 |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 1997, 1998 Guilhem Lavaux | |
65571936 | 9 | // Licence: wxWindows licence |
f4ada568 | 10 | ///////////////////////////////////////////////////////////////////////////// |
f6bcfd97 | 11 | |
f4ada568 GL |
12 | #ifndef _WX_URL_H |
13 | #define _WX_URL_H | |
14 | ||
a5d46b73 VZ |
15 | #include "wx/defs.h" |
16 | ||
17 | #if wxUSE_URL | |
f4ada568 | 18 | |
b60b2ec8 | 19 | #include "wx/uri.h" |
f4ada568 | 20 | #include "wx/protocol/protocol.h" |
8a4df159 | 21 | |
a5d46b73 | 22 | #if wxUSE_PROTOCOL_HTTP |
8a4df159 RR |
23 | #include "wx/protocol/http.h" |
24 | #endif | |
f4ada568 GL |
25 | |
26 | typedef enum { | |
27 | wxURL_NOERR = 0, | |
28 | wxURL_SNTXERR, | |
29 | wxURL_NOPROTO, | |
30 | wxURL_NOHOST, | |
31 | wxURL_NOPATH, | |
32 | wxURL_CONNERR, | |
33 | wxURL_PROTOERR | |
34 | } wxURLError; | |
a5d46b73 | 35 | |
25959b95 | 36 | #if wxUSE_URL_NATIVE |
b5dbe15d | 37 | class WXDLLIMPEXP_FWD_NET wxURL; |
25959b95 VZ |
38 | |
39 | class WXDLLIMPEXP_NET wxURLNativeImp : public wxObject | |
40 | { | |
41 | public: | |
42 | virtual ~wxURLNativeImp() { } | |
43 | virtual wxInputStream *GetInputStream(wxURL *owner) = 0; | |
44 | }; | |
45 | #endif // wxUSE_URL_NATIVE | |
46 | ||
b60b2ec8 | 47 | class WXDLLIMPEXP_NET wxURL : public wxURI |
b2b35524 | 48 | { |
f4ada568 | 49 | public: |
7d90da2b | 50 | wxURL(const wxString& sUrl = wxEmptyString); |
00e075e5 FM |
51 | wxURL(const wxURI& uri); |
52 | wxURL(const wxURL& url); | |
b2b35524 VZ |
53 | virtual ~wxURL(); |
54 | ||
b60b2ec8 | 55 | wxURL& operator = (const wxString& url); |
00e075e5 FM |
56 | wxURL& operator = (const wxURI& uri); |
57 | wxURL& operator = (const wxURL& url); | |
b60b2ec8 | 58 | |
f6bcfd97 BP |
59 | wxProtocol& GetProtocol() { return *m_protocol; } |
60 | wxURLError GetError() const { return m_error; } | |
ce321570 | 61 | wxString GetURL() const { return m_url; } |
f4ada568 | 62 | |
7d90da2b RR |
63 | wxURLError SetURL(const wxString &url) |
64 | { *this = url; return m_error; } | |
65 | ||
66 | bool IsOk() const | |
67 | { return m_error == wxURL_NOERR; } | |
68 | ||
b2b35524 | 69 | wxInputStream *GetInputStream(); |
f4ada568 | 70 | |
26531700 | 71 | #if wxUSE_PROTOCOL_HTTP |
b2b35524 VZ |
72 | static void SetDefaultProxy(const wxString& url_proxy); |
73 | void SetProxy(const wxString& url_proxy); | |
26531700 | 74 | #endif // wxUSE_PROTOCOL_HTTP |
f4ada568 | 75 | |
b2b35524 VZ |
76 | protected: |
77 | static wxProtoInfo *ms_protocols; | |
f4ada568 | 78 | |
ce195ee6 | 79 | #if wxUSE_PROTOCOL_HTTP |
b2b35524 VZ |
80 | static wxHTTP *ms_proxyDefault; |
81 | static bool ms_useDefaultProxy; | |
82 | wxHTTP *m_proxy; | |
283965f0 | 83 | bool m_useProxy; |
ce195ee6 | 84 | #endif // wxUSE_PROTOCOL_HTTP |
b2b35524 | 85 | |
25959b95 VZ |
86 | #if wxUSE_URL_NATIVE |
87 | friend class wxURLNativeImp; | |
88 | // pointer to a native URL implementation object | |
89 | wxURLNativeImp *m_nativeImp; | |
cb719f2e | 90 | // Creates on the heap and returns a native |
25959b95 VZ |
91 | // implementation object for the current platform. |
92 | static wxURLNativeImp *CreateNativeImpObject(); | |
283965f0 VZ |
93 | #endif // wxUSE_URL_NATIVE |
94 | ||
b2b35524 VZ |
95 | wxProtoInfo *m_protoinfo; |
96 | wxProtocol *m_protocol; | |
97 | ||
98 | wxURLError m_error; | |
b60b2ec8 | 99 | wxString m_url; |
b2b35524 | 100 | |
b60b2ec8 | 101 | void Init(const wxString&); |
b2b35524 VZ |
102 | bool ParseURL(); |
103 | void CleanData(); | |
00e075e5 | 104 | void Free(); |
b2b35524 VZ |
105 | bool FetchProtocol(); |
106 | ||
107 | friend class wxProtoInfo; | |
108 | friend class wxURLModule; | |
109 | ||
110 | private: | |
b2b35524 | 111 | DECLARE_DYNAMIC_CLASS(wxURL) |
f4ada568 GL |
112 | }; |
113 | ||
a5d46b73 VZ |
114 | #endif // wxUSE_URL |
115 | ||
116 | #endif // _WX_URL_H | |
117 |