43 using OptionProcessor = std::function<bool(
const char *)>;
52 const char *description;
53 OptionProcessor processor;
56 const char *binaryName;
61 std::ostream *outStream = &std::cerr;
63 std::map<cstring, const Option *> options;
64 std::vector<cstring> optionOrder;
65 std::vector<const char *> additionalUsage;
66 std::vector<const char *> remainingOptions;
68 bool collectUnknownOptions =
false;
70 void setOutStream(std::ostream *out) { outStream = out; }
71 void registerUsage(
const char *msg) { additionalUsage.push_back(msg); }
72 void registerOption(
const char *option,
75 OptionProcessor processor,
76 const char *description,
79 explicit Options(std::string_view message)
80 : binaryName(nullptr), message(message), compileCommand(
"") {}
81 virtual ~Options() =
default;
98 virtual std::vector<const char *> *
process(
int argc,
char *
const argv[]);
109 virtual std::vector<const char *> *
process_options(
int argc,
char *
const argv[]);
111 [[nodiscard]]
virtual const char *getIncludePath()
const = 0;
112 cstring getCompileCommand() {
return compileCommand; }
113 cstring getBuildDate() {
return buildDate; }
114 cstring getBinaryName() {
return cstring(binaryName); }
115 virtual void usage();