1 ------------------------------------------------------------------------------
4 -- Copyright (C) 2007 --
5 -- Pascal Obry - Olivier Ramonat --
7 -- This library is free software; you can redistribute it and/or modify --
8 -- it under the terms of the GNU General Public License as published by --
9 -- the Free Software Foundation; either version 2 of the License, or (at --
10 -- your option) any later version. --
12 -- This library is distributed in the hope that it will be useful, but --
13 -- WITHOUT ANY WARRANTY; without even the implied warranty of --
14 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
15 -- General Public License for more details. --
17 -- You should have received a copy of the GNU General Public License --
18 -- along with this library; if not, write to the Free Software Foundation, --
19 -- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. --
20 ------------------------------------------------------------------------------
24 type Parameter_Name
is (<>);
25 -- The list of parameter names to handle
27 Max_Vector_Size
: Positive := 1_024
;
28 -- Maximum size of a vector in the config file
30 package Morzhol
.Iniparser
is
38 procedure Open
(Config_File_Name
: in String);
41 -- Close and discard changes
44 -- Close and save changes
46 Unknown_Parameter
: exception;
47 -- Raised when a parameter name is not known
49 Uncomplete_Config
: exception;
50 -- Raised when some parameters are not specified in the config file
54 -- Accessor functions for simple types
56 function Get_Value
(Parameter
: in Parameter_Name
) return String;
57 function Get_Value
(Parameter
: in Parameter_Name
) return Integer;
58 function Get_Value
(Parameter
: in Parameter_Name
) return Float;
59 function Get_Value
(Parameter
: in Parameter_Name
) return Boolean;
61 -- To change the value of a parameter of simple types
64 (Parameter
: in Parameter_Name
; Value
: in String);
66 (Parameter
: in Parameter_Name
; Value
: in Integer);
68 (Parameter
: in Parameter_Name
; Value
: in Float);
70 (Parameter
: in Parameter_Name
; Value
: in Boolean);
72 -- Handle enumeration types
76 package Enum_Values
is
78 function Get_Value
(Parameter
: in Parameter_Name
) return Enum
;
81 (Parameter
: in Parameter_Name
; Value
: in Enum
);
85 -- Handle vectors parameters
89 type Vector
is array (Positive range <>) of T
;
93 Last
: out Positive) is <>;
94 with function Image
(Item
: in T
) return String is <>;
95 package Vector_Values
is
97 function Get_Value
(Parameter
: in Parameter_Name
) return Vector
;
100 (Parameter
: in Parameter_Name
; Value
: in Vector
);
104 end Morzhol
.Iniparser
;