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 --
10 -- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
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. --
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. --
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. --
34 -- GNAT was originally developed by the GNAT team at New York University. --
35 -- Extensive contributions were provided by Ada Core Technologies Inc. --
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
65 return Unbounded_Wide_String
;
67 function To_Wide_String
68 (Source
: Unbounded_Wide_String
)
72 (Source
: in out Unbounded_Wide_String
;
73 New_Item
: in Unbounded_Wide_String
);
76 (Source
: in out Unbounded_Wide_String
;
77 New_Item
: in Wide_String);
80 (Source
: in out Unbounded_Wide_String
;
81 New_Item
: in Wide_Character);
84 (Left
, Right
: Unbounded_Wide_String
)
85 return Unbounded_Wide_String
;
88 (Left
: in Unbounded_Wide_String
;
89 Right
: in Wide_String)
90 return Unbounded_Wide_String
;
93 (Left
: in Wide_String;
94 Right
: in Unbounded_Wide_String
)
95 return Unbounded_Wide_String
;
98 (Left
: in Unbounded_Wide_String
;
99 Right
: in Wide_Character)
100 return Unbounded_Wide_String
;
103 (Left
: in Wide_Character;
104 Right
: in Unbounded_Wide_String
)
105 return Unbounded_Wide_String
;
108 (Source
: in Unbounded_Wide_String
;
110 return Wide_Character;
112 procedure Replace_Element
113 (Source
: in out Unbounded_Wide_String
;
115 By
: Wide_Character);
118 (Source
: in Unbounded_Wide_String
;
124 (Left
: in Unbounded_Wide_String
;
125 Right
: in Unbounded_Wide_String
)
129 (Left
: in Unbounded_Wide_String
;
130 Right
: in Wide_String)
134 (Left
: in Wide_String;
135 Right
: in Unbounded_Wide_String
)
139 (Left
: in Unbounded_Wide_String
;
140 Right
: in Unbounded_Wide_String
)
144 (Left
: in Unbounded_Wide_String
;
145 Right
: in Wide_String)
149 (Left
: in Wide_String;
150 Right
: in Unbounded_Wide_String
)
154 (Left
: in Unbounded_Wide_String
;
155 Right
: in Unbounded_Wide_String
)
159 (Left
: in Unbounded_Wide_String
;
160 Right
: in Wide_String)
164 (Left
: in Wide_String;
165 Right
: in Unbounded_Wide_String
)
169 (Left
: in Unbounded_Wide_String
;
170 Right
: in Unbounded_Wide_String
)
174 (Left
: in Unbounded_Wide_String
;
175 Right
: in Wide_String)
179 (Left
: in Wide_String;
180 Right
: in Unbounded_Wide_String
)
184 (Left
: in Unbounded_Wide_String
;
185 Right
: in Unbounded_Wide_String
)
189 (Left
: in Unbounded_Wide_String
;
190 Right
: in Wide_String)
194 (Left
: in Wide_String;
195 Right
: in Unbounded_Wide_String
)
198 ------------------------
199 -- Search Subprograms --
200 ------------------------
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
)
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
)
217 (Source
: in Unbounded_Wide_String
;
218 Set
: in Wide_Maps
.Wide_Character_Set
;
219 Test
: in Membership
:= Inside
;
220 Going
: in Direction
:= Forward
)
223 function Index_Non_Blank
224 (Source
: in Unbounded_Wide_String
;
225 Going
: in Direction
:= Forward
)
229 (Source
: in Unbounded_Wide_String
;
230 Pattern
: in Wide_String;
231 Mapping
: in Wide_Maps
.Wide_Character_Mapping
:= Wide_Maps
.Identity
)
235 (Source
: in Unbounded_Wide_String
;
236 Pattern
: in Wide_String;
237 Mapping
: in Wide_Maps
.Wide_Character_Mapping_Function
)
241 (Source
: in Unbounded_Wide_String
;
242 Set
: in Wide_Maps
.Wide_Character_Set
)
246 (Source
: in Unbounded_Wide_String
;
247 Set
: in Wide_Maps
.Wide_Character_Set
;
248 Test
: in Membership
;
249 First
: out Positive;
252 ------------------------------------
253 -- Wide_String Translation Subprograms --
254 ------------------------------------
257 (Source
: in Unbounded_Wide_String
;
258 Mapping
: in Wide_Maps
.Wide_Character_Mapping
)
259 return Unbounded_Wide_String
;
262 (Source
: in out Unbounded_Wide_String
;
263 Mapping
: Wide_Maps
.Wide_Character_Mapping
);
266 (Source
: in Unbounded_Wide_String
;
267 Mapping
: in Wide_Maps
.Wide_Character_Mapping_Function
)
268 return Unbounded_Wide_String
;
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
;
283 return Unbounded_Wide_String
;
285 procedure Replace_Slice
286 (Source
: in out Unbounded_Wide_String
;
289 By
: in Wide_String);
292 (Source
: in Unbounded_Wide_String
;
293 Before
: in Positive;
294 New_Item
: in Wide_String)
295 return Unbounded_Wide_String
;
298 (Source
: in out Unbounded_Wide_String
;
299 Before
: in Positive;
300 New_Item
: in Wide_String);
303 (Source
: in Unbounded_Wide_String
;
304 Position
: in Positive;
305 New_Item
: in Wide_String)
306 return Unbounded_Wide_String
;
309 (Source
: in out Unbounded_Wide_String
;
310 Position
: in Positive;
311 New_Item
: in Wide_String);
314 (Source
: in Unbounded_Wide_String
;
316 Through
: in Natural)
317 return Unbounded_Wide_String
;
320 (Source
: in out Unbounded_Wide_String
;
322 Through
: in Natural);
325 (Source
: in Unbounded_Wide_String
;
327 return Unbounded_Wide_String
;
330 (Source
: in out Unbounded_Wide_String
;
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
;
340 (Source
: in out Unbounded_Wide_String
;
341 Left
: in Wide_Maps
.Wide_Character_Set
;
342 Right
: in Wide_Maps
.Wide_Character_Set
);
345 (Source
: in Unbounded_Wide_String
;
347 Pad
: in Wide_Character := Wide_Space
)
348 return Unbounded_Wide_String
;
351 (Source
: in out Unbounded_Wide_String
;
353 Pad
: in Wide_Character := Wide_Space
);
356 (Source
: in Unbounded_Wide_String
;
358 Pad
: in Wide_Character := Wide_Space
)
359 return Unbounded_Wide_String
;
362 (Source
: in out Unbounded_Wide_String
;
364 Pad
: in Wide_Character := Wide_Space
);
368 Right
: in Wide_Character)
369 return Unbounded_Wide_String
;
373 Right
: in Wide_String)
374 return Unbounded_Wide_String
;
378 Right
: in Unbounded_Wide_String
)
379 return Unbounded_Wide_String
;
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;
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
;