]> git.saurik.com Git - wxWidgets.git/blame - include/wx/url.h
Use DeafultAttributes instead of hard coded defaults
[wxWidgets.git] / include / wx / url.h
CommitLineData
f4ada568
GL
1/////////////////////////////////////////////////////////////////////////////
2// Name: url.h
3// Purpose: URL parser
4// Author: Guilhem Lavaux
5// Modified by:
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
a5d46b73 23#include "wx/object.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
7c4728f6 51class WXDLLIMPEXP_NET wxURL : public wxObject
b2b35524 52{
f4ada568 53public:
b2b35524
VZ
54 wxURL(const wxString& url);
55 virtual ~wxURL();
56
57 wxString GetProtocolName() const { return m_protoinfo->m_protoname; }
f6bcfd97
BP
58 wxString GetHostName() const { return m_hostname; }
59 wxString GetURL() const { return m_url; }
60 wxProtocol& GetProtocol() { return *m_protocol; }
61 wxURLError GetError() const { return m_error; }
62 wxString GetPath() const { return m_path; }
f4ada568 63
b2b35524 64 wxInputStream *GetInputStream();
f4ada568 65
b2b35524
VZ
66#if wxUSE_SOCKETS
67 static void SetDefaultProxy(const wxString& url_proxy);
68 void SetProxy(const wxString& url_proxy);
69#endif // wxUSE_SOCKETS
f4ada568 70
f6bcfd97
BP
71 static wxString ConvertToValidURI(
72 const wxString& uri,
73 const wxChar* delims = wxT(";/?:@&=+$,")
74 );
b2b35524
VZ
75 static wxString ConvertFromURI(const wxString& uri);
76
77protected:
78 static wxProtoInfo *ms_protocols;
f4ada568 79
8a4df159 80#if wxUSE_SOCKETS
b2b35524
VZ
81 static wxHTTP *ms_proxyDefault;
82 static bool ms_useDefaultProxy;
83 wxHTTP *m_proxy;
84#endif // wxUSE_SOCKETS
85
25959b95
VZ
86#if wxUSE_URL_NATIVE
87 friend class wxURLNativeImp;
88 // pointer to a native URL implementation object
89 wxURLNativeImp *m_nativeImp;
90 // Creates on the heap and returns a native
91 // implementation object for the current platform.
92 static wxURLNativeImp *CreateNativeImpObject();
93#endif
b2b35524
VZ
94 wxProtoInfo *m_protoinfo;
95 wxProtocol *m_protocol;
96
97 wxURLError m_error;
98 wxString m_protoname, m_hostname, m_servname, m_path, m_url;
99 wxString m_user, m_password;
100 bool m_useProxy;
101
102 bool PrepProto(wxString& url);
103 bool PrepHost(wxString& url);
104 bool PrepPath(wxString& url);
105 bool ParseURL();
106 void CleanData();
107 bool FetchProtocol();
108
109 friend class wxProtoInfo;
110 friend class wxURLModule;
111
112private:
113 // VZ: can't use default copy ctor for this class, should write a correct
114 // one! (TODO)
1d53270b 115 DECLARE_NO_COPY_CLASS(wxURL)
14906731 116
b2b35524 117 DECLARE_DYNAMIC_CLASS(wxURL)
f4ada568
GL
118};
119
a5d46b73
VZ
120#endif // wxUSE_URL
121
122#endif // _WX_URL_H
123