(extendsfdf2): Add pattern accidentally deleted when cirrus instructions were
[official-gcc.git] / gcc / ada / a-strunb.ads
blob25b2d441a813dfe5c7adffa88695d8e3ae66a893
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . S T R I N G S . U N B O U N D E D --
6 -- --
7 -- S p e c --
8 -- --
9 -- --
10 -- Copyright (C) 1992-1998 Free Software Foundation, Inc. --
11 -- --
12 -- This specification is derived from the Ada Reference Manual for use with --
13 -- GNAT. The copyright notice above, and the license provisions that follow --
14 -- apply solely to the contents of the part following the private keyword. --
15 -- --
16 -- GNAT is free software; you can redistribute it and/or modify it under --
17 -- terms of the GNU General Public License as published by the Free Soft- --
18 -- ware Foundation; either version 2, or (at your option) any later ver- --
19 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
20 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
21 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
22 -- for more details. You should have received a copy of the GNU General --
23 -- Public License distributed with GNAT; see file COPYING. If not, write --
24 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
25 -- MA 02111-1307, USA. --
26 -- --
27 -- As a special exception, if other files instantiate generics from this --
28 -- unit, or you link this unit with other files to produce an executable, --
29 -- this unit does not by itself cause the resulting executable to be --
30 -- covered by the GNU General Public License. This exception does not --
31 -- however invalidate any other reasons why the executable file might be --
32 -- covered by the GNU Public License. --
33 -- --
34 -- GNAT was originally developed by the GNAT team at New York University. --
35 -- Extensive contributions were provided by Ada Core Technologies Inc. --
36 -- --
37 ------------------------------------------------------------------------------
39 with Ada.Strings.Maps;
40 with Ada.Finalization;
42 package Ada.Strings.Unbounded is
43 pragma Preelaborate (Unbounded);
45 type Unbounded_String is private;
47 Null_Unbounded_String : constant Unbounded_String;
49 function Length (Source : Unbounded_String) return Natural;
51 type String_Access is access all String;
53 procedure Free (X : in out String_Access);
55 --------------------------------------------------------
56 -- Conversion, Concatenation, and Selection Functions --
57 --------------------------------------------------------
59 function To_Unbounded_String (Source : String) return Unbounded_String;
60 function To_Unbounded_String (Length : in Natural) return Unbounded_String;
62 function To_String (Source : Unbounded_String) return String;
64 procedure Append
65 (Source : in out Unbounded_String;
66 New_Item : in Unbounded_String);
68 procedure Append
69 (Source : in out Unbounded_String;
70 New_Item : in String);
72 procedure Append
73 (Source : in out Unbounded_String;
74 New_Item : in Character);
76 function "&" (Left, Right : Unbounded_String) return Unbounded_String;
78 function "&"
79 (Left : in Unbounded_String;
80 Right : in String)
81 return Unbounded_String;
83 function "&"
84 (Left : in String;
85 Right : in Unbounded_String)
86 return Unbounded_String;
88 function "&"
89 (Left : in Unbounded_String;
90 Right : in Character)
91 return Unbounded_String;
93 function "&"
94 (Left : in Character;
95 Right : in Unbounded_String)
96 return Unbounded_String;
98 function Element
99 (Source : in Unbounded_String;
100 Index : in Positive)
101 return Character;
103 procedure Replace_Element
104 (Source : in out Unbounded_String;
105 Index : in Positive;
106 By : Character);
108 function Slice
109 (Source : in Unbounded_String;
110 Low : in Positive;
111 High : in Natural)
112 return String;
114 function "=" (Left, Right : in Unbounded_String) return Boolean;
116 function "="
117 (Left : in Unbounded_String;
118 Right : in String)
119 return Boolean;
121 function "="
122 (Left : in String;
123 Right : in Unbounded_String)
124 return Boolean;
126 function "<" (Left, Right : in Unbounded_String) return Boolean;
128 function "<"
129 (Left : in Unbounded_String;
130 Right : in String)
131 return Boolean;
133 function "<"
134 (Left : in String;
135 Right : in Unbounded_String)
136 return Boolean;
138 function "<=" (Left, Right : in Unbounded_String) return Boolean;
140 function "<="
141 (Left : in Unbounded_String;
142 Right : in String)
143 return Boolean;
145 function "<="
146 (Left : in String;
147 Right : in Unbounded_String)
148 return Boolean;
150 function ">" (Left, Right : in Unbounded_String) return Boolean;
152 function ">"
153 (Left : in Unbounded_String;
154 Right : in String)
155 return Boolean;
157 function ">"
158 (Left : in String;
159 Right : in Unbounded_String)
160 return Boolean;
162 function ">=" (Left, Right : in Unbounded_String) return Boolean;
164 function ">="
165 (Left : in Unbounded_String;
166 Right : in String)
167 return Boolean;
169 function ">="
170 (Left : in String;
171 Right : in Unbounded_String)
172 return Boolean;
174 ------------------------
175 -- Search Subprograms --
176 ------------------------
178 function Index
179 (Source : in Unbounded_String;
180 Pattern : in String;
181 Going : in Direction := Forward;
182 Mapping : in Maps.Character_Mapping := Maps.Identity)
183 return Natural;
185 function Index
186 (Source : in Unbounded_String;
187 Pattern : in String;
188 Going : in Direction := Forward;
189 Mapping : in Maps.Character_Mapping_Function)
190 return Natural;
192 function Index
193 (Source : in Unbounded_String;
194 Set : in Maps.Character_Set;
195 Test : in Membership := Inside;
196 Going : in Direction := Forward)
197 return Natural;
199 function Index_Non_Blank
200 (Source : in Unbounded_String;
201 Going : in Direction := Forward)
202 return Natural;
204 function Count
205 (Source : in Unbounded_String;
206 Pattern : in String;
207 Mapping : in Maps.Character_Mapping := Maps.Identity)
208 return Natural;
210 function Count
211 (Source : in Unbounded_String;
212 Pattern : in String;
213 Mapping : in Maps.Character_Mapping_Function)
214 return Natural;
216 function Count
217 (Source : in Unbounded_String;
218 Set : in Maps.Character_Set)
219 return Natural;
221 procedure Find_Token
222 (Source : in Unbounded_String;
223 Set : in Maps.Character_Set;
224 Test : in Membership;
225 First : out Positive;
226 Last : out Natural);
228 ------------------------------------
229 -- String Translation Subprograms --
230 ------------------------------------
232 function Translate
233 (Source : in Unbounded_String;
234 Mapping : in Maps.Character_Mapping)
235 return Unbounded_String;
237 procedure Translate
238 (Source : in out Unbounded_String;
239 Mapping : Maps.Character_Mapping);
241 function Translate
242 (Source : in Unbounded_String;
243 Mapping : in Maps.Character_Mapping_Function)
244 return Unbounded_String;
246 procedure Translate
247 (Source : in out Unbounded_String;
248 Mapping : in Maps.Character_Mapping_Function);
250 ---------------------------------------
251 -- String Transformation Subprograms --
252 ---------------------------------------
254 function Replace_Slice
255 (Source : in Unbounded_String;
256 Low : in Positive;
257 High : in Natural;
258 By : in String)
259 return Unbounded_String;
261 procedure Replace_Slice
262 (Source : in out Unbounded_String;
263 Low : in Positive;
264 High : in Natural;
265 By : in String);
267 function Insert
268 (Source : in Unbounded_String;
269 Before : in Positive;
270 New_Item : in String)
271 return Unbounded_String;
273 procedure Insert
274 (Source : in out Unbounded_String;
275 Before : in Positive;
276 New_Item : in String);
278 function Overwrite
279 (Source : in Unbounded_String;
280 Position : in Positive;
281 New_Item : in String)
282 return Unbounded_String;
284 procedure Overwrite
285 (Source : in out Unbounded_String;
286 Position : in Positive;
287 New_Item : in String);
289 function Delete
290 (Source : in Unbounded_String;
291 From : in Positive;
292 Through : in Natural)
293 return Unbounded_String;
295 procedure Delete
296 (Source : in out Unbounded_String;
297 From : in Positive;
298 Through : in Natural);
300 function Trim
301 (Source : in Unbounded_String;
302 Side : in Trim_End)
303 return Unbounded_String;
305 procedure Trim
306 (Source : in out Unbounded_String;
307 Side : in Trim_End);
309 function Trim
310 (Source : in Unbounded_String;
311 Left : in Maps.Character_Set;
312 Right : in Maps.Character_Set)
313 return Unbounded_String;
315 procedure Trim
316 (Source : in out Unbounded_String;
317 Left : in Maps.Character_Set;
318 Right : in Maps.Character_Set);
320 function Head
321 (Source : in Unbounded_String;
322 Count : in Natural;
323 Pad : in Character := Space)
324 return Unbounded_String;
326 procedure Head
327 (Source : in out Unbounded_String;
328 Count : in Natural;
329 Pad : in Character := Space);
331 function Tail
332 (Source : in Unbounded_String;
333 Count : in Natural;
334 Pad : in Character := Space)
335 return Unbounded_String;
337 procedure Tail
338 (Source : in out Unbounded_String;
339 Count : in Natural;
340 Pad : in Character := Space);
342 function "*"
343 (Left : in Natural;
344 Right : in Character)
345 return Unbounded_String;
347 function "*"
348 (Left : in Natural;
349 Right : in String)
350 return Unbounded_String;
352 function "*"
353 (Left : in Natural;
354 Right : in Unbounded_String)
355 return Unbounded_String;
357 private
358 pragma Inline (Length);
360 package AF renames Ada.Finalization;
362 Null_String : aliased String := "";
364 function To_Unbounded (S : String) return Unbounded_String
365 renames To_Unbounded_String;
367 type Unbounded_String is new AF.Controlled with record
368 Reference : String_Access := Null_String'Access;
369 end record;
371 pragma Stream_Convert (Unbounded_String, To_Unbounded, To_String);
373 pragma Finalize_Storage_Only (Unbounded_String);
375 procedure Initialize (Object : in out Unbounded_String);
376 procedure Adjust (Object : in out Unbounded_String);
377 procedure Finalize (Object : in out Unbounded_String);
379 Null_Unbounded_String : constant Unbounded_String :=
380 (AF.Controlled with Reference => Null_String'Access);
382 end Ada.Strings.Unbounded;