]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/url.h
more updates
[wxWidgets.git] / include / wx / url.h
... / ...
CommitLineData
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/////////////////////////////////////////////////////////////////////////////
11#ifndef _WX_URL_H
12#define _WX_URL_H
13
14#ifdef __GNUG__
15#pragma interface
16#endif
17
18// wxWindows header
19#include "wx/object.h"
20
21// wxSocket headers
22#include "wx/protocol/protocol.h"
23
24#if wxUSE_SOCKETS
25 #include "wx/protocol/http.h"
26#endif
27
28typedef enum {
29 wxURL_NOERR = 0,
30 wxURL_SNTXERR,
31 wxURL_NOPROTO,
32 wxURL_NOHOST,
33 wxURL_NOPATH,
34 wxURL_CONNERR,
35 wxURL_PROTOERR
36} wxURLError;
37
38class WXDLLEXPORT wxURL : public wxObject {
39 DECLARE_DYNAMIC_CLASS(wxURL)
40protected:
41 static wxProtoInfo *g_protocols;
42#if wxUSE_SOCKETS
43 static wxHTTP *g_proxy;
44#endif
45 wxProtoInfo *m_protoinfo;
46 wxProtocol *m_protocol;
47#if wxUSE_SOCKETS
48 wxHTTP *m_proxy;
49#endif
50 wxURLError m_error;
51 wxString m_protoname, m_hostname, m_servname, m_path, m_url;
52 wxString m_user, m_password;
53 bool m_useProxy;
54
55 bool PrepProto(wxString& url);
56 bool PrepHost(wxString& url);
57 bool PrepPath(wxString& url);
58 bool ParseURL();
59 void CleanData();
60 bool FetchProtocol();
61
62 friend class wxProtoInfo;
63 friend class wxProtocolModule;
64public:
65
66 wxURL(const wxString& url);
67 virtual ~wxURL();
68
69 inline wxString GetProtocolName() const
70 { return m_protoinfo->m_protoname; }
71 inline wxString GetHostName() const { return m_hostname; }
72 inline wxString GetURL() const { return m_url; }
73 inline wxProtocol& GetProtocol() { return *m_protocol; }
74 inline wxURLError GetError() const { return m_error; }
75 inline wxString GetPath() const { return m_path; }
76
77 wxInputStream *GetInputStream();
78
79#if wxUSE_SOCKETS
80 static void SetDefaultProxy(const wxString& url_proxy);
81 void SetProxy(const wxString& url_proxy);
82#endif
83
84 static wxString ConvertToValidURI(const wxString& uri);
85 static wxString ConvertFromURI(const wxString& uri);
86};
87
88#endif