OSDN Git Service

2009-04-08 Thomas Quinot <quinot@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-strfix.ads
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 ------------------------------------------------------------------------------
15
16 with Ada.Strings.Maps;
17
18 package Ada.Strings.Fixed is
19    pragma Preelaborate;
20
21    --------------------------------------------------------------
22    -- Copy Procedure for Strings of Possibly Different Lengths --
23    --------------------------------------------------------------
24
25    procedure Move
26      (Source  : String;
27       Target  : out String;
28       Drop    : Truncation := Error;
29       Justify : Alignment  := Left;
30       Pad     : Character  := Space);
31
32    ------------------------
33    -- Search Subprograms --
34    ------------------------
35
36    function Index
37      (Source  : String;
38       Pattern : String;
39       Going   : Direction := Forward;
40       Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
41
42    function Index
43      (Source  : String;
44       Pattern : String;
45       Going   : Direction := Forward;
46       Mapping : Maps.Character_Mapping_Function) return Natural;
47
48    function Index
49      (Source : String;
50       Set    : Maps.Character_Set;
51       Test   : Membership := Inside;
52       Going  : Direction  := Forward) return Natural;
53
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);
61
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);
69
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);
77
78    function Index_Non_Blank
79      (Source : String;
80       Going  : Direction := Forward) return Natural;
81
82    function Index_Non_Blank
83      (Source : String;
84       From   : Positive;
85       Going  : Direction := Forward) return Natural;
86    pragma Ada_05 (Index_Non_Blank);
87
88    function Count
89      (Source  : String;
90       Pattern : String;
91       Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
92
93    function Count
94      (Source  : String;
95       Pattern : String;
96       Mapping : Maps.Character_Mapping_Function) return Natural;
97
98    function Count
99      (Source : String;
100       Set    : Maps.Character_Set) return Natural;
101
102    procedure Find_Token
103      (Source : String;
104       Set    : Maps.Character_Set;
105       Test   : Membership;
106       First  : out Positive;
107       Last   : out Natural);
108
109    ------------------------------------
110    -- String Translation Subprograms --
111    ------------------------------------
112
113    function Translate
114      (Source  : String;
115       Mapping : Maps.Character_Mapping) return String;
116
117    procedure Translate
118      (Source  : in out String;
119       Mapping : Maps.Character_Mapping);
120
121    function Translate
122      (Source  : String;
123       Mapping : Maps.Character_Mapping_Function) return String;
124
125    procedure Translate
126      (Source  : in out String;
127       Mapping : Maps.Character_Mapping_Function);
128
129    ---------------------------------------
130    -- String Transformation Subprograms --
131    ---------------------------------------
132
133    function Replace_Slice
134      (Source : String;
135       Low    : Positive;
136       High   : Natural;
137       By     : String) return String;
138
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);
147
148    function Insert
149      (Source   : String;
150       Before   : Positive;
151       New_Item : String) return String;
152
153    procedure Insert
154      (Source   : in out String;
155       Before   : Positive;
156       New_Item : String;
157       Drop     : Truncation := Error);
158
159    function Overwrite
160      (Source   : String;
161       Position : Positive;
162       New_Item : String) return String;
163
164    procedure Overwrite
165      (Source   : in out String;
166       Position : Positive;
167       New_Item : String;
168       Drop     : Truncation := Right);
169
170    function Delete
171      (Source  : String;
172       From    : Positive;
173       Through : Natural) return String;
174
175    procedure Delete
176      (Source  : in out String;
177       From    : Positive;
178       Through : Natural;
179       Justify : Alignment := Left;
180       Pad     : Character := Space);
181
182    ---------------------------------
183    -- String Selector Subprograms --
184    ---------------------------------
185
186    function Trim
187      (Source : String;
188       Side   : Trim_End) return String;
189
190    procedure Trim
191      (Source  : in out String;
192       Side    : Trim_End;
193       Justify : Alignment := Left;
194       Pad     : Character := Space);
195
196    function Trim
197      (Source : String;
198       Left   : Maps.Character_Set;
199       Right  : Maps.Character_Set) return String;
200
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);
207
208    function Head
209      (Source : String;
210       Count  : Natural;
211       Pad    : Character := Space) return String;
212
213    procedure Head
214      (Source  : in out String;
215       Count   : Natural;
216       Justify : Alignment := Left;
217       Pad     : Character := Space);
218
219    function Tail
220      (Source : String;
221       Count  : Natural;
222       Pad    : Character := Space) return String;
223
224    procedure Tail
225      (Source  : in out String;
226       Count   : Natural;
227       Justify : Alignment := Left;
228       Pad     : Character := Space);
229
230    ----------------------------------
231    -- String Constructor Functions --
232    ----------------------------------
233
234    function "*"
235      (Left  : Natural;
236       Right : Character) return String;
237
238    function "*"
239      (Left  : Natural;
240       Right : String) return String;
241
242 end Ada.Strings.Fixed;