]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/url.h
Try native method first in LoadFile() and SaveFile()
[wxWidgets.git] / interface / wx / url.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: url.h
e54c96f1 3// Purpose: interface of wxURL
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
fbec75d0
BP
8/**
9 Error types returned from wxURL::GetError().
10*/
11typedef enum {
12 wxURL_NOERR = 0, ///< No error.
13 wxURL_SNTXERR, ///< Syntax error in the URL string.
14 wxURL_NOPROTO, ///< Found no protocol which can get this URL.
15 wxURL_NOHOST, ///< A host name is required for this protocol.
16 wxURL_NOPATH, ///< A path is required for this protocol.
17 wxURL_CONNERR, ///< Connection error.
18 wxURL_PROTOERR ///< An error occurred during negotiation.
19} wxURLError;
20
23324ae1
FM
21/**
22 @class wxURL
7c913512 23
fbec75d0
BP
24 wxURL is a specialization of wxURI for parsing URLs. Please look at wxURI
25 documentation for more info about the functions you can use to retrieve the
26 various parts of the URL (scheme, server, port, etc).
7c913512 27
fbec75d0
BP
28 Supports standard assignment operators, copy constructors, and comparison
29 operators.
7c913512 30
23324ae1
FM
31 @library{wxnet}
32 @category{net}
7c913512 33
e54c96f1 34 @see wxSocketBase, wxProtocol
23324ae1
FM
35*/
36class wxURL : public wxURI
37{
38public:
39 /**
fbec75d0
BP
40 Constructs a URL object from the string. The URL must be valid
41 according to RFC 1738. In particular, file URLs must be of the format
42 @c "file://hostname/path/to/file", otherwise GetError() will return a
43 value different from ::wxURL_NOERR.
44
45 It is valid to leave out the hostname but slashes must remain in place,
46 in other words, a file URL without a hostname must contain three
47 consecutive slashes (e.g. @c "file:///somepath/myfile").
3c4f71cc 48
7c913512 49 @param url
4cc4bfaf 50 Url string to parse.
23324ae1 51 */
4cc4bfaf 52 wxURL(const wxString& url = wxEmptyString);
23324ae1
FM
53
54 /**
55 Destroys the URL object.
56 */
adaaa686 57 virtual ~wxURL();
23324ae1
FM
58
59 /**
fbec75d0
BP
60 Returns the last error. This error refers to the URL parsing or to the
61 protocol. It can be one of ::wxURLError.
23324ae1 62 */
328f5751 63 wxURLError GetError() const;
23324ae1
FM
64
65 /**
fbec75d0
BP
66 Creates a new input stream on the specified URL. You can use all but
67 seek functionality of wxStream. Seek isn't available on all streams.
68 For example, HTTP or FTP streams don't deal with it.
69
70 Note that this method is somewhat deprecated, all future wxWidgets
71 applications should use wxFileSystem instead.
72
23324ae1 73 Example:
3c4f71cc 74
fbec75d0
BP
75 @code
76 wxURL url("http://a.host/a.dir/a.file");
77 if (url.GetError() == wxURL_NOERR)
78 {
79 wxInputStream *in_stream;
80
81 in_stream = url.GetInputStream();
82 // Then, you can use all IO calls of in_stream (See wxStream)
83 }
84 @endcode
85
d29a9a8a 86 @return Returns the initialized stream. You will have to delete it
4cc4bfaf 87 yourself.
3c4f71cc 88
4cc4bfaf 89 @see wxInputStream
23324ae1 90 */
4cc4bfaf 91 wxInputStream* GetInputStream();
23324ae1
FM
92
93 /**
94 Returns a reference to the protocol which will be used to get the URL.
95 */
cfbe5614 96 wxProtocol& GetProtocol();
23324ae1
FM
97
98 /**
0824e369 99 Returns @true if this object is correctly initialized, i.e.\ if
fbec75d0 100 GetError() returns ::wxURL_NOERR.
23324ae1 101 */
328f5751 102 bool IsOk() const;
23324ae1
FM
103
104 /**
fbec75d0
BP
105 Sets the default proxy server to use to get the URL. The string
106 specifies the proxy like this: @c "<hostname>:<port number>".
3c4f71cc 107
7c913512 108 @param url_proxy
fbec75d0 109 Specifies the proxy to use.
3c4f71cc 110
4cc4bfaf 111 @see SetProxy()
23324ae1
FM
112 */
113 static void SetDefaultProxy(const wxString& url_proxy);
114
115 /**
116 Sets the proxy to use for this URL.
3c4f71cc 117
4cc4bfaf 118 @see SetDefaultProxy()
23324ae1
FM
119 */
120 void SetProxy(const wxString& url_proxy);
121
122 /**
fbec75d0
BP
123 Initializes this object with the given URL and returns ::wxURL_NOERR if
124 it's valid (see GetError() for more info).
23324ae1 125 */
4cc4bfaf 126 wxURLError SetURL(const wxString& url);
23324ae1 127};
e54c96f1 128