172 Flags(std::string fName, std::string fDescription);
185 std::string fDescription);
201 std::string fDescription);
212 std::string fDescription);
223 unsigned int defaultValue,
224 std::string fDescription);
235 std::string fDescription);
245 std::string defaultValue,
246 std::string fDescription);
256 const char *defaultValue,
257 std::string fDescription);
284 void Usage(std::ostream &os,
int exitCode);
291 std::vector<std::string>
Args();
299 std::string
Arg(
size_t index);
307 bool GetBool(std::string fName,
bool &flagValue);
331 bool GetString(std::string fName, std::string &flagValue);
339 bool GetSizeT(std::string fName, std::size_t &flagValue);
342 ParseStatus parseArg(
int argc,
char **argv,
int &index);
346 std::string description;
347 std::vector<std::string> args;
348 std::map<std::string, Flag *> flags;
Basic facility for processing command line flags.
Definition Flags.h:133
bool Register(std::string fName, FlagType fType, std::string fDescription)
std::string Arg(size_t index)
void Usage(std::ostream &os, int exitCode)
Print a usage message to the output stream.
bool Register(std::string fName, const char *defaultValue, std::string fDescription)
bool GetString(std::string fName, std::string &flagValue)
bool GetSizeT(std::string fName, std::size_t &flagValue)
bool Register(std::string fName, int defaultValue, std::string fDescription)
ParseStatus Parse(int argc, char **argv, bool skipFirst=true)
bool Register(std::string fName, bool defaultValue, std::string fDescription)
bool GetBool(std::string fName, bool &flagValue)
bool Register(std::string fName, std::string defaultValue, std::string fDescription)
size_t Size()
Return the number of registered flags.
bool ValueOf(std::string fName, FlagValue &value)
ValueOf returns the value of the flag in the.
bool Register(std::string fName, size_t defaultValue, std::string fDescription)
std::vector< std::string > Args()
Return the arguments as a vector.
ParseStatus
Definition Flags.h:137
@ NotRegistered
The command line flag provided isn't registered.
bool GetInteger(std::string fName, int &flagValue)
bool Register(std::string fName, unsigned int defaultValue, std::string fDescription)
Flags(std::string fName, std::string fDescription)
Flag * Lookup(std::string fName)
bool GetUnsignedInteger(std::string fName, unsigned int &flagValue)
static std::string ParseStatusToString(ParseStatus status)
scsl is the top-level namespace containing all the code in this library.
Definition scsl.h:43
FlagType
Definition Flags.h:38
@ UnsignedInteger
uint32_t
@ Unknown
Unsupported value type.
Flag * NewFlag(std::string fName, FlagType fType, std::string fDescription)
NewFlag is a helper function for constructing a new flag.
Individual command-line flag.
Definition Flags.h:59
std::string Name
The name of the flag.
Definition Flags.h:62
FlagType Type
The type of the value in the flag.
Definition Flags.h:60
FlagValue Value
The flag's value.
Definition Flags.h:64
bool WasSet
The flag was set on the command-line.
Definition Flags.h:61
std::string Description
A description of the flag.
Definition Flags.h:63
FlagValue holds the value of a command line flag.
Definition Flags.h:49
std::size_t size
FlagType::SizeT.
Definition Flags.h:52
std::string * s
FlagType::String.
Definition Flags.h:53
unsigned int u
FlagType::UnsignedInteger.
Definition Flags.h:50
bool b
FlagType::Boolean.
Definition Flags.h:54
int i
FlagType::Integer.
Definition Flags.h:51