163 Flags(std::string fName);
169 Flags(std::string fName, std::string fDescription);
182 std::string fDescription);
198 std::string fDescription);
209 std::string fDescription);
220 unsigned int defaultValue,
221 std::string fDescription);
232 std::string fDescription);
242 std::string defaultValue,
243 std::string fDescription);
270 void Usage(std::ostream &os,
int exitCode);
277 std::vector<std::string>
Args();
285 std::string
Arg(
size_t index);
293 bool GetBool(std::string fName,
bool &flagValue);
309 bool GetInteger(std::string fName,
int &flagValue);
317 bool GetString(std::string fName, std::string &flagValue);
325 bool GetSizeT(std::string fName, std::size_t &flagValue);
328 ParseStatus parseArg(
int argc,
char **argv,
int &index);
332 std::string description;
333 std::vector<std::string> args;
334 std::map<std::string, Flag *> flags;
bool Register(std::string fName, FlagType fType, std::string fDescription)
Definition: Flag.cc:95
std::string Arg(size_t index)
Definition: Flag.cc:359
void Usage(std::ostream &os, int exitCode)
Print a usage message to the output stream.
Definition: Flag.cc:296
bool GetString(std::string fName, std::string &flagValue)
Definition: Flag.cc:430
bool GetSizeT(std::string fName, std::size_t &flagValue)
Definition: Flag.cc:420
size_t NumArgs()
Definition: Flag.cc:345
ParseStatus Parse(int argc, char **argv, bool skipFirst=true)
Definition: Flag.cc:258
bool GetBool(std::string fName, bool &flagValue)
Definition: Flag.cc:390
size_t Size()
Return the number of registered flags.
Definition: Flag.cc:172
bool ValueOf(std::string fName, FlagValue &value)
ValueOf returns the value of the flag in the.
Definition: Flag.cc:190
std::vector< std::string > Args()
Return the arguments as a vector.
Definition: Flag.cc:352
Flags(std::string fName)
Definition: Flag.cc:71
ParseStatus
Definition: Flag.h:134
@ NotRegistered
The command line flag provided isn't registered.
bool GetInteger(std::string fName, int &flagValue)
Definition: Flag.cc:400
static std::string ParseStatusToString(ParseStatus status)
Definition: Flag.cc:39
Flag * Lookup(std::string fName)
Definition: Flag.cc:179
bool GetUnsignedInteger(std::string fName, unsigned int &flagValue)
Definition: Flag.cc:410
scsl is the top-level namespace containing all the code in this library.
Definition: scsl.h:43
FlagType
Definition: Flag.h:38
@ UnsignedInteger
uint32_t
@ Unknown
Unsupported value type.
Flag * NewFlag(std::string fName, FlagType fType, std::string fDescription)
Definition: Flag.cc:57
Flag describes an individual command-line flag.
Definition: Flag.h:59
std::string Name
The name of the flag.
Definition: Flag.h:62
FlagType Type
The type of the value in the flag.
Definition: Flag.h:60
FlagValue Value
The flag's value.
Definition: Flag.h:64
bool WasSet
The flag was set on the command-line.
Definition: Flag.h:61
std::string Description
A description of the flag.
Definition: Flag.h:63
FlagValue holds the value of a command line flag.
Definition: Flag.h:49
std::size_t size
FlagType::SizeT.
Definition: Flag.h:52
std::string * s
FlagType::String.
Definition: Flag.h:53
unsigned int u
FlagType::UnsignedInteger.
Definition: Flag.h:50
bool b
FlagType::Boolean.
Definition: Flag.h:54
int i
FlagType::Integer.
Definition: Flag.h:51