1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- A D A . S T R I N G S . W I D E _ U N B O U N D E D --
9 -- Copyright (C) 1992-2002 Free Software Foundation, Inc. --
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. --
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. --
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. --
33 -- GNAT was originally developed by the GNAT team at New York University. --
34 -- Extensive contributions were provided by Ada Core Technologies Inc. --
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
64 return Unbounded_Wide_String;
66 function To_Wide_String
67 (Source : Unbounded_Wide_String)
71 (Source : in out Unbounded_Wide_String;
72 New_Item : in Unbounded_Wide_String);
75 (Source : in out Unbounded_Wide_String;
76 New_Item : in Wide_String);
79 (Source : in out Unbounded_Wide_String;
80 New_Item : in Wide_Character);
83 (Left, Right : Unbounded_Wide_String)
84 return Unbounded_Wide_String;
87 (Left : in Unbounded_Wide_String;
88 Right : in Wide_String)
89 return Unbounded_Wide_String;
92 (Left : in Wide_String;
93 Right : in Unbounded_Wide_String)
94 return Unbounded_Wide_String;
97 (Left : in Unbounded_Wide_String;
98 Right : in Wide_Character)
99 return Unbounded_Wide_String;
102 (Left : in Wide_Character;
103 Right : in Unbounded_Wide_String)
104 return Unbounded_Wide_String;
107 (Source : in Unbounded_Wide_String;
109 return Wide_Character;
111 procedure Replace_Element
112 (Source : in out Unbounded_Wide_String;
114 By : Wide_Character);
117 (Source : in Unbounded_Wide_String;
123 (Left : in Unbounded_Wide_String;
124 Right : in Unbounded_Wide_String)
128 (Left : in Unbounded_Wide_String;
129 Right : in Wide_String)
133 (Left : in Wide_String;
134 Right : in Unbounded_Wide_String)
138 (Left : in Unbounded_Wide_String;
139 Right : in Unbounded_Wide_String)
143 (Left : in Unbounded_Wide_String;
144 Right : in Wide_String)
148 (Left : in Wide_String;
149 Right : in Unbounded_Wide_String)
153 (Left : in Unbounded_Wide_String;
154 Right : in Unbounded_Wide_String)
158 (Left : in Unbounded_Wide_String;
159 Right : in Wide_String)
163 (Left : in Wide_String;
164 Right : in Unbounded_Wide_String)
168 (Left : in Unbounded_Wide_String;
169 Right : in Unbounded_Wide_String)
173 (Left : in Unbounded_Wide_String;
174 Right : in Wide_String)
178 (Left : in Wide_String;
179 Right : in Unbounded_Wide_String)
183 (Left : in Unbounded_Wide_String;
184 Right : in Unbounded_Wide_String)
188 (Left : in Unbounded_Wide_String;
189 Right : in Wide_String)
193 (Left : in Wide_String;
194 Right : in Unbounded_Wide_String)
197 ------------------------
198 -- Search Subprograms --
199 ------------------------
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)
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)
216 (Source : in Unbounded_Wide_String;
217 Set : in Wide_Maps.Wide_Character_Set;
218 Test : in Membership := Inside;
219 Going : in Direction := Forward)
222 function Index_Non_Blank
223 (Source : in Unbounded_Wide_String;
224 Going : in Direction := Forward)
228 (Source : in Unbounded_Wide_String;
229 Pattern : in Wide_String;
230 Mapping : in Wide_Maps.Wide_Character_Mapping := Wide_Maps.Identity)
234 (Source : in Unbounded_Wide_String;
235 Pattern : in Wide_String;
236 Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
240 (Source : in Unbounded_Wide_String;
241 Set : in Wide_Maps.Wide_Character_Set)
245 (Source : in Unbounded_Wide_String;
246 Set : in Wide_Maps.Wide_Character_Set;
247 Test : in Membership;
248 First : out Positive;
251 ------------------------------------
252 -- Wide_String Translation Subprograms --
253 ------------------------------------
256 (Source : in Unbounded_Wide_String;
257 Mapping : in Wide_Maps.Wide_Character_Mapping)
258 return Unbounded_Wide_String;
261 (Source : in out Unbounded_Wide_String;
262 Mapping : Wide_Maps.Wide_Character_Mapping);
265 (Source : in Unbounded_Wide_String;
266 Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
267 return Unbounded_Wide_String;
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;
282 return Unbounded_Wide_String;
284 procedure Replace_Slice
285 (Source : in out Unbounded_Wide_String;
288 By : in Wide_String);
291 (Source : in Unbounded_Wide_String;
292 Before : in Positive;
293 New_Item : in Wide_String)
294 return Unbounded_Wide_String;
297 (Source : in out Unbounded_Wide_String;
298 Before : in Positive;
299 New_Item : in Wide_String);
302 (Source : in Unbounded_Wide_String;
303 Position : in Positive;
304 New_Item : in Wide_String)
305 return Unbounded_Wide_String;
308 (Source : in out Unbounded_Wide_String;
309 Position : in Positive;
310 New_Item : in Wide_String);
313 (Source : in Unbounded_Wide_String;
315 Through : in Natural)
316 return Unbounded_Wide_String;
319 (Source : in out Unbounded_Wide_String;
321 Through : in Natural);
324 (Source : in Unbounded_Wide_String;
326 return Unbounded_Wide_String;
329 (Source : in out Unbounded_Wide_String;
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;
339 (Source : in out Unbounded_Wide_String;
340 Left : in Wide_Maps.Wide_Character_Set;
341 Right : in Wide_Maps.Wide_Character_Set);
344 (Source : in Unbounded_Wide_String;
346 Pad : in Wide_Character := Wide_Space)
347 return Unbounded_Wide_String;
350 (Source : in out Unbounded_Wide_String;
352 Pad : in Wide_Character := Wide_Space);
355 (Source : in Unbounded_Wide_String;
357 Pad : in Wide_Character := Wide_Space)
358 return Unbounded_Wide_String;
361 (Source : in out Unbounded_Wide_String;
363 Pad : in Wide_Character := Wide_Space);
367 Right : in Wide_Character)
368 return Unbounded_Wide_String;
372 Right : in Wide_String)
373 return Unbounded_Wide_String;
377 Right : in Unbounded_Wide_String)
378 return Unbounded_Wide_String;
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;
395 -- The Unbounded_Wide_String is using a buffered implementation to increase
396 -- speed of the Append/Delete/Insert procedures. The Reference string
397 -- pointer above contains the current string value and extra room at the
398 -- end to be used by the next Append routine. Last is the index of the
399 -- string ending character. So the current string value is really
400 -- Reference (1 .. Last).
402 pragma Stream_Convert
403 (Unbounded_Wide_String, To_Unbounded_Wide, To_Wide_String);
405 pragma Finalize_Storage_Only (Unbounded_Wide_String);
407 procedure Initialize (Object : in out Unbounded_Wide_String);
408 procedure Adjust (Object : in out Unbounded_Wide_String);
409 procedure Finalize (Object : in out Unbounded_Wide_String);
411 Null_Unbounded_Wide_String : constant Unbounded_Wide_String :=
412 (AF.Controlled with Reference => Null_Wide_String'Access, Last => 0);
414 end Ada.Strings.Wide_Unbounded;