From 36b0cbf19bd44c94bbe5aa67730347290f20628c Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Tue, 9 Nov 2021 17:05:44 +1300 Subject: Refactored packages --- src/deckdata-process.adb | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/deckdata-process.adb (limited to 'src/deckdata-process.adb') diff --git a/src/deckdata-process.adb b/src/deckdata-process.adb new file mode 100644 index 0000000..e7756a1 --- /dev/null +++ b/src/deckdata-process.adb @@ -0,0 +1,54 @@ + + +-- This source is licensed under the Sunset License v1.0 + + +with + + Ada.Characters.Handling; + + +package body Deckdata.Process is + + + package Charhand renames Ada.Characters.Handling; + + + procedure Strip_Formatting + (Notes : in out Note_Vector) + is + procedure Strip + (Text : in out Note; + Item : in String) + is + Position : Natural; + begin + for F of Text.Fields loop + loop + Position := SU.Index + (Source => SU.Unbounded_String (F), + Pattern => Item, + Going => Ada.Strings.Forward, + Mapping => Charhand.To_Lower'Access); + exit when Position = 0; + SU.Delete (SU.Unbounded_String (F), Position, Position + Item'Length - 1); + end loop; + end loop; + end Strip; + + Formatting : array (Positive range <>) of SU.Unbounded_String := + (+"", +"", +"", +"", +"", +"", +"", +"", + +"", +"", +"", +"", +"", +"", + +"", +"", +"", +"", +"", +""); + begin + for N of Notes loop + for S of Formatting loop + Strip (N, -S); + end loop; + end loop; + end Strip_Formatting; + + +end Deckdata.Process; + + -- cgit