----------------------------------------------------------------------------- -- -- libwww-ada95 : A World Wide Web client library for Ada95 -- -- U R I -- -- S p e c -- -- Copyright (C) 1997-1998 Regents of the University of California -- -- libwww-ada95 is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the Free -- Software Foundation, with or without the single exception listed below; -- either version 2, or (at your option) any later version. libwww-ada95 is -- distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; -- without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -- PARTICULAR PURPOSE. See the GNU General Public License for more details. -- You should have received a copy of the GNU General Public License -- distributed with libwww-ada95; see the file COPYING. If not, write to the -- Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. -- -- As a special exception, if other files instantiate generics from this -- library, or you link this library with other files to produce an -- executable, this library does not by itself cause the resulting -- executable to be covered by the GNU General Public License. This -- exception does not however invalidate any other reasons why the -- executable file might be covered by the GNU General Public License. -- -- Created in 1997 by Kari Nies ----------------------------------------------------------------------------- with Ada.Strings.Unbounded; package URI is package UB_Strings renames Ada.Strings.Unbounded; subtype UB_String is UB_Strings.Unbounded_String; type Parsed_URI is tagged record Scheme : UB_String; Host : UB_String; Port : Natural := 0; -- 0 indicates undertermined port number Path : UB_String; Query : UB_String; end record; type URI_Object is record URI_String : UB_String; URI_Parsed : Parsed_URI; end record; type Access_URI is access all URI_Object; Invalid_URI : exception; type URI_Reference is record Ref_String : UB_String; Absolute_Form : URI_Object; Base_URI : Access_URI; -- note the base URI that we access -- -- must be declared as "aliased". assign -- -- URI_Reference.Base_URI := base'ACCESS end record; ------------------------------------------------------------------ -- Given a URI_String, extracts the host, port, path and query. -- Returns a parsed URI with this data. ------------------------------------------------------------------ function Parse_URI (URI_String : UB_String) return Parsed_URI; ----------------------------------------------------------------------- -- Given a URI_Object, Parses the associated URI string and initializes -- the associated parsed URI with the extracted host, port, path and -- query data. ----------------------------------------------------------------------- procedure Parse_URI (URI : in out URI_Object); ----------------------------------------------------------------------- -- Prints the contents of the given URI_Object. ----------------------------------------------------------------------- procedure Print_URI (URI : URI_Object); end URI;