Class DURL

Inherits from:
Object
Conforms to:
DParsable, DTextable
Declared in:
DURL.h

Class Hierarchy

    Object
      |
      +---DURL

Class Description

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.

Example:
#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;
}
Last modified:
05-Aug-2008 (DURL.h)

Instance Variables

private DText *_scheme
the scheme (or protocol) of the url
private DText *_user
the username in the url
private BOOL _noUser
there is no user name in the url
private DText *_password
the password in the url
private BOOL _noPassword
there is no password in the url
private DText *_host
the host
private DInt *_port
the port number
private DText *_path
the path

Method Index


generated 06-Sep-2008 by ObjcDoc 3.0.0