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