1. -- 
  2. -- Copyright (c) 2012 Kevin Wellwood 
  3. -- All rights reserved. 
  4. -- 
  5. -- This source code is distributed under the Modified BSD License. For terms and 
  6. -- conditions, see license.txt. 
  7. -- 
  8.  
  9. package Preferences is 
  10.  
  11.     -- Initializes the preference system. The prefences in file 'filename' will 
  12.     -- be loaded and the auto-save task will begin. 
  13.     procedure Initialize( filename : String ); 
  14.  
  15.     -- Finalizes the preference system. All non-default preferences will be 
  16.     -- written to the filename provided at initialization, and the auto-save 
  17.     -- task will end. 
  18.     procedure Finalize; 
  19.  
  20.     ---------------------------------------------------------------------------- 
  21.  
  22.     -- These procedures return a value for the section.name preference. If the 
  23.     -- preference has never been set, a default value that has been previously 
  24.     -- set by calling Set_Default() will be returned. If Set_Default for the 
  25.     -- preference has not been called, then 'secondDefault' will be returned as 
  26.     -- a secondary default. If 'section' is not specified, "preference" will be 
  27.     -- used and the secondDefault value will be unavailable, to avoid abiguity. 
  28.  
  29.     function Get_Pref( name : String ) return Boolean; 
  30.  
  31.     function Get_Pref( name : String ) return Float; 
  32.  
  33.     function Get_Pref( name : String ) return Integer; 
  34.  
  35.     function Get_Pref( name : String ) return String; 
  36.  
  37.     function Get_Pref( section, name : String; 
  38.                        secondDefault : Boolean := False ) return Boolean; 
  39.  
  40.     function Get_Pref( section, name : String; 
  41.                        secondDefault : Float := 0.0 ) return Float; 
  42.  
  43.     function Get_Pref( section, name : String; 
  44.                        secondDefault : Integer := 0 ) return Integer; 
  45.  
  46.     function Get_Pref( section, name : String; 
  47.                        secondDefault : String := "" ) return String; 
  48.  
  49.     ---------------------------------------------------------------------------- 
  50.  
  51.     -- These procedures set the value of the section.name preference. All set 
  52.     -- values will be saved to the preference file. If 'section' is not 
  53.     -- specified, "preference" will be used. 
  54.  
  55.     procedure Set_Pref( name : String; value : Boolean ); 
  56.  
  57.     procedure Set_Pref( name : String; value : Float ); 
  58.  
  59.     procedure Set_Pref( name : String; value : Integer ); 
  60.  
  61.     procedure Set_Pref( name : String; value : String ); 
  62.  
  63.     procedure Set_Pref( section, name : String; value : Boolean ); 
  64.  
  65.     procedure Set_Pref( section, name : String; value : Float ); 
  66.  
  67.     procedure Set_Pref( section, name : String; value : Integer ); 
  68.  
  69.     procedure Set_Pref( section, name : String; value : String ); 
  70.  
  71.     ---------------------------------------------------------------------------- 
  72.  
  73.     -- These procedures set a default value for the section.name preference. 
  74.     -- Default values are not written to the preference file. If 'section' is 
  75.     -- not specified, "preference" will be used. 
  76.  
  77.     procedure Set_Default( name : String; value : Boolean ); 
  78.  
  79.     procedure Set_Default( name : String; value : Float ); 
  80.  
  81.     procedure Set_Default( name : String; value : Integer ); 
  82.  
  83.     procedure Set_Default( name : String; value : String ); 
  84.  
  85.     procedure Set_Default( section, name : String; value : Boolean ); 
  86.  
  87.     procedure Set_Default( section, name : String; value : Float ); 
  88.  
  89.     procedure Set_Default( section, name : String; value : Integer ); 
  90.  
  91.     procedure Set_Default( section, name : String; value : String ); 
  92.  
  93. end Preferences;