Prefer to read without ads? Become a member — from $10/month — and support the work. Already a member? Log in to read ad-free on this device.

A.5 Command Line Parsing

A portable command line parsing library (only about 100 lines of C++) is in chCommandLine.h. It includes the templated function chCommandLineGet(), which passes back a variable of a given type, and chCommandLineGetBool(), which returns whether a given keyword was given in the command line.

template<typename T> T
chCommandLineGet( T *p, const char *keyword, int argc, char *argv[] );

As described in the previous section, a specialization of chCommandLineGet() will pass back an instance of chShmooRange(). In order for this specialization to be compiled, chShmoo.h must be included before chCommandLine.h.