cgi-config.ads


------------------------------------------------------------------------------
--
--  package CGI.Config (spec)
--
--  Handles various configuration information for CGI programs.
--
--  If the Forced_Language field in the configuration file is set to a
--  two-letter language code, then the program should use that language, no
--  matter what other parameters try to do.
--
------------------------------------------------------------------------------
--  Update information:
--
--  1996.07.08 (Jacob Sparre Andersen)
--    Written. Based on Comics_DB.Config (1996.05.15).
--
--  1996.07.14 (Jacob Sparre Andersen)
--    Added Forced_Language to Config_ID.
--    Declared the functions Force_Language and Get_Forced_Language.
--
--  (Insert additional update information above this line.)
------------------------------------------------------------------------------

with CGI.Flags;

package CGI.Config is

   ---------------------------------------------------------------------------
   --  Exceptions:

   No_Forced_Language : exception;

   ---------------------------------------------------------------------------
   --  function Base_File_Name:
   --
   --  Strips the command name of the extension, if it contains a '.'.

   function Base_File_Name return String;

   ---------------------------------------------------------------------------
   --  function Config_File_Name:
   --
   --  Returns a name for configuration file.

   function Config_File_Name return String;

   ---------------------------------------------------------------------------
   --  Configuration file elements:

   type Config_ID is (Base_URL, Base_Directory, Forced_Language);

   ---------------------------------------------------------------------------
   --  function Get:

   function Get (ID : in Config_ID) return String;

   ---------------------------------------------------------------------------
   --  function Parse_Config_Elements:
   --
   --  Translates variable names to the corresponding configuration data.
   --
   --  "Base_URL", "Base_Directory"  -  Extracted from the config file.
   --  "Base_File_Name"              -  Derived from the name of the program.
   --  Other variables will be translated to an empty string.

   function Parse_Config_Elements (Variable_Name : in String) return String;

   ---------------------------------------------------------------------------
   --  function Force_Language:
   --
   --  Checks if the program is forced to use a specific language.

   function Force_Language return Boolean;

   function Force_Language
     (Accepted_Languages : in CGI.Flags.Language_List_Type)
     return Boolean;

   ---------------------------------------------------------------------------
   --  function Get_Forced_Language:
   --
   --  If the program is forced to use a specific language, then this function
   --  returns the language.
   --
   --  Exceptions:
   --    No_Forced_Language - If Force_Language is False.

   function Get_Forced_Language return CGI.Flags.Language_Type;

   function Get_Forced_Language
     (Accepted_Languages : in CGI.Flags.Language_List_Type)
     return CGI.Flags.Language_Type;

   ---------------------------------------------------------------------------

end CGI.Config;

Typeset with Ada_To_HTML (Jacob and Jesper)