Add API calls

This commit is contained in:
Folkert Kevelam 2025-07-13 19:48:22 +02:00
parent cea7bb8db9
commit a0cd38fb82

View File

@ -1,10 +1,10 @@
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package Argument_Parser is package Argument_Parser is
type Option is interface; type Option is interface;
function Parse (I : string) return Option is abstract; function Parse (I : String) return Option is abstract;
type Argument_Parser is tagged private;
procedure Add_Positional ( procedure Add_Positional (
Parser : in out Argument_Parser; Parser : in out Argument_Parser;
@ -15,7 +15,7 @@ package Argument_Parser is
procedure Add_Boolean_Option ( procedure Add_Boolean_Option (
Parser : in out Argument_Parser; Parser : in out Argument_Parser;
Short_String : string; Short_String : string;
Long_String : string) Long_String : string);
procedure Add_Count_Option ( procedure Add_Count_Option (
Parser : in out Argument_Parser; Parser : in out Argument_Parser;
@ -29,6 +29,30 @@ package Argument_Parser is
Short_String : string; Short_String : string;
Long_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 private
type Argument_Parser is tagged null record; type Argument_Parser is tagged null record;