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