summaryrefslogtreecommitdiff
path: root/src/csv.ads
blob: d2360c2a4e389b69bc41136090ea97324c59382f (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


with

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

use type

    Ada.Strings.Unbounded.Unbounded_String;


generic
    Delimiter : in Character := ',';
    Quote     : in Character := '"';
    Escape    : in Character := '\';
package CSV is


    package String_Vectors is new Ada.Containers.Vectors
           (Index_Type   => Positive,
            Element_Type => Ada.Strings.Unbounded.Unbounded_String);


    subtype CSV_Record is String_Vectors.Vector;


    function Parse_Line
           (Input : in String)
        return CSV_Record;


    function Unparse_Record
           (Input : in CSV_Record)
        return String;


end CSV;