]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/url.h
wxUSE_SPLINES markup and other cleanings.
[wxWidgets.git] / include / wx / url.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: url.h
3// Purpose: URL parser
4// Author: Guilhem Lavaux
5// Modified by: Ryan Norton
6// Created: 20/07/1997
7// RCS-ID: $Id$
8// Copyright: (c) 1997, 1998 Guilhem Lavaux
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_URL_H
13#define _WX_URL_H
14
15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16#pragma interface "url.h"
17#endif
18
19#include "wx/defs.h"
20
21#if wxUSE_URL
22
23#include "wx/uri.h"
24#include "wx/protocol/protocol.h"
25
26#if wxUSE_PROTOCOL_HTTP
27 #include "wx/protocol/http.h"
28#endif
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;
39
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
51class WXDLLIMPEXP_NET wxURL : public wxURI
52{
53public:
54 wxURL(const wxString& sUrl);
55 wxURL(const wxURI& url);
56 virtual ~wxURL();
57
58 wxURL& operator = (const wxString& url);
59 wxURL& operator = (const wxURI& url);
60
61 wxProtocol& GetProtocol() { return *m_protocol; }
62 wxURLError GetError() const { return m_error; }
63 wxString GetURL() const { return m_url; }
64
65 wxInputStream *GetInputStream();
66
67#if wxUSE_PROTOCOL_HTTP
68 static void SetDefaultProxy(const wxString& url_proxy);
69 void SetProxy(const wxString& url_proxy);
70#endif // wxUSE_PROTOCOL_HTTP
71
72#if WXWIN_COMPATIBILITY_2_4
73 //Use the proper wxURI accessors instead
74 wxDEPRECATED( wxString GetProtocolName() const );
75 wxDEPRECATED( wxString GetHostName() const );
76 wxDEPRECATED( wxString GetPath() const );
77
78 //Use wxURI instead - this does not work that well
79 wxDEPRECATED( static wxString ConvertToValidURI(
80 const wxString& uri,
81 const wxChar* delims = wxT(";/?:@&=+$,")
82 ) );
83
84 //Use wxURI::Unescape instead
85 wxDEPRECATED( static wxString ConvertFromURI(const wxString& uri) );
86#endif
87
88protected:
89 static wxProtoInfo *ms_protocols;
90
91#if wxUSE_PROTOCOL_HTTP
92 static wxHTTP *ms_proxyDefault;
93 static bool ms_useDefaultProxy;
94 wxHTTP *m_proxy;
95#endif // wxUSE_PROTOCOL_HTTP
96
97#if wxUSE_URL_NATIVE
98 friend class wxURLNativeImp;
99 // pointer to a native URL implementation object
100 wxURLNativeImp *m_nativeImp;
101 // Creates on the heap and returns a native
102 // implementation object for the current platform.
103 static wxURLNativeImp *CreateNativeImpObject();
104#endif
105 wxProtoInfo *m_protoinfo;
106 wxProtocol *m_protocol;
107
108 wxURLError m_error;
109 wxString m_url;
110 bool m_useProxy;
111
112 void Init(const wxString&);
113 bool ParseURL();
114 void CleanData();
115 bool FetchProtocol();
116
117 friend class wxProtoInfo;
118 friend class wxURLModule;
119
120private:
121 DECLARE_DYNAMIC_CLASS(wxURL)
122};
123
124#endif // wxUSE_URL
125
126#endif // _WX_URL_H
127