WvStreams
include/wvurl.h
1/* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4 *
5 * WvURL is a simple URL-parsing class with built-in (though still somewhat
6 * inconvenient) DNS resolution.
7 */
8#ifndef __WVURL_H
9#define __WVURL_H
10
11#include "wvstring.h"
12#include "wvresolver.h"
13
14class WvIPPortAddr;
15
16class WvUrl
17{
18public:
20 WvUrl(const WvUrl &url);
21 ~WvUrl();
22
23 bool isok() const
24 { return port != 0 && (resolving || addr != NULL); }
25 WvStringParm errstr() const
26 { return err; }
27 bool resolve(); // dns-resolve the hostname (returns true if done)
28
29 operator WvString () const;
30
31 // not actually defined - this just prevents accidental copying
32 const WvUrl &operator= (const WvUrl &);
33
34 WvStringParm getproto() const
35 { return proto; }
36
37 // this one is ONLY valid if resolve() returns true!
38 const WvIPPortAddr getaddr() const
39 { return addr ? *addr : WvIPPortAddr(); }
40
41 WvStringParm getfile() const
42 { return file; }
43 WvStringParm gethost() const
44 { return hostname; }
45 int getport() const
46 { return port; }
47 WvStringParm getuser() const
48 { return user; }
49 WvStringParm getpassword() const
50 { return password; }
51
52protected:
53 WvString proto, hostname, user, password;
54 int port;
55 bool resolving;
56 WvResolver dns;
57 WvIPPortAddr *addr;
58 WvString file, err;
59};
60
61
62// backwards compatibility
63typedef WvUrl WvURL;
64
65#endif // __WVURL_H
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
An IP+Port address also includes a port number, with the resulting form www.xxx.yyy....
ASynchronous DNS resolver functions, so that we can do non-blocking lookups.
WvString is an implementation of a simple and efficient printable-string class.