52 using OptionProcessor = std::function<bool(
const char *)>;
61 const char *description;
62 OptionProcessor processor;
65 const char *binaryName;
70 std::ostream *outStream = &std::cerr;
72 std::map<cstring, const Option *> options;
73 std::vector<cstring> optionOrder;
74 std::vector<const char *> additionalUsage;
75 std::vector<const char *> remainingOptions;
77 bool collectUnknownOptions =
false;
79 void setOutStream(std::ostream *out) { outStream = out; }
80 void registerUsage(
const char *msg) { additionalUsage.push_back(msg); }
81 void registerOption(
const char *option,
84 OptionProcessor processor,
85 const char *description,
88 explicit Options(std::string_view message)
89 : binaryName(nullptr), message(message), compileCommand(
"") {}
90 virtual ~Options() =
default;
107 virtual std::vector<const char *> *
process(
int argc,
char *
const argv[]);
118 virtual std::vector<const char *> *
process_options(
int argc,
char *
const argv[]);
120 [[nodiscard]]
virtual const char *getIncludePath()
const = 0;
121 cstring getCompileCommand() {
return compileCommand; }
122 cstring getBuildDate() {
return buildDate; }
123 cstring getBinaryName() {
return cstring(binaryName); }
124 virtual void usage();