FSF GCC merge 02/23/03
[official-gcc.git] / gcc / ada / a-stwiun.ads
blob91f1d938a94503dc336fd2a2fe9493851586060c
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . S T R I N G S . W I D E _ U N B O U N D E D --
6 -- --
7 -- S p e c --
8 -- --
9 -- --
10 -- Copyright (C) 1992-2000 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.Wide_Maps;
40 with Ada.Finalization;
42 package Ada.Strings.Wide_Unbounded is
43 pragma Preelaborate (Wide_Unbounded);
45 type Unbounded_Wide_String is private;
47 Null_Unbounded_Wide_String : constant Unbounded_Wide_String;
49 function Length (Source : Unbounded_Wide_String) return Natural;
51 type Wide_String_Access is access all Wide_String;
53 procedure Free (X : in out Wide_String_Access);
55 --------------------------------------------------------
56 -- Conversion, Concatenation, and Selection Functions --
57 --------------------------------------------------------
59 function To_Unbounded_Wide_String
60 (Source : Wide_String)
61 return Unbounded_Wide_String;
63 function To_Unbounded_Wide_String
64 (Length : in Natural)
65 return Unbounded_Wide_String;
67 function To_Wide_String
68 (Source : Unbounded_Wide_String)
69 return Wide_String;
71 procedure Append
72 (Source : in out Unbounded_Wide_String;
73 New_Item : in Unbounded_Wide_String);
75 procedure Append
76 (Source : in out Unbounded_Wide_String;
77 New_Item : in Wide_String);
79 procedure Append
80 (Source : in out Unbounded_Wide_String;
81 New_Item : in Wide_Character);
83 function "&"
84 (Left, Right : Unbounded_Wide_String)
85 return Unbounded_Wide_String;
87 function "&"
88 (Left : in Unbounded_Wide_String;
89 Right : in Wide_String)
90 return Unbounded_Wide_String;
92 function "&"
93 (Left : in Wide_String;
94 Right : in Unbounded_Wide_String)
95 return Unbounded_Wide_String;
97 function "&"
98 (Left : in Unbounded_Wide_String;
99 Right : in Wide_Character)
100 return Unbounded_Wide_String;
102 function "&"
103 (Left : in Wide_Character;
104 Right : in Unbounded_Wide_String)
105 return Unbounded_Wide_String;
107 function Element
108 (Source : in Unbounded_Wide_String;
109 Index : in Positive)
110 return Wide_Character;
112 procedure Replace_Element
113 (Source : in out Unbounded_Wide_String;
114 Index : in Positive;
115 By : Wide_Character);
117 function Slice
118 (Source : in Unbounded_Wide_String;
119 Low : in Positive;
120 High : in Natural)
121 return Wide_String;
123 function "="
124 (Left : in Unbounded_Wide_String;
125 Right : in Unbounded_Wide_String)
126 return Boolean;
128 function "="
129 (Left : in Unbounded_Wide_String;
130 Right : in Wide_String)
131 return Boolean;
133 function "="
134 (Left : in Wide_String;
135 Right : in Unbounded_Wide_String)
136 return Boolean;
138 function "<"
139 (Left : in Unbounded_Wide_String;
140 Right : in Unbounded_Wide_String)
141 return Boolean;
143 function "<"
144 (Left : in Unbounded_Wide_String;
145 Right : in Wide_String)
146 return Boolean;
148 function "<"
149 (Left : in Wide_String;
150 Right : in Unbounded_Wide_String)
151 return Boolean;
153 function "<="
154 (Left : in Unbounded_Wide_String;
155 Right : in Unbounded_Wide_String)
156 return Boolean;
158 function "<="
159 (Left : in Unbounded_Wide_String;
160 Right : in Wide_String)
161 return Boolean;
163 function "<="
164 (Left : in Wide_String;
165 Right : in Unbounded_Wide_String)
166 return Boolean;
168 function ">"
169 (Left : in Unbounded_Wide_String;
170 Right : in Unbounded_Wide_String)
171 return Boolean;
173 function ">"
174 (Left : in Unbounded_Wide_String;
175 Right : in Wide_String)
176 return Boolean;
178 function ">"
179 (Left : in Wide_String;
180 Right : in Unbounded_Wide_String)
181 return Boolean;
183 function ">="
184 (Left : in Unbounded_Wide_String;
185 Right : in Unbounded_Wide_String)
186 return Boolean;
188 function ">="
189 (Left : in Unbounded_Wide_String;
190 Right : in Wide_String)
191 return Boolean;
193 function ">="
194 (Left : in Wide_String;
195 Right : in Unbounded_Wide_String)
196 return Boolean;
198 ------------------------
199 -- Search Subprograms --
200 ------------------------
202 function Index
203 (Source : in Unbounded_Wide_String;
204 Pattern : in Wide_String;
205 Going : in Direction := Forward;
206 Mapping : in Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
207 return Natural;
209 function Index
210 (Source : in Unbounded_Wide_String;
211 Pattern : in Wide_String;
212 Going : in Direction := Forward;
213 Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
214 return Natural;
216 function Index
217 (Source : in Unbounded_Wide_String;
218 Set : in Wide_Maps.Wide_Character_Set;
219 Test : in Membership := Inside;
220 Going : in Direction := Forward)
221 return Natural;
223 function Index_Non_Blank
224 (Source : in Unbounded_Wide_String;
225 Going : in Direction := Forward)
226 return Natural;
228 function Count
229 (Source : in Unbounded_Wide_String;
230 Pattern : in Wide_String;
231 Mapping : in Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
232 return Natural;
234 function Count
235 (Source : in Unbounded_Wide_String;
236 Pattern : in Wide_String;
237 Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
238 return Natural;
240 function Count
241 (Source : in Unbounded_Wide_String;
242 Set : in Wide_Maps.Wide_Character_Set)
243 return Natural;
245 procedure Find_Token
246 (Source : in Unbounded_Wide_String;
247 Set : in Wide_Maps.Wide_Character_Set;
248 Test : in Membership;
249 First : out Positive;
250 Last : out Natural);
252 ------------------------------------
253 -- Wide_String Translation Subprograms --
254 ------------------------------------
256 function Translate
257 (Source : in Unbounded_Wide_String;
258 Mapping : in Wide_Maps.Wide_Character_Mapping)
259 return Unbounded_Wide_String;
261 procedure Translate
262 (Source : in out Unbounded_Wide_String;
263 Mapping : Wide_Maps.Wide_Character_Mapping);
265 function Translate
266 (Source : in Unbounded_Wide_String;
267 Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
268 return Unbounded_Wide_String;
270 procedure Translate
271 (Source : in out Unbounded_Wide_String;
272 Mapping : in Wide_Maps.Wide_Character_Mapping_Function);
274 ---------------------------------------
275 -- Wide_String Transformation Subprograms --
276 ---------------------------------------
278 function Replace_Slice
279 (Source : in Unbounded_Wide_String;
280 Low : in Positive;
281 High : in Natural;
282 By : in Wide_String)
283 return Unbounded_Wide_String;
285 procedure Replace_Slice
286 (Source : in out Unbounded_Wide_String;
287 Low : in Positive;
288 High : in Natural;
289 By : in Wide_String);
291 function Insert
292 (Source : in Unbounded_Wide_String;
293 Before : in Positive;
294 New_Item : in Wide_String)
295 return Unbounded_Wide_String;
297 procedure Insert
298 (Source : in out Unbounded_Wide_String;
299 Before : in Positive;
300 New_Item : in Wide_String);
302 function Overwrite
303 (Source : in Unbounded_Wide_String;
304 Position : in Positive;
305 New_Item : in Wide_String)
306 return Unbounded_Wide_String;
308 procedure Overwrite
309 (Source : in out Unbounded_Wide_String;
310 Position : in Positive;
311 New_Item : in Wide_String);
313 function Delete
314 (Source : in Unbounded_Wide_String;
315 From : in Positive;
316 Through : in Natural)
317 return Unbounded_Wide_String;
319 procedure Delete
320 (Source : in out Unbounded_Wide_String;
321 From : in Positive;
322 Through : in Natural);
324 function Trim
325 (Source : in Unbounded_Wide_String;
326 Side : in Trim_End)
327 return Unbounded_Wide_String;
329 procedure Trim
330 (Source : in out Unbounded_Wide_String;
331 Side : in Trim_End);
333 function Trim
334 (Source : in Unbounded_Wide_String;
335 Left : in Wide_Maps.Wide_Character_Set;
336 Right : in Wide_Maps.Wide_Character_Set)
337 return Unbounded_Wide_String;
339 procedure Trim
340 (Source : in out Unbounded_Wide_String;
341 Left : in Wide_Maps.Wide_Character_Set;
342 Right : in Wide_Maps.Wide_Character_Set);
344 function Head
345 (Source : in Unbounded_Wide_String;
346 Count : in Natural;
347 Pad : in Wide_Character := Wide_Space)
348 return Unbounded_Wide_String;
350 procedure Head
351 (Source : in out Unbounded_Wide_String;
352 Count : in Natural;
353 Pad : in Wide_Character := Wide_Space);
355 function Tail
356 (Source : in Unbounded_Wide_String;
357 Count : in Natural;
358 Pad : in Wide_Character := Wide_Space)
359 return Unbounded_Wide_String;
361 procedure Tail
362 (Source : in out Unbounded_Wide_String;
363 Count : in Natural;
364 Pad : in Wide_Character := Wide_Space);
366 function "*"
367 (Left : in Natural;
368 Right : in Wide_Character)
369 return Unbounded_Wide_String;
371 function "*"
372 (Left : in Natural;
373 Right : in Wide_String)
374 return Unbounded_Wide_String;
376 function "*"
377 (Left : in Natural;
378 Right : in Unbounded_Wide_String)
379 return Unbounded_Wide_String;
381 private
382 pragma Inline (Length);
384 package AF renames Ada.Finalization;
386 Null_Wide_String : aliased Wide_String := "";
388 function To_Unbounded_Wide (S : Wide_String) return Unbounded_Wide_String
389 renames To_Unbounded_Wide_String;
391 type Unbounded_Wide_String is new AF.Controlled with record
392 Reference : Wide_String_Access := Null_Wide_String'Access;
393 end record;
395 pragma Stream_Convert
396 (Unbounded_Wide_String, To_Unbounded_Wide, To_Wide_String);
398 pragma Finalize_Storage_Only (Unbounded_Wide_String);
400 procedure Initialize (Object : in out Unbounded_Wide_String);
401 procedure Adjust (Object : in out Unbounded_Wide_String);
402 procedure Finalize (Object : in out Unbounded_Wide_String);
404 Null_Unbounded_Wide_String : constant Unbounded_Wide_String :=
405 (AF.Controlled with Reference => Null_Wide_String'Access);
407 end Ada.Strings.Wide_Unbounded;