argparse
Module
Overview
Members
-
namespace argparse
test DOCUMENTING THE NAMESPACE
Functions
-
bool checkOption(string name, int argc, char *argv[])
Parses through arguments and checks if an option/flag exists.
- Parameters:
name –
string
to match option withargc –
int
representing the number of argumentsargv – array of
char
arrays, representing string arguments
- Returns:
bool
representing whether the flag exists.
-
string getStringArg(string name, int argc, char *argv[], string usage = "")
Gets the value of an argument option as a
string
Parses through arguments, and returns value of matching name of the format:
<option> <value>
Where <option> is matched to
name
. This functions exits when the option isn’t found, and prints an optional usage message- Parameters:
name –
string
to match option withargc –
int
indicating the number of argumentsargv – array of
char
arrays, representing string argumentsusage –
string
representing an optional usage message, printed upon failure, default=""
- Returns:
string
-
int getIntArg(string name, int argc, char *argv[], string usage = "")
Gets the value of an argument option as an
int
Parses through arguments, and returns value of matching name of the format:
<option> <value>
Where <option> is matched to
name
. This functions exits when the option isn’t found, and prints an optional usage message- Parameters:
name –
string
to match option withargc –
int
indicating the number of argumentsargv – array of
char
arrays, representing string argumentsusage –
string
representing an optional usage message, printed upon failure, default=""
- Returns:
int
-
float getFloatArg(string name, int argc, char *argv[], string usage = "")
Gets the value of an argument option as an
float
Parses through arguments, and returns value of matching name of the format:
<option> <value>
Where <option> is matched to
name
. This functions exits when the option isn’t found, and prints an optional usage message- Parameters:
name –
string
to match option withargc –
int
indicating the number of argumentsargv – array of
char
arrays, representing string argumentsusage –
string
representing an optional usage message, printed upon failure, default=""
- Returns:
float
-
string getStringArgSecure(string name, string defaultValue, int argc, char *argv[])
Gets the value of an argument option as a
string
Parses through arguments, and returns value of matching name of the format:
<option> <value>
Where <option> is matched to
name
.- Parameters:
name –
string
to match option withdefaultValue –
string
representing the default value if the option isn’t foundargc –
int
indicating the number of argumentsargv – array of
char
arrays, representing string arguments
- Returns:
string
; will returndefaultValue
if the option isn’t found
-
int getIntArgSecure(string name, int defaultValue, int argc, char *argv[])
Gets the value of an argument option as a
int
Parses through arguments, and returns value of matching name of the format:
<option> <value>
Where <option> is matched to
name
.- Parameters:
name –
string
to match option withdefaultValue –
int
representing the default value if the option isn’t foundargc –
int
indicating the number of argumentsargv – array of
char
arrays, representing string arguments
- Returns:
int
; will returndefaultValue
if the option isn’t found
-
float getFloatArgSecure(string name, float defaultValue, int argc, char *argv[])
Gets the value of an argument option as a
float
Parses through arguments, and returns value of matching name of the format:
<option> <value>
Where <option> is matched to
name
.- Parameters:
name –
string
to match option withdefaultValue –
float
representing the default value if the option isn’t foundargc –
int
indicating the number of argumentsargv – array of
char
arrays, representing string arguments
- Returns:
float
; will returndefaultValue
if the option isn’t found
-
bool checkOption(string name, int argc, char *argv[])