summaryrefslogtreecommitdiff
path: root/src/csv.ads
diff options
context:
space:
mode:
Diffstat (limited to 'src/csv.ads')
-rw-r--r--src/csv.ads64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/csv.ads b/src/csv.ads
new file mode 100644
index 0000000..cc1eef5
--- /dev/null
+++ b/src/csv.ads
@@ -0,0 +1,64 @@
+
+
+with
+
+ Ada.Containers.Vectors,
+ Ada.Strings.Unbounded,
+ Ada.Text_IO;
+
+
+generic
+
+ Separator_Char : Character := ',';
+ Quote_Char : Character := '"';
+ Escape_Char : Character := '\';
+
+package CSV is
+
+
+ procedure Put_Cell
+ (File_Handle : in Ada.Text_IO.File_Type;
+ Data : in String);
+
+ procedure Put_Cell
+ (File_Handle : in Ada.Text_IO.File_Type;
+ Data : in Ada.Strings.Unbounded.Unbounded_String);
+
+
+ generic
+
+ type Vector_Index is range <>;
+ type Vector_Data is private;
+
+ with package Data_Vectors is new Ada.Containers.Vectors (Vector_Index, Vector_Data);
+
+ with function To_Unbounded_String
+ (Data : in Vector_Data)
+ return Ada.Strings.Unbounded.Unbounded_String is <>;
+
+ procedure Put_Row
+ (File_Handle : in Ada.Text_IO.File_Type;
+ Cells : in Data_Vectors.Vector;
+ Quantity : in Positive);
+
+
+private
+
+
+ package SU renames Ada.Strings.Unbounded;
+
+
+ function "+"
+ (S : in String)
+ return SU.Unbounded_String
+ renames SU.To_Unbounded_String;
+
+ function "-"
+ (US : in SU.Unbounded_String)
+ return String
+ renames SU.To_String;
+
+
+end CSV;
+
+