private with Ada.Strings.Unbounded; -- This source is licensed under Creative Commons CC0 v1.0. -- -- To read the full text, see license.txt in the main directory of this repository -- or go to https://creativecommons.org/publicdomain/zero/1.0/legalcode.txt -- -- For a human readable summary, go to https://creativecommons.org/publicdomain/zero/1.0/ 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. -- Should fit into a single byte each when Pragma Pack is applied -- to an array of them. 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; -- The lack of getters/setters is intentional, to ensure that election -- code cannot change Candidate data once initally read. -- Returns the Candidate's fields in csv format for logging purposes. function To_String (Input_Candidate : in Candidate; Delimiter : in Character := ',') return String; -- Returns field labels corresponding to the field order -- used in To_String. Used for logging purposes. function Candidate_Header (Delimiter : in Character := ',') return String; -- Used for verbose console messages about a particular Candidate. 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;