1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- A D A . S T R I N G S . W I D E _ W I D E _ U N B O U N D E D --
9 -- Copyright (C) 1992-2005 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_Wide_Maps
;
39 with Ada
.Finalization
;
41 package Ada
.Strings
.Wide_Wide_Unbounded
is
42 pragma Preelaborate
(Wide_Wide_Unbounded
);
44 type Unbounded_Wide_Wide_String
is private;
46 Null_Unbounded_Wide_Wide_String
: constant Unbounded_Wide_Wide_String
;
48 function Length
(Source
: Unbounded_Wide_Wide_String
) return Natural;
50 type Wide_Wide_String_Access
is access all Wide_Wide_String
;
52 procedure Free
(X
: in out Wide_Wide_String_Access
);
54 --------------------------------------------------------
55 -- Conversion, Concatenation, and Selection Functions --
56 --------------------------------------------------------
58 function To_Unbounded_Wide_Wide_String
59 (Source
: Wide_Wide_String
) return Unbounded_Wide_Wide_String
;
61 function To_Unbounded_Wide_Wide_String
62 (Length
: Natural) return Unbounded_Wide_Wide_String
;
64 function To_Wide_Wide_String
65 (Source
: Unbounded_Wide_Wide_String
) return Wide_Wide_String
;
68 (Source
: in out Unbounded_Wide_Wide_String
;
69 New_Item
: Unbounded_Wide_Wide_String
);
72 (Source
: in out Unbounded_Wide_Wide_String
;
73 New_Item
: Wide_Wide_String
);
76 (Source
: in out Unbounded_Wide_Wide_String
;
77 New_Item
: Wide_Wide_Character
);
80 (Left
, Right
: Unbounded_Wide_Wide_String
)
81 return Unbounded_Wide_Wide_String
;
84 (Left
: Unbounded_Wide_Wide_String
;
85 Right
: Wide_Wide_String
) return Unbounded_Wide_Wide_String
;
88 (Left
: Wide_Wide_String
;
89 Right
: Unbounded_Wide_Wide_String
) return Unbounded_Wide_Wide_String
;
92 (Left
: Unbounded_Wide_Wide_String
;
93 Right
: Wide_Wide_Character
) return Unbounded_Wide_Wide_String
;
96 (Left
: Wide_Wide_Character
;
97 Right
: Unbounded_Wide_Wide_String
) return Unbounded_Wide_Wide_String
;
100 (Source
: Unbounded_Wide_Wide_String
;
101 Index
: Positive) return Wide_Wide_Character
;
103 procedure Replace_Element
104 (Source
: in out Unbounded_Wide_Wide_String
;
106 By
: Wide_Wide_Character
);
109 (Source
: Unbounded_Wide_Wide_String
;
111 High
: Natural) return Wide_Wide_String
;
114 (Left
: Unbounded_Wide_Wide_String
;
115 Right
: Unbounded_Wide_Wide_String
) return Boolean;
118 (Left
: Unbounded_Wide_Wide_String
;
119 Right
: Wide_Wide_String
) return Boolean;
122 (Left
: Wide_Wide_String
;
123 Right
: Unbounded_Wide_Wide_String
) return Boolean;
126 (Left
: Unbounded_Wide_Wide_String
;
127 Right
: Unbounded_Wide_Wide_String
) return Boolean;
130 (Left
: Unbounded_Wide_Wide_String
;
131 Right
: Wide_Wide_String
) return Boolean;
134 (Left
: Wide_Wide_String
;
135 Right
: Unbounded_Wide_Wide_String
) return Boolean;
138 (Left
: Unbounded_Wide_Wide_String
;
139 Right
: Unbounded_Wide_Wide_String
) return Boolean;
142 (Left
: Unbounded_Wide_Wide_String
;
143 Right
: Wide_Wide_String
) return Boolean;
146 (Left
: Wide_Wide_String
;
147 Right
: Unbounded_Wide_Wide_String
) return Boolean;
150 (Left
: Unbounded_Wide_Wide_String
;
151 Right
: Unbounded_Wide_Wide_String
) return Boolean;
154 (Left
: Unbounded_Wide_Wide_String
;
155 Right
: Wide_Wide_String
) return Boolean;
158 (Left
: Wide_Wide_String
;
159 Right
: Unbounded_Wide_Wide_String
) return Boolean;
162 (Left
: Unbounded_Wide_Wide_String
;
163 Right
: Unbounded_Wide_Wide_String
) return Boolean;
166 (Left
: Unbounded_Wide_Wide_String
;
167 Right
: Wide_Wide_String
) return Boolean;
170 (Left
: Wide_Wide_String
;
171 Right
: Unbounded_Wide_Wide_String
) return Boolean;
173 ------------------------
174 -- Search Subprograms --
175 ------------------------
178 (Source
: Unbounded_Wide_Wide_String
;
179 Pattern
: Wide_Wide_String
;
180 Going
: Direction
:= Forward
;
181 Mapping
: Wide_Wide_Maps
.Wide_Wide_Character_Mapping
:=
182 Wide_Wide_Maps
.Identity
) return Natural;
185 (Source
: Unbounded_Wide_Wide_String
;
186 Pattern
: Wide_Wide_String
;
187 Going
: Direction
:= Forward
;
188 Mapping
: Wide_Wide_Maps
.Wide_Wide_Character_Mapping_Function
)
192 (Source
: Unbounded_Wide_Wide_String
;
193 Set
: Wide_Wide_Maps
.Wide_Wide_Character_Set
;
194 Test
: Membership
:= Inside
;
195 Going
: Direction
:= Forward
) return Natural;
197 function Index_Non_Blank
198 (Source
: Unbounded_Wide_Wide_String
;
199 Going
: Direction
:= Forward
) return Natural;
202 (Source
: Unbounded_Wide_Wide_String
;
203 Pattern
: Wide_Wide_String
;
204 Mapping
: Wide_Wide_Maps
.Wide_Wide_Character_Mapping
:=
205 Wide_Wide_Maps
.Identity
) return Natural;
208 (Source
: Unbounded_Wide_Wide_String
;
209 Pattern
: Wide_Wide_String
;
210 Mapping
: Wide_Wide_Maps
.Wide_Wide_Character_Mapping_Function
)
214 (Source
: Unbounded_Wide_Wide_String
;
215 Set
: Wide_Wide_Maps
.Wide_Wide_Character_Set
) return Natural;
218 (Source
: Unbounded_Wide_Wide_String
;
219 Set
: Wide_Wide_Maps
.Wide_Wide_Character_Set
;
221 First
: out Positive;
224 ------------------------------------
225 -- Wide_Wide_String Translation Subprograms --
226 ------------------------------------
229 (Source
: Unbounded_Wide_Wide_String
;
230 Mapping
: Wide_Wide_Maps
.Wide_Wide_Character_Mapping
)
231 return Unbounded_Wide_Wide_String
;
234 (Source
: in out Unbounded_Wide_Wide_String
;
235 Mapping
: Wide_Wide_Maps
.Wide_Wide_Character_Mapping
);
238 (Source
: Unbounded_Wide_Wide_String
;
239 Mapping
: Wide_Wide_Maps
.Wide_Wide_Character_Mapping_Function
)
240 return Unbounded_Wide_Wide_String
;
243 (Source
: in out Unbounded_Wide_Wide_String
;
244 Mapping
: Wide_Wide_Maps
.Wide_Wide_Character_Mapping_Function
);
246 ---------------------------------------
247 -- Wide_Wide_String Transformation Subprograms --
248 ---------------------------------------
250 function Replace_Slice
251 (Source
: Unbounded_Wide_Wide_String
;
254 By
: Wide_Wide_String
) return Unbounded_Wide_Wide_String
;
256 procedure Replace_Slice
257 (Source
: in out Unbounded_Wide_Wide_String
;
260 By
: Wide_Wide_String
);
263 (Source
: Unbounded_Wide_Wide_String
;
265 New_Item
: Wide_Wide_String
) return Unbounded_Wide_Wide_String
;
268 (Source
: in out Unbounded_Wide_Wide_String
;
270 New_Item
: Wide_Wide_String
);
273 (Source
: Unbounded_Wide_Wide_String
;
275 New_Item
: Wide_Wide_String
) return Unbounded_Wide_Wide_String
;
278 (Source
: in out Unbounded_Wide_Wide_String
;
280 New_Item
: Wide_Wide_String
);
283 (Source
: Unbounded_Wide_Wide_String
;
285 Through
: Natural) return Unbounded_Wide_Wide_String
;
288 (Source
: in out Unbounded_Wide_Wide_String
;
293 (Source
: Unbounded_Wide_Wide_String
;
294 Side
: Trim_End
) return Unbounded_Wide_Wide_String
;
297 (Source
: in out Unbounded_Wide_Wide_String
;
301 (Source
: Unbounded_Wide_Wide_String
;
302 Left
: Wide_Wide_Maps
.Wide_Wide_Character_Set
;
303 Right
: Wide_Wide_Maps
.Wide_Wide_Character_Set
)
304 return Unbounded_Wide_Wide_String
;
307 (Source
: in out Unbounded_Wide_Wide_String
;
308 Left
: Wide_Wide_Maps
.Wide_Wide_Character_Set
;
309 Right
: Wide_Wide_Maps
.Wide_Wide_Character_Set
);
312 (Source
: Unbounded_Wide_Wide_String
;
314 Pad
: Wide_Wide_Character
:= Wide_Wide_Space
)
315 return Unbounded_Wide_Wide_String
;
318 (Source
: in out Unbounded_Wide_Wide_String
;
320 Pad
: Wide_Wide_Character
:= Wide_Wide_Space
);
323 (Source
: Unbounded_Wide_Wide_String
;
325 Pad
: Wide_Wide_Character
:= Wide_Wide_Space
)
326 return Unbounded_Wide_Wide_String
;
329 (Source
: in out Unbounded_Wide_Wide_String
;
331 Pad
: Wide_Wide_Character
:= Wide_Wide_Space
);
335 Right
: Wide_Wide_Character
) return Unbounded_Wide_Wide_String
;
339 Right
: Wide_Wide_String
) return Unbounded_Wide_Wide_String
;
343 Right
: Unbounded_Wide_Wide_String
) return Unbounded_Wide_Wide_String
;
346 pragma Inline
(Length
);
348 package AF
renames Ada
.Finalization
;
350 Null_Wide_Wide_String
: aliased Wide_Wide_String
:= "";
352 function To_Unbounded_Wide
353 (S
: Wide_Wide_String
) return Unbounded_Wide_Wide_String
354 renames To_Unbounded_Wide_Wide_String
;
356 type Unbounded_Wide_Wide_String
is new AF
.Controlled
with record
357 Reference
: Wide_Wide_String_Access
:= Null_Wide_Wide_String
'Access;
361 -- The Unbounded_Wide_Wide_String is using a buffered implementation to
362 -- increase speed of the Append/Delete/Insert procedures. The Reference
363 -- string pointer above contains the current string value and extra room
364 -- at the end to be used by the next Append routine. Last is the index of
365 -- the string ending character. So the current string value is really
366 -- Reference (1 .. Last).
368 pragma Stream_Convert
369 (Unbounded_Wide_Wide_String
, To_Unbounded_Wide
, To_Wide_Wide_String
);
371 pragma Finalize_Storage_Only
(Unbounded_Wide_Wide_String
);
373 procedure Initialize
(Object
: in out Unbounded_Wide_Wide_String
);
374 procedure Adjust
(Object
: in out Unbounded_Wide_Wide_String
);
375 procedure Finalize
(Object
: in out Unbounded_Wide_Wide_String
);
377 Null_Unbounded_Wide_Wide_String
: constant Unbounded_Wide_Wide_String
:=
378 (AF
.Controlled
with Reference
=> Null_Wide_Wide_String
'Access, Last
=> 0);
380 end Ada
.Strings
.Wide_Wide_Unbounded
;