Argument_Parser/src/argument_parser.ads
Folkert Kevelam a0cd38fb82 Add API calls
2025-07-13 19:48:22 +02:00

61 lines
1.4 KiB
Ada

with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package Argument_Parser is
type Option is interface;
function Parse (I : String) return Option is abstract;
procedure Add_Positional (
Parser : in out Argument_Parser;
Input_Type : Option'Class;
Key : string;
Collect_Further_Inputs : Boolean := False);
procedure Add_Boolean_Option (
Parser : in out Argument_Parser;
Short_String : string;
Long_String : string);
procedure Add_Count_Option (
Parser : in out Argument_Parser;
Short_String : string;
Long_String : string;
Start_Count : Count := 0);
procedure Add_Option (
Parser : in out Argument_Parser;
Input_Type : Option'Class;
Short_String : string;
Long_String : string);
type String_Option is new Option with
record
Value : Unbounded_String;
end record;
overriding
function Parse (I : String) return String_Option;
type Integer_Option is new Option with
record
Value : Integer;
end record;
overriding
function Parse (I : String) return Integer_Option;
type Float_Option is new Option with
record
Value : Float;
end record;
overriding
function Parse (I : String) return Float_Option;
private
type Argument_Parser is tagged null record;
end Argument_Parser;