more autogen definiton
[official-gcc.git] / gcc / ada / a-stzsup.ads
blobcb0d173d44ae166e447405aa283de55ccee4c11f
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . S T R I N G S . W I D E _ W I D E _ S U P E R B O U N D E D --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2003-2012, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
32 -- This non generic package contains most of the implementation of the
33 -- generic package Ada.Strings.Wide_Wide_Bounded.Generic_Bounded_Length.
35 -- It defines type Super_String as a discriminated record with the maximum
36 -- length as the discriminant. Individual instantiations of the package
37 -- Strings.Wide_Wide_Bounded.Generic_Bounded_Length use this type with
38 -- an appropriate discriminant value set.
40 with Ada.Strings.Wide_Wide_Maps;
42 package Ada.Strings.Wide_Wide_Superbounded is
43 pragma Preelaborate;
45 Wide_Wide_NUL : constant Wide_Wide_Character :=
46 Wide_Wide_Character'Val (0);
48 type Super_String (Max_Length : Positive) is record
49 Current_Length : Natural := 0;
50 Data : Wide_Wide_String (1 .. Max_Length);
51 -- A previous version had a default initial value for Data, which is no
52 -- longer necessary, because we now special-case this type in the
53 -- compiler, so "=" composes properly for descendants of this
54 -- type. Leaving it out is more efficient.
55 end record;
56 -- Wide_Wide_Bounded.Generic_Bounded_Length.Wide_Wide_Bounded_String is
57 -- derived from this type, with the constraint of the maximum length.
59 -- The subprograms defined for Super_String are similar to those defined
60 -- for Bounded_Wide_Wide_String, except that they have different names, so
61 -- that they can be renamed in Wide_Wide_Bounded.Generic_Bounded_Length.
63 function Super_Length (Source : Super_String) return Natural;
65 --------------------------------------------------------
66 -- Conversion, Concatenation, and Selection Functions --
67 --------------------------------------------------------
69 function To_Super_String
70 (Source : Wide_Wide_String;
71 Max_Length : Natural;
72 Drop : Truncation := Error) return Super_String;
73 -- Note the additional parameter Max_Length, which specifies the maximum
74 -- length setting of the resulting Super_String value.
76 -- The following procedures have declarations (and semantics) that are
77 -- exactly analogous to those declared in Ada.Strings.Wide_Wide_Bounded.
79 function Super_To_String (Source : Super_String) return Wide_Wide_String;
81 procedure Set_Super_String
82 (Target : out Super_String;
83 Source : Wide_Wide_String;
84 Drop : Truncation := Error);
86 function Super_Append
87 (Left : Super_String;
88 Right : Super_String;
89 Drop : Truncation := Error) return Super_String;
91 function Super_Append
92 (Left : Super_String;
93 Right : Wide_Wide_String;
94 Drop : Truncation := Error) return Super_String;
96 function Super_Append
97 (Left : Wide_Wide_String;
98 Right : Super_String;
99 Drop : Truncation := Error) return Super_String;
101 function Super_Append
102 (Left : Super_String;
103 Right : Wide_Wide_Character;
104 Drop : Truncation := Error) return Super_String;
106 function Super_Append
107 (Left : Wide_Wide_Character;
108 Right : Super_String;
109 Drop : Truncation := Error) return Super_String;
111 procedure Super_Append
112 (Source : in out Super_String;
113 New_Item : Super_String;
114 Drop : Truncation := Error);
116 procedure Super_Append
117 (Source : in out Super_String;
118 New_Item : Wide_Wide_String;
119 Drop : Truncation := Error);
121 procedure Super_Append
122 (Source : in out Super_String;
123 New_Item : Wide_Wide_Character;
124 Drop : Truncation := Error);
126 function Concat
127 (Left : Super_String;
128 Right : Super_String) return Super_String;
130 function Concat
131 (Left : Super_String;
132 Right : Wide_Wide_String) return Super_String;
134 function Concat
135 (Left : Wide_Wide_String;
136 Right : Super_String) return Super_String;
138 function Concat
139 (Left : Super_String;
140 Right : Wide_Wide_Character) return Super_String;
142 function Concat
143 (Left : Wide_Wide_Character;
144 Right : Super_String) return Super_String;
146 function Super_Element
147 (Source : Super_String;
148 Index : Positive) return Wide_Wide_Character;
150 procedure Super_Replace_Element
151 (Source : in out Super_String;
152 Index : Positive;
153 By : Wide_Wide_Character);
155 function Super_Slice
156 (Source : Super_String;
157 Low : Positive;
158 High : Natural) return Wide_Wide_String;
160 function Super_Slice
161 (Source : Super_String;
162 Low : Positive;
163 High : Natural) return Super_String;
165 procedure Super_Slice
166 (Source : Super_String;
167 Target : out Super_String;
168 Low : Positive;
169 High : Natural);
171 function "="
172 (Left : Super_String;
173 Right : Super_String) return Boolean;
175 function Equal
176 (Left : Super_String;
177 Right : Super_String) return Boolean renames "=";
179 function Equal
180 (Left : Super_String;
181 Right : Wide_Wide_String) return Boolean;
183 function Equal
184 (Left : Wide_Wide_String;
185 Right : Super_String) return Boolean;
187 function Less
188 (Left : Super_String;
189 Right : Super_String) return Boolean;
191 function Less
192 (Left : Super_String;
193 Right : Wide_Wide_String) return Boolean;
195 function Less
196 (Left : Wide_Wide_String;
197 Right : Super_String) return Boolean;
199 function Less_Or_Equal
200 (Left : Super_String;
201 Right : Super_String) return Boolean;
203 function Less_Or_Equal
204 (Left : Super_String;
205 Right : Wide_Wide_String) return Boolean;
207 function Less_Or_Equal
208 (Left : Wide_Wide_String;
209 Right : Super_String) return Boolean;
211 function Greater
212 (Left : Super_String;
213 Right : Super_String) return Boolean;
215 function Greater
216 (Left : Super_String;
217 Right : Wide_Wide_String) return Boolean;
219 function Greater
220 (Left : Wide_Wide_String;
221 Right : Super_String) return Boolean;
223 function Greater_Or_Equal
224 (Left : Super_String;
225 Right : Super_String) return Boolean;
227 function Greater_Or_Equal
228 (Left : Super_String;
229 Right : Wide_Wide_String) return Boolean;
231 function Greater_Or_Equal
232 (Left : Wide_Wide_String;
233 Right : Super_String) return Boolean;
235 ----------------------
236 -- Search Functions --
237 ----------------------
239 function Super_Index
240 (Source : Super_String;
241 Pattern : Wide_Wide_String;
242 Going : Direction := Forward;
243 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping :=
244 Wide_Wide_Maps.Identity)
245 return Natural;
247 function Super_Index
248 (Source : Super_String;
249 Pattern : Wide_Wide_String;
250 Going : Direction := Forward;
251 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
252 return Natural;
254 function Super_Index
255 (Source : Super_String;
256 Set : Wide_Wide_Maps.Wide_Wide_Character_Set;
257 Test : Membership := Inside;
258 Going : Direction := Forward) return Natural;
260 function Super_Index
261 (Source : Super_String;
262 Pattern : Wide_Wide_String;
263 From : Positive;
264 Going : Direction := Forward;
265 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping :=
266 Wide_Wide_Maps.Identity)
267 return Natural;
269 function Super_Index
270 (Source : Super_String;
271 Pattern : Wide_Wide_String;
272 From : Positive;
273 Going : Direction := Forward;
274 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
275 return Natural;
277 function Super_Index
278 (Source : Super_String;
279 Set : Wide_Wide_Maps.Wide_Wide_Character_Set;
280 From : Positive;
281 Test : Membership := Inside;
282 Going : Direction := Forward) return Natural;
284 function Super_Index_Non_Blank
285 (Source : Super_String;
286 Going : Direction := Forward) return Natural;
288 function Super_Index_Non_Blank
289 (Source : Super_String;
290 From : Positive;
291 Going : Direction := Forward) return Natural;
293 function Super_Count
294 (Source : Super_String;
295 Pattern : Wide_Wide_String;
296 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping :=
297 Wide_Wide_Maps.Identity)
298 return Natural;
300 function Super_Count
301 (Source : Super_String;
302 Pattern : Wide_Wide_String;
303 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
304 return Natural;
306 function Super_Count
307 (Source : Super_String;
308 Set : Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural;
310 procedure Super_Find_Token
311 (Source : Super_String;
312 Set : Wide_Wide_Maps.Wide_Wide_Character_Set;
313 From : Positive;
314 Test : Membership;
315 First : out Positive;
316 Last : out Natural);
318 procedure Super_Find_Token
319 (Source : Super_String;
320 Set : Wide_Wide_Maps.Wide_Wide_Character_Set;
321 Test : Membership;
322 First : out Positive;
323 Last : out Natural);
325 ------------------------------------
326 -- String Translation Subprograms --
327 ------------------------------------
329 function Super_Translate
330 (Source : Super_String;
331 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping)
332 return Super_String;
334 procedure Super_Translate
335 (Source : in out Super_String;
336 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping);
338 function Super_Translate
339 (Source : Super_String;
340 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
341 return Super_String;
343 procedure Super_Translate
344 (Source : in out Super_String;
345 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function);
347 ---------------------------------------
348 -- String Transformation Subprograms --
349 ---------------------------------------
351 function Super_Replace_Slice
352 (Source : Super_String;
353 Low : Positive;
354 High : Natural;
355 By : Wide_Wide_String;
356 Drop : Truncation := Error) return Super_String;
358 procedure Super_Replace_Slice
359 (Source : in out Super_String;
360 Low : Positive;
361 High : Natural;
362 By : Wide_Wide_String;
363 Drop : Truncation := Error);
365 function Super_Insert
366 (Source : Super_String;
367 Before : Positive;
368 New_Item : Wide_Wide_String;
369 Drop : Truncation := Error) return Super_String;
371 procedure Super_Insert
372 (Source : in out Super_String;
373 Before : Positive;
374 New_Item : Wide_Wide_String;
375 Drop : Truncation := Error);
377 function Super_Overwrite
378 (Source : Super_String;
379 Position : Positive;
380 New_Item : Wide_Wide_String;
381 Drop : Truncation := Error) return Super_String;
383 procedure Super_Overwrite
384 (Source : in out Super_String;
385 Position : Positive;
386 New_Item : Wide_Wide_String;
387 Drop : Truncation := Error);
389 function Super_Delete
390 (Source : Super_String;
391 From : Positive;
392 Through : Natural) return Super_String;
394 procedure Super_Delete
395 (Source : in out Super_String;
396 From : Positive;
397 Through : Natural);
399 ---------------------------------
400 -- String Selector Subprograms --
401 ---------------------------------
403 function Super_Trim
404 (Source : Super_String;
405 Side : Trim_End) return Super_String;
407 procedure Super_Trim
408 (Source : in out Super_String;
409 Side : Trim_End);
411 function Super_Trim
412 (Source : Super_String;
413 Left : Wide_Wide_Maps.Wide_Wide_Character_Set;
414 Right : Wide_Wide_Maps.Wide_Wide_Character_Set) return Super_String;
416 procedure Super_Trim
417 (Source : in out Super_String;
418 Left : Wide_Wide_Maps.Wide_Wide_Character_Set;
419 Right : Wide_Wide_Maps.Wide_Wide_Character_Set);
421 function Super_Head
422 (Source : Super_String;
423 Count : Natural;
424 Pad : Wide_Wide_Character := Wide_Wide_Space;
425 Drop : Truncation := Error) return Super_String;
427 procedure Super_Head
428 (Source : in out Super_String;
429 Count : Natural;
430 Pad : Wide_Wide_Character := Wide_Wide_Space;
431 Drop : Truncation := Error);
433 function Super_Tail
434 (Source : Super_String;
435 Count : Natural;
436 Pad : Wide_Wide_Character := Wide_Wide_Space;
437 Drop : Truncation := Error) return Super_String;
439 procedure Super_Tail
440 (Source : in out Super_String;
441 Count : Natural;
442 Pad : Wide_Wide_Character := Wide_Wide_Space;
443 Drop : Truncation := Error);
445 ------------------------------------
446 -- String Constructor Subprograms --
447 ------------------------------------
449 -- Note: in some of the following routines, there is an extra parameter
450 -- Max_Length which specifies the value of the maximum length for the
451 -- resulting Super_String value.
453 function Times
454 (Left : Natural;
455 Right : Wide_Wide_Character;
456 Max_Length : Positive) return Super_String;
457 -- Note the additional parameter Max_Length
459 function Times
460 (Left : Natural;
461 Right : Wide_Wide_String;
462 Max_Length : Positive) return Super_String;
463 -- Note the additional parameter Max_Length
465 function Times
466 (Left : Natural;
467 Right : Super_String) return Super_String;
469 function Super_Replicate
470 (Count : Natural;
471 Item : Wide_Wide_Character;
472 Drop : Truncation := Error;
473 Max_Length : Positive) return Super_String;
474 -- Note the additional parameter Max_Length
476 function Super_Replicate
477 (Count : Natural;
478 Item : Wide_Wide_String;
479 Drop : Truncation := Error;
480 Max_Length : Positive) return Super_String;
481 -- Note the additional parameter Max_Length
483 function Super_Replicate
484 (Count : Natural;
485 Item : Super_String;
486 Drop : Truncation := Error) return Super_String;
488 private
489 -- Pragma Inline declarations
491 pragma Inline ("=");
492 pragma Inline (Less);
493 pragma Inline (Less_Or_Equal);
494 pragma Inline (Greater);
495 pragma Inline (Greater_Or_Equal);
496 pragma Inline (Concat);
497 pragma Inline (Super_Count);
498 pragma Inline (Super_Element);
499 pragma Inline (Super_Find_Token);
500 pragma Inline (Super_Index);
501 pragma Inline (Super_Index_Non_Blank);
502 pragma Inline (Super_Length);
503 pragma Inline (Super_Replace_Element);
504 pragma Inline (Super_Slice);
505 pragma Inline (Super_To_String);
507 end Ada.Strings.Wide_Wide_Superbounded;