Make WvStreams compile with gcc 4.4.
[wvstreams.git] / include / wvurl.h
blobbb5150baa1d134f20beb796d15d22d8e13a91f49
1 /* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
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
11 #include "wvstring.h"
12 #include "wvresolver.h"
14 class WvIPPortAddr;
16 class WvUrl
18 public:
19 WvUrl(WvStringParm url);
20 WvUrl(const WvUrl &url);
21 ~WvUrl();
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)
29 operator WvString () const;
31 // not actually defined - this just prevents accidental copying
32 const WvUrl &operator= (const WvUrl &);
34 WvStringParm getproto() const
35 { return proto; }
37 // this one is ONLY valid if resolve() returns true!
38 const WvIPPortAddr getaddr() const
39 { return addr ? *addr : WvIPPortAddr(); }
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; }
52 protected:
53 WvString proto, hostname, user, password;
54 int port;
55 bool resolving;
56 WvResolver dns;
57 WvIPPortAddr *addr;
58 WvString file, err;
62 // backwards compatibility
63 typedef WvUrl WvURL;
65 #endif // __WVURL_H