Fix build procedure.
[morzhol.git] / src / morzhol-iniparser.ads
blobef4e6856fb00de0143b0781bd0d67834cc8b2298
1 ------------------------------------------------------------------------------
2 -- Morzhol --
3 -- --
4 -- Copyright (C) 2007 --
5 -- Pascal Obry - Olivier Ramonat --
6 -- --
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. --
11 -- --
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. --
16 -- --
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 ------------------------------------------------------------------------------
22 generic
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
32 --------
33 -- IO --
34 --------
36 package IO is
38 procedure Open (Config_File_Name : in String);
40 procedure Close;
41 -- Close and discard changes
43 procedure Save_Close;
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
52 end IO;
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
63 procedure Set_Value
64 (Parameter : in Parameter_Name; Value : in String);
65 procedure Set_Value
66 (Parameter : in Parameter_Name; Value : in Integer);
67 procedure Set_Value
68 (Parameter : in Parameter_Name; Value : in Float);
69 procedure Set_Value
70 (Parameter : in Parameter_Name; Value : in Boolean);
72 -- Handle enumeration types
74 generic
75 type Enum is (<>);
76 package Enum_Values is
78 function Get_Value (Parameter : in Parameter_Name) return Enum;
80 procedure Set_Value
81 (Parameter : in Parameter_Name; Value : in Enum);
83 end Enum_Values;
85 -- Handle vectors parameters
87 generic
88 type T is private;
89 type Vector is array (Positive range <>) of T;
90 with procedure Get
91 (From : in String;
92 Item : out 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;
99 procedure Set_Value
100 (Parameter : in Parameter_Name; Value : in Vector);
102 end Vector_Values;
104 end Morzhol.Iniparser;