Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / ada / a-strfix.ads
blobbf1a496828de0ea271f1267a085ec276483712a4
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . S T R I N G S . F I X E D --
6 -- --
7 -- S p e c --
8 -- --
9 -- This specification is adapted from the Ada Reference Manual for use with --
10 -- GNAT. In accordance with the copyright of that document, you can freely --
11 -- copy and modify this specification, provided that if you redistribute a --
12 -- modified version, any changes that you have made are clearly indicated. --
13 -- --
14 ------------------------------------------------------------------------------
17 with Ada.Strings.Maps;
19 package Ada.Strings.Fixed is
20 pragma Preelaborate (Fixed);
22 --------------------------------------------------------------
23 -- Copy Procedure for Strings of Possibly Different Lengths --
24 --------------------------------------------------------------
26 procedure Move
27 (Source : String;
28 Target : out String;
29 Drop : Truncation := Error;
30 Justify : Alignment := Left;
31 Pad : Character := Space);
33 ------------------------
34 -- Search Subprograms --
35 ------------------------
37 function Index
38 (Source : String;
39 Pattern : String;
40 Going : Direction := Forward;
41 Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
43 function Index
44 (Source : String;
45 Pattern : String;
46 Going : Direction := Forward;
47 Mapping : Maps.Character_Mapping_Function) return Natural;
49 function Index
50 (Source : String;
51 Set : Maps.Character_Set;
52 Test : Membership := Inside;
53 Going : Direction := Forward) return Natural;
55 function Index
56 (Source : String;
57 Pattern : String;
58 From : Positive;
59 Going : Direction := Forward;
60 Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
61 pragma Ada_05 (Index);
63 function Index
64 (Source : String;
65 Pattern : String;
66 From : Positive;
67 Going : Direction := Forward;
68 Mapping : Maps.Character_Mapping_Function) return Natural;
69 pragma Ada_05 (Index);
71 function Index
72 (Source : String;
73 Set : Maps.Character_Set;
74 From : Positive;
75 Test : Membership := Inside;
76 Going : Direction := Forward) return Natural;
77 pragma Ada_05 (Index);
79 function Index_Non_Blank
80 (Source : String;
81 Going : Direction := Forward) return Natural;
83 function Index_Non_Blank
84 (Source : String;
85 From : Positive;
86 Going : Direction := Forward) return Natural;
87 pragma Ada_05 (Index_Non_Blank);
89 function Count
90 (Source : String;
91 Pattern : String;
92 Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
94 function Count
95 (Source : String;
96 Pattern : String;
97 Mapping : Maps.Character_Mapping_Function) return Natural;
99 function Count
100 (Source : String;
101 Set : Maps.Character_Set) return Natural;
103 procedure Find_Token
104 (Source : String;
105 Set : Maps.Character_Set;
106 Test : Membership;
107 First : out Positive;
108 Last : out Natural);
110 ------------------------------------
111 -- String Translation Subprograms --
112 ------------------------------------
114 function Translate
115 (Source : String;
116 Mapping : Maps.Character_Mapping) return String;
118 procedure Translate
119 (Source : in out String;
120 Mapping : Maps.Character_Mapping);
122 function Translate
123 (Source : String;
124 Mapping : Maps.Character_Mapping_Function) return String;
126 procedure Translate
127 (Source : in out String;
128 Mapping : Maps.Character_Mapping_Function);
130 ---------------------------------------
131 -- String Transformation Subprograms --
132 ---------------------------------------
134 function Replace_Slice
135 (Source : String;
136 Low : Positive;
137 High : Natural;
138 By : String) return String;
140 procedure Replace_Slice
141 (Source : in out String;
142 Low : Positive;
143 High : Natural;
144 By : String;
145 Drop : Truncation := Error;
146 Justify : Alignment := Left;
147 Pad : Character := Space);
149 function Insert
150 (Source : String;
151 Before : Positive;
152 New_Item : String) return String;
154 procedure Insert
155 (Source : in out String;
156 Before : Positive;
157 New_Item : String;
158 Drop : Truncation := Error);
160 function Overwrite
161 (Source : String;
162 Position : Positive;
163 New_Item : String) return String;
165 procedure Overwrite
166 (Source : in out String;
167 Position : Positive;
168 New_Item : String;
169 Drop : Truncation := Right);
171 function Delete
172 (Source : String;
173 From : Positive;
174 Through : Natural) return String;
176 procedure Delete
177 (Source : in out String;
178 From : Positive;
179 Through : Natural;
180 Justify : Alignment := Left;
181 Pad : Character := Space);
183 ---------------------------------
184 -- String Selector Subprograms --
185 ---------------------------------
187 function Trim
188 (Source : String;
189 Side : Trim_End) return String;
191 procedure Trim
192 (Source : in out String;
193 Side : Trim_End;
194 Justify : Alignment := Left;
195 Pad : Character := Space);
197 function Trim
198 (Source : String;
199 Left : Maps.Character_Set;
200 Right : Maps.Character_Set) return String;
202 procedure Trim
203 (Source : in out String;
204 Left : Maps.Character_Set;
205 Right : Maps.Character_Set;
206 Justify : Alignment := Strings.Left;
207 Pad : Character := Space);
209 function Head
210 (Source : String;
211 Count : Natural;
212 Pad : Character := Space) return String;
214 procedure Head
215 (Source : in out String;
216 Count : Natural;
217 Justify : Alignment := Left;
218 Pad : Character := Space);
220 function Tail
221 (Source : String;
222 Count : Natural;
223 Pad : Character := Space) return String;
225 procedure Tail
226 (Source : in out String;
227 Count : Natural;
228 Justify : Alignment := Left;
229 Pad : Character := Space);
231 ----------------------------------
232 -- String Constructor Functions --
233 ----------------------------------
235 function "*"
236 (Left : Natural;
237 Right : Character) return String;
239 function "*"
240 (Left : Natural;
241 Right : String) return String;
243 end Ada.Strings.Fixed;