Object | +---DURL
The DURL class implements a number of methods for using URLs accordingly the RFC1738 specification. Note: this class is not a validator; the url:/fromString: methods check only a few rules. ToDo: relative urls, factory method for protocol client classes.
#include <stdio.h> #include "ofc/DURL.h" int main(int argc, char *argv[]) { DURL *url1 = [DURL alloc]; DURL *url2 = [DURL new ]; DText *str; [url1 init :"http://ofc.dvoudheusden.net/index.html"]; // Init with an URL // Print the elements of the URL printf("URL consists of protocol (%s), host (%s), port(%d) and path (%s).\n", [url1 protocol], [url1 host], [url1 port], [url1 path]); // Build a URL [url2 scheme :"ftp"]; [url2 host :"www.example.org"]; [url2 user :"me" ]; [url2 password :"secret" ]; [url2 port :67 ]; [url2 path :"/pub" ]; str = [url2 url]; printf("URL: %s.\n", [str cstring]); [str free]; [url1 free]; // Cleanup [url2 free]; return 0; }