2015-09-28 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / ada / a-strfix.ads
blob56db8bc9458bc5305e0a497d0eb84c19900bcadf
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 From : Positive;
106 Test : Membership;
107 First : out Positive;
108 Last : out Natural);
109 pragma Ada_2012 (Find_Token);
111 procedure Find_Token
112 (Source : String;
113 Set : Maps.Character_Set;
114 Test : Membership;
115 First : out Positive;
116 Last : out Natural);
118 ------------------------------------
119 -- String Translation Subprograms --
120 ------------------------------------
122 function Translate
123 (Source : String;
124 Mapping : Maps.Character_Mapping) return String;
126 procedure Translate
127 (Source : in out String;
128 Mapping : Maps.Character_Mapping);
130 function Translate
131 (Source : String;
132 Mapping : Maps.Character_Mapping_Function) return String;
134 procedure Translate
135 (Source : in out String;
136 Mapping : Maps.Character_Mapping_Function);
138 ---------------------------------------
139 -- String Transformation Subprograms --
140 ---------------------------------------
142 function Replace_Slice
143 (Source : String;
144 Low : Positive;
145 High : Natural;
146 By : String) return String;
148 procedure Replace_Slice
149 (Source : in out String;
150 Low : Positive;
151 High : Natural;
152 By : String;
153 Drop : Truncation := Error;
154 Justify : Alignment := Left;
155 Pad : Character := Space);
157 function Insert
158 (Source : String;
159 Before : Positive;
160 New_Item : String) return String;
162 procedure Insert
163 (Source : in out String;
164 Before : Positive;
165 New_Item : String;
166 Drop : Truncation := Error);
168 function Overwrite
169 (Source : String;
170 Position : Positive;
171 New_Item : String) return String;
173 procedure Overwrite
174 (Source : in out String;
175 Position : Positive;
176 New_Item : String;
177 Drop : Truncation := Right);
179 function Delete
180 (Source : String;
181 From : Positive;
182 Through : Natural) return String;
184 procedure Delete
185 (Source : in out String;
186 From : Positive;
187 Through : Natural;
188 Justify : Alignment := Left;
189 Pad : Character := Space);
191 ---------------------------------
192 -- String Selector Subprograms --
193 ---------------------------------
195 function Trim
196 (Source : String;
197 Side : Trim_End) return String;
199 procedure Trim
200 (Source : in out String;
201 Side : Trim_End;
202 Justify : Alignment := Left;
203 Pad : Character := Space);
205 function Trim
206 (Source : String;
207 Left : Maps.Character_Set;
208 Right : Maps.Character_Set) return String;
210 procedure Trim
211 (Source : in out String;
212 Left : Maps.Character_Set;
213 Right : Maps.Character_Set;
214 Justify : Alignment := Strings.Left;
215 Pad : Character := Space);
217 function Head
218 (Source : String;
219 Count : Natural;
220 Pad : Character := Space) return String;
222 procedure Head
223 (Source : in out String;
224 Count : Natural;
225 Justify : Alignment := Left;
226 Pad : Character := Space);
228 function Tail
229 (Source : String;
230 Count : Natural;
231 Pad : Character := Space) return String;
233 procedure Tail
234 (Source : in out String;
235 Count : Natural;
236 Justify : Alignment := Left;
237 Pad : Character := Space);
239 ----------------------------------
240 -- String Constructor Functions --
241 ----------------------------------
243 function "*"
244 (Left : Natural;
245 Right : Character) return String;
247 function "*"
248 (Left : Natural;
249 Right : String) return String;
251 end Ada.Strings.Fixed;