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