text
stringlengths
0
234
Etat.Menu := Menu_Registre_Consultation_Personne;
end if;
end Afficher_Menu_Registre_Consultation_Selection;
-- Affiche les résultats de la recherche.
procedure Afficher_Resultats (Etat : in out T_Etat; Recherche : in String)
is
Nombre_Resultats : Integer := 0;
procedure Tester_Personne (Cle : in Integer; Personne : in T_Personne) is
begin
if Sb.Index (Personne.Nom_Usuel, Recherche) > 0
or else Sb.Index (Personne.Nom_Complet, Recherche) > 0
then
Nombre_Resultats := Nombre_Resultats + 1;
Put (" * ");
Put (Personne.Nom_Usuel);
Put (" <");
Put (Cle, 0);
Put (">");
New_Line;
end if;
end Tester_Personne;
procedure Rechercher is new Appliquer_Sur_Registre (Tester_Personne);
begin
Put_Line ("Résultats de la recherche :");
Rechercher (Etat.Arbre);
if Nombre_Resultats = 0 then
Put_Line ("Aucun résultat.");
Etat.Menu := Menu_Registre;
else
Etat.Menu := Menu_Registre_Consultation_Selection;
end if;
New_Line;
end Afficher_Resultats;
-- Affiche le menu qui permet de rechercher dans le registre.
procedure Afficher_Menu_Registre_Consultation_Recherche
(Etat : in out T_Etat)
is
Recherche : Sb.Bounded_String;
begin
Put_Line ("* Recherche dans le registre *");
New_Line;
Put ("Nom a rechercher [Entrée pour retour] : ");
Recherche := Get_Line;
New_Line;
if Sb.Length (Recherche) > 0 then
Afficher_Resultats (Etat, Sb.To_String (Recherche));
else
Etat.Menu := Menu_Registre;
end if;
end Afficher_Menu_Registre_Consultation_Recherche;
-- Affiche le menu des possibilités pour une personne du registre.
procedure Afficher_Menu_Registre_Consultation_Personne
(Etat : in out T_Etat)
is
Personne : T_Personne;
Choix : Integer;
begin
Personne := Lire_Registre (Etat.Arbre, Etat.Cle);
Afficher_Personne (Etat.Cle, Personne);
New_Line;
Put_Line ("Menu : ");
Put_Line ("1. Consulter son arbre généalogique");
Put_Line ("2. Modifier les informations");
Put_Line ("3. Retour");
New_Line;
Choisir (3, Choix);
New_Line;
case Choix is
when 1 =>
Etat.Menu := Menu_Arbre_Consultation;
when 2 =>
Etat.Menu := Menu_Registre_Modification;
when 3 =>
Etat.Menu := Menu_Registre;
when others =>
Etat.Menu := Quitter;
end case;
end Afficher_Menu_Registre_Consultation_Personne;
-- Demande a l'utilisateur toutes les informations pour peupler `Personne`.
procedure Saisir_Personne (Personne : out T_Personne) is
Nom_Complet : Sb.Bounded_String;
Nom_Usuel : Sb.Bounded_String;
Genre : T_Genre;
Date_De_Naissance : T_Date;
Lieu_De_Naissance : Sb.Bounded_String;
Correct : Boolean;
Date_Lue : Integer;
Genre_Lu : Character;
begin
Put ("Nom usuel : ");
Nom_Usuel := Get_Line;
Put ("Nom Complet : ");
Nom_Complet := Get_Line;
Put ("Sexe [F pour féminin, M pour masculin, A pour autre] : ");