summaryrefslogtreecommitdiff
path: root/src/csv.ads
blob: ec0c0965460bd9e74c9a1cf7c9f43398a2ca59e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59


with

    Ada.Containers.Vectors,
    Ada.Strings.Unbounded,
    Ada.Text_IO,
    Datatypes;


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);


    procedure Put_Header
           (File_Handle : in Ada.Text_IO.File_Type;
            Titles      : in Datatypes.Field_ID_Vector);


    procedure Put_Row
           (File_Handle : in Ada.Text_IO.File_Type;
            Cells       : in Datatypes.Field_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;