summaryrefslogtreecommitdiff
path: root/src/candidates.ads
blob: 4e3caa67161635d57698753427261297d714ffb4 (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


private with Ada.Strings.Unbounded;


package Candidates is


    type State_Name is (ACT, NT, TAS, SA, WA, VIC, QLD, NSW);


    type Candidate is private;


    --  this is restricted to 255 values for memory conservation reasons
    type CandidateID is new Positive range 1 .. 255;


    subtype Extended_CandidateID is CandidateID'Base
        range CandidateID'First - 1 .. CandidateID'Last;


    No_Candidate : constant Extended_CandidateID := Extended_CandidateID'First;


    function To_String
           (Input_Candidate : in Candidate;
            Delimiter       : in Character := ',')
        return String;


    function Candidate_Header
           (Delimiter : in Character := ',')
        return String;


    function Name_And_Party
           (Input_Candidate : in Candidate)
        return String;


private


    package SU renames Ada.Strings.Unbounded;


    type Candidate is record
        First_Name : SU.Unbounded_String;
        Last_Name  : SU.Unbounded_String;
        Group      : SU.Unbounded_String;
        Group_Rank : SU.Unbounded_String;
        Party      : SU.Unbounded_String;
    end record;


end Candidates;