51 typedef std::function<bool(
const char *optarg)> OptionProcessor;
57 const char *description;
58 OptionProcessor processor;
61 const char *binaryName;
66 std::ostream *outStream = &std::cerr;
68 std::map<cstring, const Option *> options;
69 std::vector<cstring> optionOrder;
70 std::vector<const char *> additionalUsage;
71 std::vector<const char *> remainingOptions;
73 bool collectUnknownOptions =
false;
75 void setOutStream(std::ostream *out) { outStream = out; }
76 void registerUsage(
const char *msg) { additionalUsage.push_back(msg); }
77 void registerOption(
const char *option,
80 OptionProcessor processor,
81 const char *description,
84 explicit Options(
cstring message) : binaryName(nullptr), message(message), compileCommand(
"") {}
95 virtual std::vector<const char *> *
process(
int argc,
char *
const argv[]);
97 virtual const char *getIncludePath() = 0;
98 cstring getCompileCommand() {
return compileCommand; }
99 cstring getBuildDate() {
return buildDate; }
101 virtual void usage();