Fix thinko
[official-gcc.git] / gcc / ada / a-stwiun.ads
blobd2cf86ef6a10fd10d08d0e621bff6d49ace75526
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 -- Copyright (C) 1992-2000 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.Wide_Maps;
39 with Ada.Finalization;
41 package Ada.Strings.Wide_Unbounded is
42 pragma Preelaborate (Wide_Unbounded);
44 type Unbounded_Wide_String is private;
46 Null_Unbounded_Wide_String : constant Unbounded_Wide_String;
48 function Length (Source : Unbounded_Wide_String) return Natural;
50 type Wide_String_Access is access all Wide_String;
52 procedure Free (X : in out Wide_String_Access);
54 --------------------------------------------------------
55 -- Conversion, Concatenation, and Selection Functions --
56 --------------------------------------------------------
58 function To_Unbounded_Wide_String
59 (Source : Wide_String)
60 return Unbounded_Wide_String;
62 function To_Unbounded_Wide_String
63 (Length : in Natural)
64 return Unbounded_Wide_String;
66 function To_Wide_String
67 (Source : Unbounded_Wide_String)
68 return Wide_String;
70 procedure Append
71 (Source : in out Unbounded_Wide_String;
72 New_Item : in Unbounded_Wide_String);
74 procedure Append
75 (Source : in out Unbounded_Wide_String;
76 New_Item : in Wide_String);
78 procedure Append
79 (Source : in out Unbounded_Wide_String;
80 New_Item : in Wide_Character);
82 function "&"
83 (Left, Right : Unbounded_Wide_String)
84 return Unbounded_Wide_String;
86 function "&"
87 (Left : in Unbounded_Wide_String;
88 Right : in Wide_String)
89 return Unbounded_Wide_String;
91 function "&"
92 (Left : in Wide_String;
93 Right : in Unbounded_Wide_String)
94 return Unbounded_Wide_String;
96 function "&"
97 (Left : in Unbounded_Wide_String;
98 Right : in Wide_Character)
99 return Unbounded_Wide_String;
101 function "&"
102 (Left : in Wide_Character;
103 Right : in Unbounded_Wide_String)
104 return Unbounded_Wide_String;
106 function Element
107 (Source : in Unbounded_Wide_String;
108 Index : in Positive)
109 return Wide_Character;
111 procedure Replace_Element
112 (Source : in out Unbounded_Wide_String;
113 Index : in Positive;
114 By : Wide_Character);
116 function Slice
117 (Source : in Unbounded_Wide_String;
118 Low : in Positive;
119 High : in Natural)
120 return Wide_String;
122 function "="
123 (Left : in Unbounded_Wide_String;
124 Right : in Unbounded_Wide_String)
125 return Boolean;
127 function "="
128 (Left : in Unbounded_Wide_String;
129 Right : in Wide_String)
130 return Boolean;
132 function "="
133 (Left : in Wide_String;
134 Right : in Unbounded_Wide_String)
135 return Boolean;
137 function "<"
138 (Left : in Unbounded_Wide_String;
139 Right : in Unbounded_Wide_String)
140 return Boolean;
142 function "<"
143 (Left : in Unbounded_Wide_String;
144 Right : in Wide_String)
145 return Boolean;
147 function "<"
148 (Left : in Wide_String;
149 Right : in Unbounded_Wide_String)
150 return Boolean;
152 function "<="
153 (Left : in Unbounded_Wide_String;
154 Right : in Unbounded_Wide_String)
155 return Boolean;
157 function "<="
158 (Left : in Unbounded_Wide_String;
159 Right : in Wide_String)
160 return Boolean;
162 function "<="
163 (Left : in Wide_String;
164 Right : in Unbounded_Wide_String)
165 return Boolean;
167 function ">"
168 (Left : in Unbounded_Wide_String;
169 Right : in Unbounded_Wide_String)
170 return Boolean;
172 function ">"
173 (Left : in Unbounded_Wide_String;
174 Right : in Wide_String)
175 return Boolean;
177 function ">"
178 (Left : in Wide_String;
179 Right : in Unbounded_Wide_String)
180 return Boolean;
182 function ">="
183 (Left : in Unbounded_Wide_String;
184 Right : in Unbounded_Wide_String)
185 return Boolean;
187 function ">="
188 (Left : in Unbounded_Wide_String;
189 Right : in Wide_String)
190 return Boolean;
192 function ">="
193 (Left : in Wide_String;
194 Right : in Unbounded_Wide_String)
195 return Boolean;
197 ------------------------
198 -- Search Subprograms --
199 ------------------------
201 function Index
202 (Source : in Unbounded_Wide_String;
203 Pattern : in Wide_String;
204 Going : in Direction := Forward;
205 Mapping : in Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
206 return Natural;
208 function Index
209 (Source : in Unbounded_Wide_String;
210 Pattern : in Wide_String;
211 Going : in Direction := Forward;
212 Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
213 return Natural;
215 function Index
216 (Source : in Unbounded_Wide_String;
217 Set : in Wide_Maps.Wide_Character_Set;
218 Test : in Membership := Inside;
219 Going : in Direction := Forward)
220 return Natural;
222 function Index_Non_Blank
223 (Source : in Unbounded_Wide_String;
224 Going : in Direction := Forward)
225 return Natural;
227 function Count
228 (Source : in Unbounded_Wide_String;
229 Pattern : in Wide_String;
230 Mapping : in Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
231 return Natural;
233 function Count
234 (Source : in Unbounded_Wide_String;
235 Pattern : in Wide_String;
236 Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
237 return Natural;
239 function Count
240 (Source : in Unbounded_Wide_String;
241 Set : in Wide_Maps.Wide_Character_Set)
242 return Natural;
244 procedure Find_Token
245 (Source : in Unbounded_Wide_String;
246 Set : in Wide_Maps.Wide_Character_Set;
247 Test : in Membership;
248 First : out Positive;
249 Last : out Natural);
251 ------------------------------------
252 -- Wide_String Translation Subprograms --
253 ------------------------------------
255 function Translate
256 (Source : in Unbounded_Wide_String;
257 Mapping : in Wide_Maps.Wide_Character_Mapping)
258 return Unbounded_Wide_String;
260 procedure Translate
261 (Source : in out Unbounded_Wide_String;
262 Mapping : Wide_Maps.Wide_Character_Mapping);
264 function Translate
265 (Source : in Unbounded_Wide_String;
266 Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
267 return Unbounded_Wide_String;
269 procedure Translate
270 (Source : in out Unbounded_Wide_String;
271 Mapping : in Wide_Maps.Wide_Character_Mapping_Function);
273 ---------------------------------------
274 -- Wide_String Transformation Subprograms --
275 ---------------------------------------
277 function Replace_Slice
278 (Source : in Unbounded_Wide_String;
279 Low : in Positive;
280 High : in Natural;
281 By : in Wide_String)
282 return Unbounded_Wide_String;
284 procedure Replace_Slice
285 (Source : in out Unbounded_Wide_String;
286 Low : in Positive;
287 High : in Natural;
288 By : in Wide_String);
290 function Insert
291 (Source : in Unbounded_Wide_String;
292 Before : in Positive;
293 New_Item : in Wide_String)
294 return Unbounded_Wide_String;
296 procedure Insert
297 (Source : in out Unbounded_Wide_String;
298 Before : in Positive;
299 New_Item : in Wide_String);
301 function Overwrite
302 (Source : in Unbounded_Wide_String;
303 Position : in Positive;
304 New_Item : in Wide_String)
305 return Unbounded_Wide_String;
307 procedure Overwrite
308 (Source : in out Unbounded_Wide_String;
309 Position : in Positive;
310 New_Item : in Wide_String);
312 function Delete
313 (Source : in Unbounded_Wide_String;
314 From : in Positive;
315 Through : in Natural)
316 return Unbounded_Wide_String;
318 procedure Delete
319 (Source : in out Unbounded_Wide_String;
320 From : in Positive;
321 Through : in Natural);
323 function Trim
324 (Source : in Unbounded_Wide_String;
325 Side : in Trim_End)
326 return Unbounded_Wide_String;
328 procedure Trim
329 (Source : in out Unbounded_Wide_String;
330 Side : in Trim_End);
332 function Trim
333 (Source : in Unbounded_Wide_String;
334 Left : in Wide_Maps.Wide_Character_Set;
335 Right : in Wide_Maps.Wide_Character_Set)
336 return Unbounded_Wide_String;
338 procedure Trim
339 (Source : in out Unbounded_Wide_String;
340 Left : in Wide_Maps.Wide_Character_Set;
341 Right : in Wide_Maps.Wide_Character_Set);
343 function Head
344 (Source : in Unbounded_Wide_String;
345 Count : in Natural;
346 Pad : in Wide_Character := Wide_Space)
347 return Unbounded_Wide_String;
349 procedure Head
350 (Source : in out Unbounded_Wide_String;
351 Count : in Natural;
352 Pad : in Wide_Character := Wide_Space);
354 function Tail
355 (Source : in Unbounded_Wide_String;
356 Count : in Natural;
357 Pad : in Wide_Character := Wide_Space)
358 return Unbounded_Wide_String;
360 procedure Tail
361 (Source : in out Unbounded_Wide_String;
362 Count : in Natural;
363 Pad : in Wide_Character := Wide_Space);
365 function "*"
366 (Left : in Natural;
367 Right : in Wide_Character)
368 return Unbounded_Wide_String;
370 function "*"
371 (Left : in Natural;
372 Right : in Wide_String)
373 return Unbounded_Wide_String;
375 function "*"
376 (Left : in Natural;
377 Right : in Unbounded_Wide_String)
378 return Unbounded_Wide_String;
380 private
381 pragma Inline (Length);
383 package AF renames Ada.Finalization;
385 Null_Wide_String : aliased Wide_String := "";
387 function To_Unbounded_Wide (S : Wide_String) return Unbounded_Wide_String
388 renames To_Unbounded_Wide_String;
390 type Unbounded_Wide_String is new AF.Controlled with record
391 Reference : Wide_String_Access := Null_Wide_String'Access;
392 end record;
394 pragma Stream_Convert
395 (Unbounded_Wide_String, To_Unbounded_Wide, To_Wide_String);
397 pragma Finalize_Storage_Only (Unbounded_Wide_String);
399 procedure Initialize (Object : in out Unbounded_Wide_String);
400 procedure Adjust (Object : in out Unbounded_Wide_String);
401 procedure Finalize (Object : in out Unbounded_Wide_String);
403 Null_Unbounded_Wide_String : constant Unbounded_Wide_String :=
404 (AF.Controlled with Reference => Null_Wide_String'Access);
406 end Ada.Strings.Wide_Unbounded;