164 Flags(std::string fName);
170 Flags(std::string fName, std::string fDescription);
183 std::string fDescription);
199 std::string fDescription);
210 std::string fDescription);
221 unsigned int defaultValue,
222 std::string fDescription);
233 std::string fDescription);
243 std::string defaultValue,
244 std::string fDescription);
271 void Usage(std::ostream &os,
int exitCode);
278 std::vector<std::string>
Args();
286 std::string
Arg(
size_t index);
294 bool GetBool(std::string fName,
bool &flagValue);
310 bool GetInteger(std::string fName,
int &flagValue);
318 bool GetString(std::string fName, std::string &flagValue);
326 bool GetSizeT(std::string fName, std::size_t &flagValue);
329 ParseStatus parseArg(
int argc,
char **argv,
int &index);
333 std::string description;
334 std::vector<std::string> args;
335 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:135
bool GetInteger(std::string fName, int &flagValue)
Definition: Flag.cc:400
~Flags()
Definition: Flag.cc:83
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