1 -- sarge.ads - Specification file for the Sarge command line argument parser project.
8 -- 2019/04/10, Maya Posch
11 with Ada.Strings.Unbounded;
12 use Ada.Strings.Unbounded;
13 with Ada.Containers.Vectors;
14 with Ada.Containers.Indefinite_Ordered_Maps;
19 type Argument is record
20 arg_short: aliased Unbounded_String;
21 arg_long: aliased Unbounded_String;
22 description: aliased Unbounded_String;
23 hasValue: aliased boolean := False;
24 value: aliased Unbounded_String;
25 parsed: aliased boolean := False;
28 type Argument_Access is access all Argument;
30 procedure setArgument(arg_short: in Unbounded_String; arg_long: in Unbounded_String; desc: in Unbounded_String; hasVal: in boolean);
31 procedure setDescription(desc: in Unbounded_String);
32 procedure setUsage(usage: in Unbounded_String);
33 function parseArguments return boolean;
34 function getFlag(arg_flag: in Unbounded_String; arg_value: out Unbounded_String) return boolean;
35 function exists(arg_flag: in Unbounded_String) return boolean;
36 function getTextArgument(index: in Integer; value: out Unbounded_String) return boolean;
38 function flagCount return integer;
39 function executableName return Unbounded_String;
42 function "+"(S : in String) return Unbounded_String renames Ada.Strings.Unbounded.To_Unbounded_String;
43 package arg_vector is new Vectors(Natural, Argument);
44 args: arg_vector.vector;
45 --package argNames_map is new Indefinite_Ordered_Maps(Unbounded_String, Argument_Access);
46 package argNames_map is new Indefinite_Ordered_Maps(Unbounded_String, Natural);
47 argNames: argNames_map.map;
49 flagCounter: Integer := 0;
50 execName: Unbounded_String;
51 description: Unbounded_String;
52 usageStr: Unbounded_String;
53 package tArgVector is new Vectors(Natural, Unbounded_String);
54 textArguments: tArgVector.vector;