261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
(Config : Configuration;
Id : Option_Id;
Separator : String := ", ";
Name_Prefix : String := "--")
return String
is
Long_Name_Count : constant Natural := Get_Long_Name_Count (Config, Id);
Space_Per_Name : constant Positive
:= Name_Prefix'Length + 1 + Separator'Length;
Result : String (1 .. Long_Name_Count * Space_Per_Name);
begin
if Long_Name_Count = 0 then
return "";
end if;
for J in 1 .. Long_Name_Count loop
declare
First : constant Positive
:= Result'First + (J - 1) * Space_Per_Name;
Name : constant String := Get_Long_Name (Config, Id, J);
begin
Result (First .. First + Name_Prefix'Length - 1) := Name_Prefix;
Result (First + Name_Prefix'Length ..
First + Name_Prefix'Length + Name'Length - 1)
:= Name;
Result (First + Name_Prefix'Length + Name'Length ..
First + Space_Per_Name - 1)
:= Separator;
end;
end loop;
return Result (1 .. Long_Name_Count * Space_Per_Name - Separator'Length);
end Format_Long_Names;
function Format_Names
(Config : Configuration;
Id : Option_Id;
Separator : String := ", ";
|
>
|
<
<
>
>
>
>
|
|
>
|
|
|
|
>
>
>
|
|
|
|
|
|
>
>
>
>
|
|
|
|
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
(Config : Configuration;
Id : Option_Id;
Separator : String := ", ";
Name_Prefix : String := "--")
return String
is
Long_Name_Count : constant Natural := Get_Long_Name_Count (Config, Id);
Result_Length : Natural;
Position : Positive;
begin
if Long_Name_Count = 0 then
return "";
end if;
Result_Length := Long_Name_Count * Name_Prefix'Length
+ (Long_Name_Count - 1) * Separator'Length;
for J in 1 .. Long_Name_Count loop
Result_Length := Result_Length + Get_Long_Name (Config, Id, J)'Length;
end loop;
return Result : String (1 .. Result_Length) do
Position := Result'First;
for J in 1 .. Long_Name_Count loop
if J > 1 then
Result (Position .. Position + Separator'Length - 1)
:= Separator;
Position := Position + Separator'Length;
end if;
Result (Position .. Position + Name_Prefix'Length - 1)
:= Name_Prefix;
Position := Position + Name_Prefix'Length;
declare
Name : constant String := Get_Long_Name (Config, Id, J);
begin
Result (Position .. Position + Name'Length - 1) := Name;
Position := Position + Name'Length;
end;
end loop;
end return;
end Format_Long_Names;
function Format_Names
(Config : Configuration;
Id : Option_Id;
Separator : String := ", ";
|