summaryrefslogtreecommitdiff
path: root/src/deckdata.ads
blob: ae73ef2f14811c4a0f6c10b2ddf7f23c0fdbb8c2 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107


--  This source is licensed under the Sunset License v1.0


with

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


package Deckdata is


    package SU renames Ada.Strings.Unbounded;




    type Field_Ordinal is new Positive;
    type Field_ID is new SU.Unbounded_String;

    package Field_ID_Vectors is new Ada.Containers.Vectors
       (Index_Type   => Field_Ordinal,
        Element_Type => Field_ID);

    subtype Field_ID_Vector is Field_ID_Vectors.Vector;


    type Template is record
        Question : Field_ID_Vectors.Vector;
        Answer   : Field_ID_Vectors.Vector;
    end record;

    package Template_Vectors is new Ada.Containers.Vectors
       (Index_Type   => Positive,
        Element_Type => Template);

    subtype Template_Vector is Template_Vectors.Vector;


    type Model_ID is new SU.Unbounded_String;

    type Model is record
        Fields    : Field_ID_Vectors.Vector;
        Templates : Template_Vectors.Vector;
    end record;

    package Model_Maps is new Ada.Containers.Ordered_Maps
       (Key_Type     => Model_ID,
        Element_Type => Model);

    subtype Model_Map is Model_Maps.Map;


    type Field is new SU.Unbounded_String;

    package Field_Vectors is new Ada.Containers.Vectors
       (Index_Type   => Field_Ordinal,
        Element_Type => Field);

    subtype Field_Vector is Field_Vectors.Vector;


    type Note is record
        Model  : Model_ID;
        Fields : Field_Vectors.Vector;
    end record;

    package Note_Vectors is new Ada.Containers.Vectors
       (Index_Type   => Positive,
        Element_Type => Note);

    subtype Note_Vector is Note_Vectors.Vector;


    type Media_Name is new SU.Unbounded_String;
    type Media_ID is new SU.Unbounded_String;

    package Media_Maps is new Ada.Containers.Ordered_Maps
       (Key_Type     => Media_Name,
        Element_Type => Media_ID);

    type Media_Collection is record
        Filename : SU.Unbounded_String;
        Map      : Media_Maps.Map;
    end record;


private


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