blob: 2f00207297ad096ca642fcbcfd37815899a062ef (
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
|
with
Ada.Containers.Vectors,
Ada.Containers.Ordered_Maps,
Ada.Strings.Unbounded,
Datatypes;
private with
Ada.Finalization,
SQLite3;
package Deck_IO is
package SU renames Ada.Strings.Unbounded;
use type SU.Unbounded_String;
type Deck_Handle is limited private;
function Matches
(Models : in Datatypes.Model_Map;
Notes : in Datatypes.Note_Vector)
return Boolean;
procedure Read_Media_Collection
(Filename : in String;
Media : out Datatypes.Media_Collection);
procedure Open_Database
(Filename : in String;
Deck : in out Deck_Handle)
with Post => Is_Open (Deck);
function Is_Open
(Deck : in Deck_Handle)
return Boolean;
procedure Close_Database
(Deck : in out Deck_Handle)
with Post => not Is_Open (Deck);
procedure Query_Models
(Deck : in out Deck_Handle;
Models : out Datatypes.Model_Map)
with Pre => Is_Open (Deck);
procedure Query_Notes
(Deck : in out Deck_Handle;
Notes : out Datatypes.Note_Vector)
with Pre => Is_Open (Deck);
procedure Write_CSV
(Directory : in String;
Basename : in String;
Models : in Datatypes.Model_Map;
Notes : in Datatypes.Note_Vector;
Overwrite : in Boolean := False)
with Pre => Matches (Models, Notes);
procedure Write_FMD
(Directory : in String;
Basename : in String;
Models : in Datatypes.Model_Map;
Notes : in Datatypes.Note_Vector;
Media : in Datatypes.Media_Collection;
Overwrite : in Boolean := False)
with Pre => Matches (Models, Notes);
private
type Deck_Handle is new Ada.Finalization.Limited_Controlled with record
SQL_Handle : SQLite3.SQLite3_DB;
Status : SQLite3.Status_Code := SQLite3.SQLITE_OK;
Opened : Boolean := False;
Tempfile : SU.Unbounded_String := SU.To_Unbounded_String ("");
end record;
overriding
procedure Finalize
(This : in out Deck_Handle);
end Deck_IO;
|