diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2021-11-06 00:53:55 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2021-11-06 00:53:55 +1300 |
commit | 866565c42134dbe8828c9a9b8140a90598df4069 (patch) | |
tree | 6c6b5f14284b333fa5e82bd94b15b5b894634785 /src/datatypes.ads | |
parent | a7c1795a6162181a39366e99a60ee65a342a66f8 (diff) |
Factored out deck datatypes into their own package
Diffstat (limited to 'src/datatypes.ads')
-rw-r--r-- | src/datatypes.ads | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/datatypes.ads b/src/datatypes.ads new file mode 100644 index 0000000..164e7c9 --- /dev/null +++ b/src/datatypes.ads @@ -0,0 +1,87 @@ + + +with + + Ada.Containers.Vectors, + Ada.Containers.Ordered_Maps, + Ada.Strings.Unbounded; + + +package Datatypes 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_ID is new SU.Unbounded_String; + type Media_Name is new SU.Unbounded_String; + + package Media_Maps is new Ada.Containers.Ordered_Maps + (Key_Type => Media_ID, + Element_Type => Media_Name); + + subtype Media_Map is Media_Maps.Map; + + +end Datatypes; + + |