Write string vectors to file

This commit is contained in:
Alejandro R Mosteo
2018-04-29 11:53:40 +02:00
parent 8606fe9b91
commit 17e6fb64c6
2 changed files with 27 additions and 0 deletions
+22
View File
@@ -1,3 +1,4 @@
with Ada.Streams.Stream_IO;
with Ada.Strings.Fixed;
with Ada.Strings.Maps;
@@ -135,4 +136,25 @@ package body Alire.Utils is
end return;
end To_Native;
-----------
-- Write --
-----------
procedure Write (V : String_Vector;
Filename : Platform_Independent_Path;
Separator : String := ASCII.LF & "")
is
use Ada.Streams.Stream_IO;
F : File_Type;
begin
Create (F, Out_File, Filename);
for Line of V loop
String'Write (Stream (F), Line);
String'Write (Stream (F), Separator);
end loop;
Close (F);
end Write;
end Alire.Utils;
+5
View File
@@ -48,6 +48,11 @@ package Alire.Utils with Preelaborate is
function Flatten (V : String_Vector; Separator : String := " ") return String;
-- Concatenate all elements
procedure Write (V : String_Vector;
Filename : Platform_Independent_Path;
Separator : String := ASCII.LF & "");
-- Dump contents to a given file
-----------------
-- XXX_XXX_XXX --
-----------------