#pragma once #include #include namespace os { class ArgumentParser { public: ArgumentParser() = default; Result add_positional_argument(StringView& out, StringView name, bool required); Result add_positional_argument(StringView& out, StringView name, StringView fallback); Result add_switch_argument(bool& out, char short_flag, StringView long_flag); Result add_value_argument(StringView& out, char short_flag, StringView long_flag, bool value_required); Result add_value_argument(StringView& out, char short_flag, StringView long_flag, StringView fallback); Result> parse(int argc, char* const* argv); private: struct PositionalArgument { StringView* out; StringView name; bool required; StringView fallback; }; struct SwitchArgument { bool* out; char short_flag; StringView long_flag; }; struct ValueArgument { StringView* out; char short_flag; StringView long_flag; bool required; StringView fallback; }; Vector m_positional_args; Vector m_switch_args; Vector m_value_args; }; }