gnoga_2.1.2_5f127c56/demo/localize/localize-parser.ads

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
-------------------------------------------------------------------------------
-- NAME (specification)         : localize-parser.ads
-- AUTHOR                       : Pascal Pignard
-- ROLE                         : Localization files parser unit.
-- NOTES                        : Ada 2012, GNOGA 2.1 alpha
--
-- COPYRIGHT                    : (c) Pascal Pignard 2021
-- LICENCE                      : CeCILL V2 (http://www.cecill.info)
-- CONTACT                      : http://blady.pagesperso-orange.fr
-------------------------------------------------------------------------------

with Ada.Containers.Indefinite_Vectors;
with Ada.Containers.Ordered_Maps;

package Localize.Parser is

   package Lists is new Ada.Containers.Indefinite_Vectors (Positive, String);
   subtype Key_List is Lists.Vector;

   type Property_List is private;

   procedure Read
     (Properties : out Property_List;
      File_Name  :     String);
   procedure Write
     (Properties : Property_List;
      File_Name  : String);

   function Keys
     (Properties : Property_List)
      return Key_List;
   function Selected_Keys
     (Master, Locale : Property_List;
      Pattern        : String)
      return Key_List;
   function Contains
     (Properties : Property_List;
      Key        : String)
      return Boolean;

   function Text
     (Properties : Property_List;
      Key        : String)
      return String;
   procedure Text
     (Properties : in out Property_List;
      Key        :        String;
      Value      :        String);
   function Comment
     (Properties : Property_List;
      Key        : String)
      return String;
   procedure Comment
     (Properties : in out Property_List;
      Key        :        String;
      Value      :        String);

   procedure Insert
     (Properties : in out Property_List;
      Key        :        String);
   procedure Delete
     (Properties : in out Property_List;
      Key        :        String);
   procedure Rename
     (Properties : in out Property_List;
      From, To   :        String);
   function Modified
     (Properties : Property_List;
      Key        : String)
      return Boolean;
   procedure Reset_Modified_Indicators (Properties : in out Property_List);

private

   type Property_Type is record
      Comment  : String;
      Text     : String;
      Modified : Boolean;
   end record;
   package Content_Maps is new Ada.Containers.Ordered_Maps (String, Property_Type);
   type Property_List is new Content_Maps.Map with null record;

end Localize.Parser;