This commit was manufactured by cvs2svn to create branch
[official-gcc.git] / gcc / ada / a-stzunb.ads
blob3090b6ee6b2b916f3402136638c47d989ddd511a
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
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 --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2005 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_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;
67 procedure Append
68 (Source : in out Unbounded_Wide_Wide_String;
69 New_Item : Unbounded_Wide_Wide_String);
71 procedure Append
72 (Source : in out Unbounded_Wide_Wide_String;
73 New_Item : Wide_Wide_String);
75 procedure Append
76 (Source : in out Unbounded_Wide_Wide_String;
77 New_Item : Wide_Wide_Character);
79 function "&"
80 (Left, Right : Unbounded_Wide_Wide_String)
81 return Unbounded_Wide_Wide_String;
83 function "&"
84 (Left : Unbounded_Wide_Wide_String;
85 Right : Wide_Wide_String) return Unbounded_Wide_Wide_String;
87 function "&"
88 (Left : Wide_Wide_String;
89 Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String;
91 function "&"
92 (Left : Unbounded_Wide_Wide_String;
93 Right : Wide_Wide_Character) return Unbounded_Wide_Wide_String;
95 function "&"
96 (Left : Wide_Wide_Character;
97 Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String;
99 function Element
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;
105 Index : Positive;
106 By : Wide_Wide_Character);
108 function Slice
109 (Source : Unbounded_Wide_Wide_String;
110 Low : Positive;
111 High : Natural) return Wide_Wide_String;
113 function "="
114 (Left : Unbounded_Wide_Wide_String;
115 Right : Unbounded_Wide_Wide_String) return Boolean;
117 function "="
118 (Left : Unbounded_Wide_Wide_String;
119 Right : Wide_Wide_String) return Boolean;
121 function "="
122 (Left : Wide_Wide_String;
123 Right : Unbounded_Wide_Wide_String) return Boolean;
125 function "<"
126 (Left : Unbounded_Wide_Wide_String;
127 Right : Unbounded_Wide_Wide_String) return Boolean;
129 function "<"
130 (Left : Unbounded_Wide_Wide_String;
131 Right : Wide_Wide_String) return Boolean;
133 function "<"
134 (Left : Wide_Wide_String;
135 Right : Unbounded_Wide_Wide_String) return Boolean;
137 function "<="
138 (Left : Unbounded_Wide_Wide_String;
139 Right : Unbounded_Wide_Wide_String) return Boolean;
141 function "<="
142 (Left : Unbounded_Wide_Wide_String;
143 Right : Wide_Wide_String) return Boolean;
145 function "<="
146 (Left : Wide_Wide_String;
147 Right : Unbounded_Wide_Wide_String) return Boolean;
149 function ">"
150 (Left : Unbounded_Wide_Wide_String;
151 Right : Unbounded_Wide_Wide_String) return Boolean;
153 function ">"
154 (Left : Unbounded_Wide_Wide_String;
155 Right : Wide_Wide_String) return Boolean;
157 function ">"
158 (Left : Wide_Wide_String;
159 Right : Unbounded_Wide_Wide_String) return Boolean;
161 function ">="
162 (Left : Unbounded_Wide_Wide_String;
163 Right : Unbounded_Wide_Wide_String) return Boolean;
165 function ">="
166 (Left : Unbounded_Wide_Wide_String;
167 Right : Wide_Wide_String) return Boolean;
169 function ">="
170 (Left : Wide_Wide_String;
171 Right : Unbounded_Wide_Wide_String) return Boolean;
173 ------------------------
174 -- Search Subprograms --
175 ------------------------
177 function Index
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;
184 function Index
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)
189 return Natural;
191 function Index
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;
201 function Count
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;
207 function Count
208 (Source : Unbounded_Wide_Wide_String;
209 Pattern : Wide_Wide_String;
210 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
211 return Natural;
213 function Count
214 (Source : Unbounded_Wide_Wide_String;
215 Set : Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural;
217 procedure Find_Token
218 (Source : Unbounded_Wide_Wide_String;
219 Set : Wide_Wide_Maps.Wide_Wide_Character_Set;
220 Test : Membership;
221 First : out Positive;
222 Last : out Natural);
224 ------------------------------------
225 -- Wide_Wide_String Translation Subprograms --
226 ------------------------------------
228 function Translate
229 (Source : Unbounded_Wide_Wide_String;
230 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping)
231 return Unbounded_Wide_Wide_String;
233 procedure Translate
234 (Source : in out Unbounded_Wide_Wide_String;
235 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping);
237 function Translate
238 (Source : Unbounded_Wide_Wide_String;
239 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
240 return Unbounded_Wide_Wide_String;
242 procedure Translate
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;
252 Low : Positive;
253 High : Natural;
254 By : Wide_Wide_String) return Unbounded_Wide_Wide_String;
256 procedure Replace_Slice
257 (Source : in out Unbounded_Wide_Wide_String;
258 Low : Positive;
259 High : Natural;
260 By : Wide_Wide_String);
262 function Insert
263 (Source : Unbounded_Wide_Wide_String;
264 Before : Positive;
265 New_Item : Wide_Wide_String) return Unbounded_Wide_Wide_String;
267 procedure Insert
268 (Source : in out Unbounded_Wide_Wide_String;
269 Before : Positive;
270 New_Item : Wide_Wide_String);
272 function Overwrite
273 (Source : Unbounded_Wide_Wide_String;
274 Position : Positive;
275 New_Item : Wide_Wide_String) return Unbounded_Wide_Wide_String;
277 procedure Overwrite
278 (Source : in out Unbounded_Wide_Wide_String;
279 Position : Positive;
280 New_Item : Wide_Wide_String);
282 function Delete
283 (Source : Unbounded_Wide_Wide_String;
284 From : Positive;
285 Through : Natural) return Unbounded_Wide_Wide_String;
287 procedure Delete
288 (Source : in out Unbounded_Wide_Wide_String;
289 From : Positive;
290 Through : Natural);
292 function Trim
293 (Source : Unbounded_Wide_Wide_String;
294 Side : Trim_End) return Unbounded_Wide_Wide_String;
296 procedure Trim
297 (Source : in out Unbounded_Wide_Wide_String;
298 Side : Trim_End);
300 function Trim
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;
306 procedure Trim
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);
311 function Head
312 (Source : Unbounded_Wide_Wide_String;
313 Count : Natural;
314 Pad : Wide_Wide_Character := Wide_Wide_Space)
315 return Unbounded_Wide_Wide_String;
317 procedure Head
318 (Source : in out Unbounded_Wide_Wide_String;
319 Count : Natural;
320 Pad : Wide_Wide_Character := Wide_Wide_Space);
322 function Tail
323 (Source : Unbounded_Wide_Wide_String;
324 Count : Natural;
325 Pad : Wide_Wide_Character := Wide_Wide_Space)
326 return Unbounded_Wide_Wide_String;
328 procedure Tail
329 (Source : in out Unbounded_Wide_Wide_String;
330 Count : Natural;
331 Pad : Wide_Wide_Character := Wide_Wide_Space);
333 function "*"
334 (Left : Natural;
335 Right : Wide_Wide_Character) return Unbounded_Wide_Wide_String;
337 function "*"
338 (Left : Natural;
339 Right : Wide_Wide_String) return Unbounded_Wide_Wide_String;
341 function "*"
342 (Left : Natural;
343 Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String;
345 private
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;
358 Last : Natural := 0;
359 end record;
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;