PR testsuite/44195
[official-gcc.git] / gcc / ada / a-strfix.ads
blob875219a1c9bdfcb62dff480c727cebc131cac4ee
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 derived 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 ------------------------------------------------------------------------------
16 with Ada.Strings.Maps;
18 package Ada.Strings.Fixed is
19 pragma Preelaborate;
21 --------------------------------------------------------------
22 -- Copy Procedure for Strings of Possibly Different Lengths --
23 --------------------------------------------------------------
25 procedure Move
26 (Source : String;
27 Target : out String;
28 Drop : Truncation := Error;
29 Justify : Alignment := Left;
30 Pad : Character := Space);
32 ------------------------
33 -- Search Subprograms --
34 ------------------------
36 function Index
37 (Source : String;
38 Pattern : String;
39 Going : Direction := Forward;
40 Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
42 function Index
43 (Source : String;
44 Pattern : String;
45 Going : Direction := Forward;
46 Mapping : Maps.Character_Mapping_Function) return Natural;
48 function Index
49 (Source : String;
50 Set : Maps.Character_Set;
51 Test : Membership := Inside;
52 Going : Direction := Forward) return Natural;
54 function Index
55 (Source : String;
56 Pattern : String;
57 From : Positive;
58 Going : Direction := Forward;
59 Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
60 pragma Ada_05 (Index);
62 function Index
63 (Source : String;
64 Pattern : String;
65 From : Positive;
66 Going : Direction := Forward;
67 Mapping : Maps.Character_Mapping_Function) return Natural;
68 pragma Ada_05 (Index);
70 function Index
71 (Source : String;
72 Set : Maps.Character_Set;
73 From : Positive;
74 Test : Membership := Inside;
75 Going : Direction := Forward) return Natural;
76 pragma Ada_05 (Index);
78 function Index_Non_Blank
79 (Source : String;
80 Going : Direction := Forward) return Natural;
82 function Index_Non_Blank
83 (Source : String;
84 From : Positive;
85 Going : Direction := Forward) return Natural;
86 pragma Ada_05 (Index_Non_Blank);
88 function Count
89 (Source : String;
90 Pattern : String;
91 Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
93 function Count
94 (Source : String;
95 Pattern : String;
96 Mapping : Maps.Character_Mapping_Function) return Natural;
98 function Count
99 (Source : String;
100 Set : Maps.Character_Set) return Natural;
102 procedure Find_Token
103 (Source : String;
104 Set : Maps.Character_Set;
105 Test : Membership;
106 First : out Positive;
107 Last : out Natural);
109 ------------------------------------
110 -- String Translation Subprograms --
111 ------------------------------------
113 function Translate
114 (Source : String;
115 Mapping : Maps.Character_Mapping) return String;
117 procedure Translate
118 (Source : in out String;
119 Mapping : Maps.Character_Mapping);
121 function Translate
122 (Source : String;
123 Mapping : Maps.Character_Mapping_Function) return String;
125 procedure Translate
126 (Source : in out String;
127 Mapping : Maps.Character_Mapping_Function);
129 ---------------------------------------
130 -- String Transformation Subprograms --
131 ---------------------------------------
133 function Replace_Slice
134 (Source : String;
135 Low : Positive;
136 High : Natural;
137 By : String) return String;
139 procedure Replace_Slice
140 (Source : in out String;
141 Low : Positive;
142 High : Natural;
143 By : String;
144 Drop : Truncation := Error;
145 Justify : Alignment := Left;
146 Pad : Character := Space);
148 function Insert
149 (Source : String;
150 Before : Positive;
151 New_Item : String) return String;
153 procedure Insert
154 (Source : in out String;
155 Before : Positive;
156 New_Item : String;
157 Drop : Truncation := Error);
159 function Overwrite
160 (Source : String;
161 Position : Positive;
162 New_Item : String) return String;
164 procedure Overwrite
165 (Source : in out String;
166 Position : Positive;
167 New_Item : String;
168 Drop : Truncation := Right);
170 function Delete
171 (Source : String;
172 From : Positive;
173 Through : Natural) return String;
175 procedure Delete
176 (Source : in out String;
177 From : Positive;
178 Through : Natural;
179 Justify : Alignment := Left;
180 Pad : Character := Space);
182 ---------------------------------
183 -- String Selector Subprograms --
184 ---------------------------------
186 function Trim
187 (Source : String;
188 Side : Trim_End) return String;
190 procedure Trim
191 (Source : in out String;
192 Side : Trim_End;
193 Justify : Alignment := Left;
194 Pad : Character := Space);
196 function Trim
197 (Source : String;
198 Left : Maps.Character_Set;
199 Right : Maps.Character_Set) return String;
201 procedure Trim
202 (Source : in out String;
203 Left : Maps.Character_Set;
204 Right : Maps.Character_Set;
205 Justify : Alignment := Strings.Left;
206 Pad : Character := Space);
208 function Head
209 (Source : String;
210 Count : Natural;
211 Pad : Character := Space) return String;
213 procedure Head
214 (Source : in out String;
215 Count : Natural;
216 Justify : Alignment := Left;
217 Pad : Character := Space);
219 function Tail
220 (Source : String;
221 Count : Natural;
222 Pad : Character := Space) return String;
224 procedure Tail
225 (Source : in out String;
226 Count : Natural;
227 Justify : Alignment := Left;
228 Pad : Character := Space);
230 ----------------------------------
231 -- String Constructor Functions --
232 ----------------------------------
234 function "*"
235 (Left : Natural;
236 Right : Character) return String;
238 function "*"
239 (Left : Natural;
240 Right : String) return String;
242 end Ada.Strings.Fixed;