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 --
11 -- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
13 -- This specification is derived from the Ada Reference Manual for use with --
14 -- GNAT. The copyright notice above, and the license provisions that follow --
15 -- apply solely to the contents of the part following the private keyword. --
17 -- GNAT is free software; you can redistribute it and/or modify it under --
18 -- terms of the GNU General Public License as published by the Free Soft- --
19 -- ware Foundation; either version 2, or (at your option) any later ver- --
20 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
21 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
22 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
23 -- for more details. You should have received a copy of the GNU General --
24 -- Public License distributed with GNAT; see file COPYING. If not, write --
25 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
26 -- MA 02111-1307, USA. --
28 -- As a special exception, if other files instantiate generics from this --
29 -- unit, or you link this unit with other files to produce an executable, --
30 -- this unit does not by itself cause the resulting executable to be --
31 -- covered by the GNU General Public License. This exception does not --
32 -- however invalidate any other reasons why the executable file might be --
33 -- covered by the GNU Public License. --
35 -- GNAT was originally developed by the GNAT team at New York University. --
36 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
38 ------------------------------------------------------------------------------
40 with Ada
.Strings
.Wide_Maps
;
41 with Ada
.Finalization
;
43 package Ada
.Strings
.Wide_Unbounded
is
44 pragma Preelaborate
(Wide_Unbounded
);
46 type Unbounded_Wide_String
is private;
48 Null_Unbounded_Wide_String
: constant Unbounded_Wide_String
;
50 function Length
(Source
: Unbounded_Wide_String
) return Natural;
52 type Wide_String_Access
is access all Wide_String;
54 procedure Free
(X
: in out Wide_String_Access
);
56 --------------------------------------------------------
57 -- Conversion, Concatenation, and Selection Functions --
58 --------------------------------------------------------
60 function To_Unbounded_Wide_String
61 (Source
: Wide_String)
62 return Unbounded_Wide_String
;
64 function To_Unbounded_Wide_String
66 return Unbounded_Wide_String
;
68 function To_Wide_String
69 (Source
: Unbounded_Wide_String
)
73 (Source
: in out Unbounded_Wide_String
;
74 New_Item
: in Unbounded_Wide_String
);
77 (Source
: in out Unbounded_Wide_String
;
78 New_Item
: in Wide_String);
81 (Source
: in out Unbounded_Wide_String
;
82 New_Item
: in Wide_Character);
85 (Left
, Right
: Unbounded_Wide_String
)
86 return Unbounded_Wide_String
;
89 (Left
: in Unbounded_Wide_String
;
90 Right
: in Wide_String)
91 return Unbounded_Wide_String
;
94 (Left
: in Wide_String;
95 Right
: in Unbounded_Wide_String
)
96 return Unbounded_Wide_String
;
99 (Left
: in Unbounded_Wide_String
;
100 Right
: in Wide_Character)
101 return Unbounded_Wide_String
;
104 (Left
: in Wide_Character;
105 Right
: in Unbounded_Wide_String
)
106 return Unbounded_Wide_String
;
109 (Source
: in Unbounded_Wide_String
;
111 return Wide_Character;
113 procedure Replace_Element
114 (Source
: in out Unbounded_Wide_String
;
116 By
: Wide_Character);
119 (Source
: in Unbounded_Wide_String
;
125 (Left
: in Unbounded_Wide_String
;
126 Right
: in Unbounded_Wide_String
)
130 (Left
: in Unbounded_Wide_String
;
131 Right
: in Wide_String)
135 (Left
: in Wide_String;
136 Right
: in Unbounded_Wide_String
)
140 (Left
: in Unbounded_Wide_String
;
141 Right
: in Unbounded_Wide_String
)
145 (Left
: in Unbounded_Wide_String
;
146 Right
: in Wide_String)
150 (Left
: in Wide_String;
151 Right
: in Unbounded_Wide_String
)
155 (Left
: in Unbounded_Wide_String
;
156 Right
: in Unbounded_Wide_String
)
160 (Left
: in Unbounded_Wide_String
;
161 Right
: in Wide_String)
165 (Left
: in Wide_String;
166 Right
: in Unbounded_Wide_String
)
170 (Left
: in Unbounded_Wide_String
;
171 Right
: in Unbounded_Wide_String
)
175 (Left
: in Unbounded_Wide_String
;
176 Right
: in Wide_String)
180 (Left
: in Wide_String;
181 Right
: in Unbounded_Wide_String
)
185 (Left
: in Unbounded_Wide_String
;
186 Right
: in Unbounded_Wide_String
)
190 (Left
: in Unbounded_Wide_String
;
191 Right
: in Wide_String)
195 (Left
: in Wide_String;
196 Right
: in Unbounded_Wide_String
)
199 ------------------------
200 -- Search Subprograms --
201 ------------------------
204 (Source
: in Unbounded_Wide_String
;
205 Pattern
: in Wide_String;
206 Going
: in Direction
:= Forward
;
207 Mapping
: in Wide_Maps
.Wide_Character_Mapping
:= Wide_Maps
.Identity
)
211 (Source
: in Unbounded_Wide_String
;
212 Pattern
: in Wide_String;
213 Going
: in Direction
:= Forward
;
214 Mapping
: in Wide_Maps
.Wide_Character_Mapping_Function
)
218 (Source
: in Unbounded_Wide_String
;
219 Set
: in Wide_Maps
.Wide_Character_Set
;
220 Test
: in Membership
:= Inside
;
221 Going
: in Direction
:= Forward
)
224 function Index_Non_Blank
225 (Source
: in Unbounded_Wide_String
;
226 Going
: in Direction
:= Forward
)
230 (Source
: in Unbounded_Wide_String
;
231 Pattern
: in Wide_String;
232 Mapping
: in Wide_Maps
.Wide_Character_Mapping
:= Wide_Maps
.Identity
)
236 (Source
: in Unbounded_Wide_String
;
237 Pattern
: in Wide_String;
238 Mapping
: in Wide_Maps
.Wide_Character_Mapping_Function
)
242 (Source
: in Unbounded_Wide_String
;
243 Set
: in Wide_Maps
.Wide_Character_Set
)
247 (Source
: in Unbounded_Wide_String
;
248 Set
: in Wide_Maps
.Wide_Character_Set
;
249 Test
: in Membership
;
250 First
: out Positive;
253 ------------------------------------
254 -- Wide_String Translation Subprograms --
255 ------------------------------------
258 (Source
: in Unbounded_Wide_String
;
259 Mapping
: in Wide_Maps
.Wide_Character_Mapping
)
260 return Unbounded_Wide_String
;
263 (Source
: in out Unbounded_Wide_String
;
264 Mapping
: Wide_Maps
.Wide_Character_Mapping
);
267 (Source
: in Unbounded_Wide_String
;
268 Mapping
: in Wide_Maps
.Wide_Character_Mapping_Function
)
269 return Unbounded_Wide_String
;
272 (Source
: in out Unbounded_Wide_String
;
273 Mapping
: in Wide_Maps
.Wide_Character_Mapping_Function
);
275 ---------------------------------------
276 -- Wide_String Transformation Subprograms --
277 ---------------------------------------
279 function Replace_Slice
280 (Source
: in Unbounded_Wide_String
;
284 return Unbounded_Wide_String
;
286 procedure Replace_Slice
287 (Source
: in out Unbounded_Wide_String
;
290 By
: in Wide_String);
293 (Source
: in Unbounded_Wide_String
;
294 Before
: in Positive;
295 New_Item
: in Wide_String)
296 return Unbounded_Wide_String
;
299 (Source
: in out Unbounded_Wide_String
;
300 Before
: in Positive;
301 New_Item
: in Wide_String);
304 (Source
: in Unbounded_Wide_String
;
305 Position
: in Positive;
306 New_Item
: in Wide_String)
307 return Unbounded_Wide_String
;
310 (Source
: in out Unbounded_Wide_String
;
311 Position
: in Positive;
312 New_Item
: in Wide_String);
315 (Source
: in Unbounded_Wide_String
;
317 Through
: in Natural)
318 return Unbounded_Wide_String
;
321 (Source
: in out Unbounded_Wide_String
;
323 Through
: in Natural);
326 (Source
: in Unbounded_Wide_String
;
328 return Unbounded_Wide_String
;
331 (Source
: in out Unbounded_Wide_String
;
335 (Source
: in Unbounded_Wide_String
;
336 Left
: in Wide_Maps
.Wide_Character_Set
;
337 Right
: in Wide_Maps
.Wide_Character_Set
)
338 return Unbounded_Wide_String
;
341 (Source
: in out Unbounded_Wide_String
;
342 Left
: in Wide_Maps
.Wide_Character_Set
;
343 Right
: in Wide_Maps
.Wide_Character_Set
);
346 (Source
: in Unbounded_Wide_String
;
348 Pad
: in Wide_Character := Wide_Space
)
349 return Unbounded_Wide_String
;
352 (Source
: in out Unbounded_Wide_String
;
354 Pad
: in Wide_Character := Wide_Space
);
357 (Source
: in Unbounded_Wide_String
;
359 Pad
: in Wide_Character := Wide_Space
)
360 return Unbounded_Wide_String
;
363 (Source
: in out Unbounded_Wide_String
;
365 Pad
: in Wide_Character := Wide_Space
);
369 Right
: in Wide_Character)
370 return Unbounded_Wide_String
;
374 Right
: in Wide_String)
375 return Unbounded_Wide_String
;
379 Right
: in Unbounded_Wide_String
)
380 return Unbounded_Wide_String
;
383 pragma Inline
(Length
);
385 package AF
renames Ada
.Finalization
;
387 Null_Wide_String
: aliased Wide_String := "";
389 function To_Unbounded_Wide
(S
: Wide_String) return Unbounded_Wide_String
390 renames To_Unbounded_Wide_String
;
392 type Unbounded_Wide_String
is new AF
.Controlled
with record
393 Reference
: Wide_String_Access
:= Null_Wide_String
'Access;
396 pragma Stream_Convert
397 (Unbounded_Wide_String
, To_Unbounded_Wide
, To_Wide_String
);
399 pragma Finalize_Storage_Only
(Unbounded_Wide_String
);
401 procedure Initialize
(Object
: in out Unbounded_Wide_String
);
402 procedure Adjust
(Object
: in out Unbounded_Wide_String
);
403 procedure Finalize
(Object
: in out Unbounded_Wide_String
);
405 Null_Unbounded_Wide_String
: constant Unbounded_Wide_String
:=
406 (AF
.Controlled
with Reference
=> Null_Wide_String
'Access);
408 end Ada
.Strings
.Wide_Unbounded
;