$szTitle = "wxurl"; include "./_header.inc"; ?>
wxurl is a specialization of wxuri for parsing urls. please look at wxuri documentation for more info about the functions you can use to retrieve the various parts of the url (scheme, server, port, etc).
supports standard assignment operators, copy constructors, and comparison operators.
derived from
include files
<wx/url.h>
see also
members
wxurl::wxurl
wxurl::~wxurl
wxurl::getprotocol
wxurl::geterror
wxurl::getinputstream
wxurl::isok
wxurl::setdefaultproxy
wxurl::setproxy
wxurl::seturl
wxurl(const wxstring& url = wxemptystring)
constructs a url object from the string. the url must be valid according to rfc 1738. in particular, file urls must be of the format file://hostname/path/to/file otherwise geterror will return a value different from wxurl_noerr.
it is valid to leave out the hostname but slashes must remain in place - i.e. a file url without a hostname must contain three consecutive slashes (e.g. file:///somepath/myfile).
parameters
url
~wxurl()
destroys the url object.
wxprotocol& getprotocol()
returns a reference to the protocol which will be used to get the url.
wxurlerror geterror() const
returns the last error. this error refers to the url parsing or to the protocol. it can be one of these errors:
wxurl_noerr | no error. |
wxurl_sntxerr | syntax error in the url string. |
wxurl_noproto | found no protocol which can get this url. |
wxurl_nohost | an host name is required for this protocol. |
wxurl_nopath | a path is required for this protocol. |
wxurl_connerr | connection error. |
wxurl_protoerr | an error occurred during negotiation. |
wxinputstream * getinputstream()
creates a new input stream on the specified url. you can use all but seek functionality of wxstream. seek isn't available on all streams. for example, http or ftp streams don't deal with it.
note that this method is somewhat deprecated, all future wxwidgets applications should really use wxfilesystem instead.
example:
wxurl url("http://a.host/a.dir/a.file"); if (url.geterror() == wxurl_noerr) { wxinputstream *in_stream; in_stream = url.getinputstream(); // then, you can use all io calls of in_stream (see wxstream) }return value
returns the initialized stream. you will have to delete it yourself.
see also
bool isok() const
returns true if this object is correctly initialized, i.e. if geterror returns wxurl_noerr.
static void setdefaultproxy(const wxstring& url_proxy)
sets the default proxy server to use to get the url. the string specifies the proxy like this: <hostname>:<port number>.
parameters
url_proxy
see also
void setproxy(const wxstring& url_proxy)
sets the proxy to use for this url.
see also
wxurlerror seturl(const wxstring& url)
initializes this object with the given url and returns wxurl_noerr if it's valid (see geterror for more info).
include "./_footer.inc"; ?>