]> git.saurik.com Git - wxWidgets.git/blame - include/wx/url.h
Minor additions to make working with binary buffers easier.
[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/////////////////////////////////////////////////////////////////////////////
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"
8a4df159
RR
23
24#if wxUSE_SOCKETS
25 #include "wx/protocol/http.h"
26#endif
f4ada568
GL
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;
8a4df159 42#if wxUSE_SOCKETS
3b4183d8 43 static wxHTTP *g_proxy;
8a4df159 44#endif
f4ada568
GL
45 wxProtoInfo *m_protoinfo;
46 wxProtocol *m_protocol;
8a4df159 47#if wxUSE_SOCKETS
f61815af 48 wxHTTP *m_proxy;
8a4df159 49#endif
f4ada568
GL
50 wxURLError m_error;
51 wxString m_protoname, m_hostname, m_servname, m_path, m_url;
856d2e52 52 wxString m_user, m_password;
f61815af 53 bool m_useProxy;
f4ada568
GL
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;
3b4183d8 63 friend class wxProtocolModule;
f4ada568
GL
64public:
65
66 wxURL(const wxString& url);
67 virtual ~wxURL();
68
69 inline wxString GetProtocolName() const
70 { return m_protoinfo->m_protoname; }
f61815af
GL
71 inline wxString GetHostName() const { return m_hostname; }
72 inline wxString GetURL() const { return m_url; }
f4ada568
GL
73 inline wxProtocol& GetProtocol() { return *m_protocol; }
74 inline wxURLError GetError() const { return m_error; }
375abe3d 75 inline wxString GetPath() const { return m_path; }
f4ada568
GL
76
77 wxInputStream *GetInputStream();
78
8a4df159 79#if wxUSE_SOCKETS
f4ada568
GL
80 static void SetDefaultProxy(const wxString& url_proxy);
81 void SetProxy(const wxString& url_proxy);
8a4df159 82#endif
14906731
GL
83
84 static wxString ConvertToValidURI(const wxString& uri);
aa6d9706 85 static wxString ConvertFromURI(const wxString& uri);
f4ada568
GL
86};
87
88#endif