]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/url.h
Added WX_DEFINE_*_USER_EXPORTED_ARRAY macros for external dlls.
[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
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"
24
25#if wxUSE_SOCKETS
26 #include "wx/protocol/http.h"
27#endif
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
39class WXDLLEXPORT wxURL : public wxObject
40{
41public:
42 wxURL(const wxString& url);
43 virtual ~wxURL();
44
45 wxString GetProtocolName() const { return m_protoinfo->m_protoname; }
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; }
51
52 wxInputStream *GetInputStream();
53
54#if wxUSE_SOCKETS
55 static void SetDefaultProxy(const wxString& url_proxy);
56 void SetProxy(const wxString& url_proxy);
57#endif // wxUSE_SOCKETS
58
59 static wxString ConvertToValidURI(
60 const wxString& uri,
61 const wxChar* delims = wxT(";/?:@&=+$,")
62 );
63 static wxString ConvertFromURI(const wxString& uri);
64
65protected:
66 static wxProtoInfo *ms_protocols;
67
68#if wxUSE_SOCKETS
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)
95 DECLARE_NO_COPY_CLASS(wxURL)
96
97 DECLARE_DYNAMIC_CLASS(wxURL)
98};
99
100#endif