1------------------------------------------------------------------------------
2--                                                                          --
3--                            Matreshka Project                             --
4--                                                                          --
5--                               XML Processor                              --
6--                                                                          --
7--                        Runtime Library Component                         --
8--                                                                          --
9------------------------------------------------------------------------------
10--                                                                          --
11-- Copyright © 2011, Vadim Godunko <vgodunko@gmail.com>                     --
12-- All rights reserved.                                                     --
13--                                                                          --
14-- Redistribution and use in source and binary forms, with or without       --
15-- modification, are permitted provided that the following conditions       --
16-- are met:                                                                 --
17--                                                                          --
18--  * Redistributions of source code must retain the above copyright        --
19--    notice, this list of conditions and the following disclaimer.         --
20--                                                                          --
21--  * Redistributions in binary form must reproduce the above copyright     --
22--    notice, this list of conditions and the following disclaimer in the   --
23--    documentation and/or other materials provided with the distribution.  --
24--                                                                          --
25--  * Neither the name of the Vadim Godunko, IE nor the names of its        --
26--    contributors may be used to endorse or promote products derived from  --
27--    this software without specific prior written permission.              --
28--                                                                          --
29-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS      --
30-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT        --
31-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR    --
32-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT     --
33-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,   --
34-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
35-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR   --
36-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF   --
37-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING     --
38-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS       --
39-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.             --
40--                                                                          --
41------------------------------------------------------------------------------
42--  $Revision: 2098 $ $Date: 2011-08-19 21:18:33 +0400 (Fri, 19 Aug 2011) $
43------------------------------------------------------------------------------
44with Ada.Containers.Vectors;
45
46with League.Strings;
47
48package Matreshka.XML_Catalogs.Entry_Files is
49
50   type Prefer_Mode is (System, Public);
51
52   type Catalog_Entry_File is tagged;
53   type Catalog_Entry_File_Access is access all Catalog_Entry_File;
54
55   type Public_Entry;
56   type Public_Entry_Access is access all Public_Entry;
57
58   type System_Entry;
59   type System_Entry_Access is access all System_Entry;
60
61   type Rewrite_System_Entry;
62   type Rewrite_System_Entry_Access is access all Rewrite_System_Entry;
63
64   type System_Suffix_Entry;
65   type System_Suffix_Entry_Access is access all System_Suffix_Entry;
66
67   type Delegate_Public_Entry;
68   type Delegate_Public_Entry_Access is access all Delegate_Public_Entry;
69
70   type Delegate_System_Entry;
71   type Delegate_System_Entry_Access is access all Delegate_System_Entry;
72
73   type URI_Entry;
74   type URI_Entry_Access is access all URI_Entry;
75
76   type Rewrite_URI_Entry;
77   type Rewrite_URI_Entry_Access is access all Rewrite_URI_Entry;
78
79   type URI_Suffix_Entry;
80   type URI_Suffix_Entry_Access is access all URI_Suffix_Entry;
81
82   type Delegate_URI_Entry;
83   type Delegate_URI_Entry_Access is access all Delegate_URI_Entry;
84
85   type Next_Catalog_Entry;
86   type Next_Catalog_Entry_Access is access all Next_Catalog_Entry;
87
88   package Catalog_Entry_File_Vectors is
89     new Ada.Containers.Vectors (Positive, Catalog_Entry_File_Access);
90
91   package Public_Entry_Vectors is
92     new Ada.Containers.Vectors (Positive, Public_Entry_Access);
93
94   package System_Entry_Vectors is
95     new Ada.Containers.Vectors (Positive, System_Entry_Access);
96
97   package Rewrite_System_Entry_Vectors is
98     new Ada.Containers.Vectors (Positive, Rewrite_System_Entry_Access);
99
100   package System_Suffix_Entry_Vectors is
101     new Ada.Containers.Vectors (Positive, System_Suffix_Entry_Access);
102
103   package Delegate_Public_Entry_Vectors is
104     new Ada.Containers.Vectors (Positive, Delegate_Public_Entry_Access);
105
106   package Delegate_System_Entry_Vectors is
107     new Ada.Containers.Vectors (Positive, Delegate_System_Entry_Access);
108
109   package URI_Entry_Vectors is
110     new Ada.Containers.Vectors (Positive, URI_Entry_Access);
111
112   package Rewrite_URI_Entry_Vectors is
113     new Ada.Containers.Vectors (Positive, Rewrite_URI_Entry_Access);
114
115   package URI_Suffix_Entry_Vectors is
116     new Ada.Containers.Vectors (Positive, URI_Suffix_Entry_Access);
117
118   package Delegate_URI_Entry_Vectors is
119     new Ada.Containers.Vectors (Positive, Delegate_URI_Entry_Access);
120
121   package Next_Catalog_Entry_Vectors is
122     new Ada.Containers.Vectors (Positive, Next_Catalog_Entry_Access);
123
124   type Public_Entry is limited record
125      Public_Id : League.Strings.Universal_String;
126      URI       : League.Strings.Universal_String;
127      Prefer    : Prefer_Mode;
128   end record;
129
130   type System_Entry is limited record
131      System_Id : League.Strings.Universal_String;
132      URI       : League.Strings.Universal_String;
133   end record;
134
135   type Rewrite_System_Entry is limited record
136      System_Id : League.Strings.Universal_String;
137      Prefix    : League.Strings.Universal_String;
138   end record;
139
140   type System_Suffix_Entry is limited record
141      System_Id : League.Strings.Universal_String;
142      URI       : League.Strings.Universal_String;
143   end record;
144
145   type Delegate_Public_Entry is limited record
146      Public_Id : League.Strings.Universal_String;
147      Catalog   : League.Strings.Universal_String;
148      Prefer    : Prefer_Mode;
149   end record;
150
151   type Delegate_System_Entry is limited record
152      System_Id : League.Strings.Universal_String;
153      Catalog   : League.Strings.Universal_String;
154   end record;
155
156   type URI_Entry is limited record
157      Name : League.Strings.Universal_String;
158      URI  : League.Strings.Universal_String;
159   end record;
160
161   type Rewrite_URI_Entry is limited record
162      Prefix  : League.Strings.Universal_String;
163      Rewrite : League.Strings.Universal_String;
164   end record;
165
166   type URI_Suffix_Entry is limited record
167      Suffix : League.Strings.Universal_String;
168      URI    : League.Strings.Universal_String;
169   end record;
170
171   type Delegate_URI_Entry is limited record
172      Prefix  : League.Strings.Universal_String;
173      Catalog : League.Strings.Universal_String;
174   end record;
175
176   type Next_Catalog_Entry is limited record
177      Catalog             : League.Strings.Universal_String;
178      Default_Prefer_Mode : Prefer_Mode;
179      File                : Catalog_Entry_File_Access;
180   end record;
181
182   type Catalog_Entry_File is tagged limited record
183      Default_Prefer_Mode     : Prefer_Mode;
184      --  Default prefer mode.
185
186      Public_Entries          : Public_Entry_Vectors.Vector;
187      --  List of 'public' entries of entry file.
188
189      System_Entries          : System_Entry_Vectors.Vector;
190      --  List of 'system' entries of entry file.
191
192      Rewrite_System_Entries  : Rewrite_System_Entry_Vectors.Vector;
193      --  List of 'rewriteSystem' entries of entry file.
194
195      System_Suffix_Entries   : System_Suffix_Entry_Vectors.Vector;
196      --  List of 'systemSuffix' entries of entry file.
197
198      Delegate_Public_Entries : Delegate_Public_Entry_Vectors.Vector;
199      --  List of 'delegatePublic' entries on the entry file.
200
201      Delegate_System_Entries : Delegate_System_Entry_Vectors.Vector;
202      --  List of 'delegateSystem' entries on the entry file.
203
204      URI_Entries             : URI_Entry_Vectors.Vector;
205      --  List of 'uri' entries of entry file.
206
207      Rewrite_URI_Entries     : Rewrite_URI_Entry_Vectors.Vector;
208      --  List of 'rewriteURI' entries of entry file.
209
210      URI_Suffix_Entries      : URI_Suffix_Entry_Vectors.Vector;
211      --  List of 'uriSuffix' entries of entry file.
212
213      Delegate_URI_Entries    : Delegate_URI_Entry_Vectors.Vector;
214      --  List of 'delegateURI' entries of entry file.
215
216      Next_Catalog_Entries    : Next_Catalog_Entry_Vectors.Vector;
217      --  List of 'nextCatalog' entries of entry file.
218   end record;
219
220   type Catalog_Entry_File_List is tagged limited record
221      Catalog_Entry_Files : Catalog_Entry_File_Vectors.Vector;
222   end record;
223
224   type Catalog_Entry_File_List_Access is access all Catalog_Entry_File_List;
225
226   procedure Append
227    (Self         : in out Catalog_Entry_File;
228     Public_Entry : not null Public_Entry_Access);
229   --  Adds 'public' entry into the end of list of 'public' entries of the
230   --  entry file.
231
232   procedure Append
233    (Self         : in out Catalog_Entry_File;
234     System_Entry : not null System_Entry_Access);
235   --  Adds 'system' entry into the end of list of 'system' entries of the
236   --  entry file.
237
238   procedure Append
239    (Self                 : in out Catalog_Entry_File;
240     Rewrite_System_Entry : not null Rewrite_System_Entry_Access);
241   --  Adds 'rewriteSystem' entry into the end of list of 'rewriteSystem'
242   --  entries of the entry file.
243
244   procedure Append
245    (Self                : in out Catalog_Entry_File;
246     System_Suffix_Entry : not null System_Suffix_Entry_Access);
247   --  Adds 'systemSuffix' entry into the end of list of 'systemSuffix' entries
248   --  of the entry file.
249
250   procedure Append
251    (Self                  : in out Catalog_Entry_File;
252     Delegate_Public_Entry : not null Delegate_Public_Entry_Access);
253   --  Adds 'delegatePublic' entry into the end of list of 'delegatePublic'
254   --  entries of the entry file.
255
256   procedure Append
257    (Self                  : in out Catalog_Entry_File;
258     Delegate_System_Entry : not null Delegate_System_Entry_Access);
259   --  Adds 'delegateSystem' entry into the end of list of 'delegateSystem'
260   --  entries of the entry file.
261
262   procedure Append
263    (Self      : in out Catalog_Entry_File;
264     URI_Entry : not null URI_Entry_Access);
265   --  Adds 'uri' entry into the end of list of 'uri' entries of the entry
266   --  file.
267
268   procedure Append
269    (Self              : in out Catalog_Entry_File;
270     Rewrite_URI_Entry : not null Rewrite_URI_Entry_Access);
271   --  Adds 'rewriteURI' entry into the end of list of 'rewriteURI' entries of
272   --  the entry file.
273
274   procedure Append
275    (Self             : in out Catalog_Entry_File;
276     URI_Suffix_Entry : not null URI_Suffix_Entry_Access);
277   --  Adds 'uriSuffix' entry into the end of list of 'uriSuffix' entries of
278   --  the entry file.
279
280   procedure Append
281    (Self               : in out Catalog_Entry_File;
282     Delegate_URI_Entry : not null Delegate_URI_Entry_Access);
283   --  Adds 'delegateURI' entry into the end of list of 'delegateURI' entries
284   --  of the entry file.
285
286   procedure Append
287    (Self               : in out Catalog_Entry_File;
288     Next_Catalog_Entry : not null Next_Catalog_Entry_Access);
289   --  Adds 'nextCatalog' entry into the end of list of 'nextCatalog' entries
290   --  of the entry file.
291
292end Matreshka.XML_Catalogs.Entry_Files;
293