]> git.saurik.com Git - wxWidgets.git/blame - include/wx/url.h
[ 1559479 ] wxImageComboBox
[wxWidgets.git] / include / wx / url.h
CommitLineData
f4ada568
GL
1/////////////////////////////////////////////////////////////////////////////
2// Name: url.h
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
26typedef 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
VZ
36#if wxUSE_URL_NATIVE
37class WXDLLIMPEXP_NET wxURL;
38
39class WXDLLIMPEXP_NET wxURLNativeImp : public wxObject
40{
41public:
42 virtual ~wxURLNativeImp() { }
43 virtual wxInputStream *GetInputStream(wxURL *owner) = 0;
44};
45#endif // wxUSE_URL_NATIVE
46
b60b2ec8 47class WXDLLIMPEXP_NET wxURL : public wxURI
b2b35524 48{
f4ada568 49public:
7d90da2b 50 wxURL(const wxString& sUrl = wxEmptyString);
b60b2ec8 51 wxURL(const wxURI& url);
b2b35524
VZ
52 virtual ~wxURL();
53
b60b2ec8
RN
54 wxURL& operator = (const wxString& url);
55 wxURL& operator = (const wxURI& url);
56
f6bcfd97
BP
57 wxProtocol& GetProtocol() { return *m_protocol; }
58 wxURLError GetError() const { return m_error; }
ce321570 59 wxString GetURL() const { return m_url; }
f4ada568 60
7d90da2b
RR
61 wxURLError SetURL(const wxString &url)
62 { *this = url; return m_error; }
63
64 bool IsOk() const
65 { return m_error == wxURL_NOERR; }
66
b2b35524 67 wxInputStream *GetInputStream();
f4ada568 68
26531700 69#if wxUSE_PROTOCOL_HTTP
b2b35524
VZ
70 static void SetDefaultProxy(const wxString& url_proxy);
71 void SetProxy(const wxString& url_proxy);
26531700 72#endif // wxUSE_PROTOCOL_HTTP
f4ada568 73
86470d43 74#if WXWIN_COMPATIBILITY_2_4
ce321570 75 //Use the proper wxURI accessors instead
a6fb8636
WS
76 wxDEPRECATED( wxString GetProtocolName() const );
77 wxDEPRECATED( wxString GetHostName() const );
78 wxDEPRECATED( wxString GetPath() const );
ce321570 79
997ba01b 80 //Use wxURI instead - this does not work that well
47261ba0 81 wxDEPRECATED( static wxString ConvertToValidURI(
f6bcfd97
BP
82 const wxString& uri,
83 const wxChar* delims = wxT(";/?:@&=+$,")
47261ba0 84 ) );
86470d43
RN
85
86 //Use wxURI::Unescape instead
47261ba0 87 wxDEPRECATED( static wxString ConvertFromURI(const wxString& uri) );
86470d43 88#endif
b2b35524
VZ
89
90protected:
91 static wxProtoInfo *ms_protocols;
f4ada568 92
ce195ee6 93#if wxUSE_PROTOCOL_HTTP
b2b35524
VZ
94 static wxHTTP *ms_proxyDefault;
95 static bool ms_useDefaultProxy;
96 wxHTTP *m_proxy;
ce195ee6 97#endif // wxUSE_PROTOCOL_HTTP
b2b35524 98
25959b95
VZ
99#if wxUSE_URL_NATIVE
100 friend class wxURLNativeImp;
101 // pointer to a native URL implementation object
102 wxURLNativeImp *m_nativeImp;
cb719f2e 103 // Creates on the heap and returns a native
25959b95
VZ
104 // implementation object for the current platform.
105 static wxURLNativeImp *CreateNativeImpObject();
106#endif
b2b35524
VZ
107 wxProtoInfo *m_protoinfo;
108 wxProtocol *m_protocol;
109
110 wxURLError m_error;
b60b2ec8 111 wxString m_url;
b2b35524
VZ
112 bool m_useProxy;
113
b60b2ec8 114 void Init(const wxString&);
b2b35524
VZ
115 bool ParseURL();
116 void CleanData();
117 bool FetchProtocol();
118
119 friend class wxProtoInfo;
120 friend class wxURLModule;
121
122private:
b2b35524 123 DECLARE_DYNAMIC_CLASS(wxURL)
f4ada568
GL
124};
125
a5d46b73
VZ
126#endif // wxUSE_URL
127
128#endif // _WX_URL_H
129