]> git.saurik.com Git - wxWidgets.git/blob - include/wx/url.h
* Added wxsocket lib and sample (I hope I don't forget some file)
[wxWidgets.git] / include / wx / url.h
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 #include "wx/protocol/http.h"
24
25 typedef enum {
26 wxURL_NOERR = 0,
27 wxURL_SNTXERR,
28 wxURL_NOPROTO,
29 wxURL_NOHOST,
30 wxURL_NOPATH,
31 wxURL_CONNERR,
32 wxURL_PROTOERR
33 } wxURLError;
34
35 class WXDLLEXPORT wxURL : public wxObject {
36 DECLARE_DYNAMIC_CLASS(wxURL)
37 protected:
38 static wxProtoInfo *g_protocols;
39 static wxHTTP g_proxy;
40 wxProtoInfo *m_protoinfo;
41 wxProtocol *m_protocol;
42 wxHTTP m_proxy;
43 wxURLError m_error;
44 wxString m_protoname, m_hostname, m_servname, m_path, m_url;
45
46 bool PrepProto(wxString& url);
47 bool PrepHost(wxString& url);
48 bool PrepPath(wxString& url);
49 bool ParseURL();
50 void CleanData();
51 bool FetchProtocol();
52
53 friend class wxProtoInfo;
54 public:
55
56 wxURL(const wxString& url);
57 virtual ~wxURL();
58
59 inline wxString GetProtocolName() const
60 { return m_protoinfo->m_protoname; }
61 inline wxProtocol& GetProtocol() { return *m_protocol; }
62 inline wxURLError GetError() const { return m_error; }
63
64 wxInputStream *GetInputStream();
65
66 static void SetDefaultProxy(const wxString& url_proxy);
67 void SetProxy(const wxString& url_proxy);
68 };
69
70 #endif