]> git.saurik.com Git - wxWidgets.git/blame - include/wx/url.h
FALSE, not false
[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
19// wxWindows header
20#include "wx/object.h"
21
22// wxSocket headers
23#include "wx/protocol/protocol.h"
8a4df159
RR
24
25#if wxUSE_SOCKETS
26 #include "wx/protocol/http.h"
27#endif
f4ada568
GL
28
29typedef enum {
30 wxURL_NOERR = 0,
31 wxURL_SNTXERR,
32 wxURL_NOPROTO,
33 wxURL_NOHOST,
34 wxURL_NOPATH,
35 wxURL_CONNERR,
36 wxURL_PROTOERR
37} wxURLError;
38
b2b35524
VZ
39class WXDLLEXPORT wxURL : public wxObject
40{
f4ada568 41public:
b2b35524
VZ
42 wxURL(const wxString& url);
43 virtual ~wxURL();
44
45 wxString GetProtocolName() const { return m_protoinfo->m_protoname; }
f6bcfd97
BP
46 wxString GetHostName() const { return m_hostname; }
47 wxString GetURL() const { return m_url; }
48 wxProtocol& GetProtocol() { return *m_protocol; }
49 wxURLError GetError() const { return m_error; }
50 wxString GetPath() const { return m_path; }
f4ada568 51
b2b35524 52 wxInputStream *GetInputStream();
f4ada568 53
b2b35524
VZ
54#if wxUSE_SOCKETS
55 static void SetDefaultProxy(const wxString& url_proxy);
56 void SetProxy(const wxString& url_proxy);
57#endif // wxUSE_SOCKETS
f4ada568 58
f6bcfd97
BP
59 static wxString ConvertToValidURI(
60 const wxString& uri,
61 const wxChar* delims = wxT(";/?:@&=+$,")
62 );
b2b35524
VZ
63 static wxString ConvertFromURI(const wxString& uri);
64
65protected:
66 static wxProtoInfo *ms_protocols;
f4ada568 67
8a4df159 68#if wxUSE_SOCKETS
b2b35524
VZ
69 static wxHTTP *ms_proxyDefault;
70 static bool ms_useDefaultProxy;
71 wxHTTP *m_proxy;
72#endif // wxUSE_SOCKETS
73
74 wxProtoInfo *m_protoinfo;
75 wxProtocol *m_protocol;
76
77 wxURLError m_error;
78 wxString m_protoname, m_hostname, m_servname, m_path, m_url;
79 wxString m_user, m_password;
80 bool m_useProxy;
81
82 bool PrepProto(wxString& url);
83 bool PrepHost(wxString& url);
84 bool PrepPath(wxString& url);
85 bool ParseURL();
86 void CleanData();
87 bool FetchProtocol();
88
89 friend class wxProtoInfo;
90 friend class wxURLModule;
91
92private:
93 // VZ: can't use default copy ctor for this class, should write a correct
94 // one! (TODO)
1d53270b 95 DECLARE_NO_COPY_CLASS(wxURL)
14906731 96
b2b35524 97 DECLARE_DYNAMIC_CLASS(wxURL)
f4ada568
GL
98};
99
100#endif