* config/xtensa/linux.h (TARGET_OS_CPP_BUILTINS): Remove definition of
[official-gcc.git] / gcc / ada / a-strunb.ads
blobfe909009e123261e460487aa047997fdf9708a8c
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 -- Copyright (C) 1992-1998 Free Software Foundation, Inc. --
10 -- --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the contents of the part following the private keyword. --
14 -- --
15 -- GNAT is free software; you can redistribute it and/or modify it under --
16 -- terms of the GNU General Public License as published by the Free Soft- --
17 -- ware Foundation; either version 2, or (at your option) any later ver- --
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
21 -- for more details. You should have received a copy of the GNU General --
22 -- Public License distributed with GNAT; see file COPYING. If not, write --
23 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
24 -- MA 02111-1307, USA. --
25 -- --
26 -- As a special exception, if other files instantiate generics from this --
27 -- unit, or you link this unit with other files to produce an executable, --
28 -- this unit does not by itself cause the resulting executable to be --
29 -- covered by the GNU General Public License. This exception does not --
30 -- however invalidate any other reasons why the executable file might be --
31 -- covered by the GNU Public License. --
32 -- --
33 -- GNAT was originally developed by the GNAT team at New York University. --
34 -- Extensive contributions were provided by Ada Core Technologies Inc. --
35 -- --
36 ------------------------------------------------------------------------------
38 with Ada.Strings.Maps;
39 with Ada.Finalization;
41 package Ada.Strings.Unbounded is
42 pragma Preelaborate (Unbounded);
44 type Unbounded_String is private;
46 Null_Unbounded_String : constant Unbounded_String;
48 function Length (Source : Unbounded_String) return Natural;
50 type String_Access is access all String;
52 procedure Free (X : in out String_Access);
54 --------------------------------------------------------
55 -- Conversion, Concatenation, and Selection Functions --
56 --------------------------------------------------------
58 function To_Unbounded_String (Source : String) return Unbounded_String;
59 function To_Unbounded_String (Length : in Natural) return Unbounded_String;
61 function To_String (Source : Unbounded_String) return String;
63 procedure Append
64 (Source : in out Unbounded_String;
65 New_Item : in Unbounded_String);
67 procedure Append
68 (Source : in out Unbounded_String;
69 New_Item : in String);
71 procedure Append
72 (Source : in out Unbounded_String;
73 New_Item : in Character);
75 function "&" (Left, Right : Unbounded_String) return Unbounded_String;
77 function "&"
78 (Left : in Unbounded_String;
79 Right : in String)
80 return Unbounded_String;
82 function "&"
83 (Left : in String;
84 Right : in Unbounded_String)
85 return Unbounded_String;
87 function "&"
88 (Left : in Unbounded_String;
89 Right : in Character)
90 return Unbounded_String;
92 function "&"
93 (Left : in Character;
94 Right : in Unbounded_String)
95 return Unbounded_String;
97 function Element
98 (Source : in Unbounded_String;
99 Index : in Positive)
100 return Character;
102 procedure Replace_Element
103 (Source : in out Unbounded_String;
104 Index : in Positive;
105 By : Character);
107 function Slice
108 (Source : in Unbounded_String;
109 Low : in Positive;
110 High : in Natural)
111 return String;
113 function "=" (Left, Right : in Unbounded_String) return Boolean;
115 function "="
116 (Left : in Unbounded_String;
117 Right : in String)
118 return Boolean;
120 function "="
121 (Left : in String;
122 Right : in Unbounded_String)
123 return Boolean;
125 function "<" (Left, Right : in Unbounded_String) return Boolean;
127 function "<"
128 (Left : in Unbounded_String;
129 Right : in String)
130 return Boolean;
132 function "<"
133 (Left : in String;
134 Right : in Unbounded_String)
135 return Boolean;
137 function "<=" (Left, Right : in Unbounded_String) return Boolean;
139 function "<="
140 (Left : in Unbounded_String;
141 Right : in String)
142 return Boolean;
144 function "<="
145 (Left : in String;
146 Right : in Unbounded_String)
147 return Boolean;
149 function ">" (Left, Right : in Unbounded_String) return Boolean;
151 function ">"
152 (Left : in Unbounded_String;
153 Right : in String)
154 return Boolean;
156 function ">"
157 (Left : in String;
158 Right : in Unbounded_String)
159 return Boolean;
161 function ">=" (Left, Right : in Unbounded_String) return Boolean;
163 function ">="
164 (Left : in Unbounded_String;
165 Right : in String)
166 return Boolean;
168 function ">="
169 (Left : in String;
170 Right : in Unbounded_String)
171 return Boolean;
173 ------------------------
174 -- Search Subprograms --
175 ------------------------
177 function Index
178 (Source : in Unbounded_String;
179 Pattern : in String;
180 Going : in Direction := Forward;
181 Mapping : in Maps.Character_Mapping := Maps.Identity)
182 return Natural;
184 function Index
185 (Source : in Unbounded_String;
186 Pattern : in String;
187 Going : in Direction := Forward;
188 Mapping : in Maps.Character_Mapping_Function)
189 return Natural;
191 function Index
192 (Source : in Unbounded_String;
193 Set : in Maps.Character_Set;
194 Test : in Membership := Inside;
195 Going : in Direction := Forward)
196 return Natural;
198 function Index_Non_Blank
199 (Source : in Unbounded_String;
200 Going : in Direction := Forward)
201 return Natural;
203 function Count
204 (Source : in Unbounded_String;
205 Pattern : in String;
206 Mapping : in Maps.Character_Mapping := Maps.Identity)
207 return Natural;
209 function Count
210 (Source : in Unbounded_String;
211 Pattern : in String;
212 Mapping : in Maps.Character_Mapping_Function)
213 return Natural;
215 function Count
216 (Source : in Unbounded_String;
217 Set : in Maps.Character_Set)
218 return Natural;
220 procedure Find_Token
221 (Source : in Unbounded_String;
222 Set : in Maps.Character_Set;
223 Test : in Membership;
224 First : out Positive;
225 Last : out Natural);
227 ------------------------------------
228 -- String Translation Subprograms --
229 ------------------------------------
231 function Translate
232 (Source : in Unbounded_String;
233 Mapping : in Maps.Character_Mapping)
234 return Unbounded_String;
236 procedure Translate
237 (Source : in out Unbounded_String;
238 Mapping : Maps.Character_Mapping);
240 function Translate
241 (Source : in Unbounded_String;
242 Mapping : in Maps.Character_Mapping_Function)
243 return Unbounded_String;
245 procedure Translate
246 (Source : in out Unbounded_String;
247 Mapping : in Maps.Character_Mapping_Function);
249 ---------------------------------------
250 -- String Transformation Subprograms --
251 ---------------------------------------
253 function Replace_Slice
254 (Source : in Unbounded_String;
255 Low : in Positive;
256 High : in Natural;
257 By : in String)
258 return Unbounded_String;
260 procedure Replace_Slice
261 (Source : in out Unbounded_String;
262 Low : in Positive;
263 High : in Natural;
264 By : in String);
266 function Insert
267 (Source : in Unbounded_String;
268 Before : in Positive;
269 New_Item : in String)
270 return Unbounded_String;
272 procedure Insert
273 (Source : in out Unbounded_String;
274 Before : in Positive;
275 New_Item : in String);
277 function Overwrite
278 (Source : in Unbounded_String;
279 Position : in Positive;
280 New_Item : in String)
281 return Unbounded_String;
283 procedure Overwrite
284 (Source : in out Unbounded_String;
285 Position : in Positive;
286 New_Item : in String);
288 function Delete
289 (Source : in Unbounded_String;
290 From : in Positive;
291 Through : in Natural)
292 return Unbounded_String;
294 procedure Delete
295 (Source : in out Unbounded_String;
296 From : in Positive;
297 Through : in Natural);
299 function Trim
300 (Source : in Unbounded_String;
301 Side : in Trim_End)
302 return Unbounded_String;
304 procedure Trim
305 (Source : in out Unbounded_String;
306 Side : in Trim_End);
308 function Trim
309 (Source : in Unbounded_String;
310 Left : in Maps.Character_Set;
311 Right : in Maps.Character_Set)
312 return Unbounded_String;
314 procedure Trim
315 (Source : in out Unbounded_String;
316 Left : in Maps.Character_Set;
317 Right : in Maps.Character_Set);
319 function Head
320 (Source : in Unbounded_String;
321 Count : in Natural;
322 Pad : in Character := Space)
323 return Unbounded_String;
325 procedure Head
326 (Source : in out Unbounded_String;
327 Count : in Natural;
328 Pad : in Character := Space);
330 function Tail
331 (Source : in Unbounded_String;
332 Count : in Natural;
333 Pad : in Character := Space)
334 return Unbounded_String;
336 procedure Tail
337 (Source : in out Unbounded_String;
338 Count : in Natural;
339 Pad : in Character := Space);
341 function "*"
342 (Left : in Natural;
343 Right : in Character)
344 return Unbounded_String;
346 function "*"
347 (Left : in Natural;
348 Right : in String)
349 return Unbounded_String;
351 function "*"
352 (Left : in Natural;
353 Right : in Unbounded_String)
354 return Unbounded_String;
356 private
357 pragma Inline (Length);
359 package AF renames Ada.Finalization;
361 Null_String : aliased String := "";
363 function To_Unbounded (S : String) return Unbounded_String
364 renames To_Unbounded_String;
366 type Unbounded_String is new AF.Controlled with record
367 Reference : String_Access := Null_String'Access;
368 end record;
370 pragma Stream_Convert (Unbounded_String, To_Unbounded, To_String);
372 pragma Finalize_Storage_Only (Unbounded_String);
374 procedure Initialize (Object : in out Unbounded_String);
375 procedure Adjust (Object : in out Unbounded_String);
376 procedure Finalize (Object : in out Unbounded_String);
378 Null_Unbounded_String : constant Unbounded_String :=
379 (AF.Controlled with Reference => Null_String'Access);
381 end Ada.Strings.Unbounded;