]> git.saurik.com Git - wxWidgets.git/blame - include/wx/url.h
Fixed typo in my last commit (it did break socket detection code :-( ).
[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
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
f6bcfd97 11
f4ada568
GL
12#ifndef _WX_URL_H
13#define _WX_URL_H
14
15#ifdef __GNUG__
16#pragma interface
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
b2b35524
VZ
40class WXDLLEXPORT wxURL : public wxObject
41{
f4ada568 42public:
b2b35524
VZ
43 wxURL(const wxString& url);
44 virtual ~wxURL();
45
46 wxString GetProtocolName() const { return m_protoinfo->m_protoname; }
f6bcfd97
BP
47 wxString GetHostName() const { return m_hostname; }
48 wxString GetURL() const { return m_url; }
49 wxProtocol& GetProtocol() { return *m_protocol; }
50 wxURLError GetError() const { return m_error; }
51 wxString GetPath() const { return m_path; }
f4ada568 52
b2b35524 53 wxInputStream *GetInputStream();
f4ada568 54
b2b35524
VZ
55#if wxUSE_SOCKETS
56 static void SetDefaultProxy(const wxString& url_proxy);
57 void SetProxy(const wxString& url_proxy);
58#endif // wxUSE_SOCKETS
f4ada568 59
f6bcfd97
BP
60 static wxString ConvertToValidURI(
61 const wxString& uri,
62 const wxChar* delims = wxT(";/?:@&=+$,")
63 );
b2b35524
VZ
64 static wxString ConvertFromURI(const wxString& uri);
65
66protected:
67 static wxProtoInfo *ms_protocols;
f4ada568 68
8a4df159 69#if wxUSE_SOCKETS
b2b35524
VZ
70 static wxHTTP *ms_proxyDefault;
71 static bool ms_useDefaultProxy;
72 wxHTTP *m_proxy;
73#endif // wxUSE_SOCKETS
74
75 wxProtoInfo *m_protoinfo;
76 wxProtocol *m_protocol;
77
78 wxURLError m_error;
79 wxString m_protoname, m_hostname, m_servname, m_path, m_url;
80 wxString m_user, m_password;
81 bool m_useProxy;
82
83 bool PrepProto(wxString& url);
84 bool PrepHost(wxString& url);
85 bool PrepPath(wxString& url);
86 bool ParseURL();
87 void CleanData();
88 bool FetchProtocol();
89
90 friend class wxProtoInfo;
91 friend class wxURLModule;
92
93private:
94 // VZ: can't use default copy ctor for this class, should write a correct
95 // one! (TODO)
1d53270b 96 DECLARE_NO_COPY_CLASS(wxURL)
14906731 97
b2b35524 98 DECLARE_DYNAMIC_CLASS(wxURL)
f4ada568
GL
99};
100
a5d46b73
VZ
101#endif // wxUSE_URL
102
103#endif // _WX_URL_H
104