/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright 2022, Danny Robson */ #pragma once #include "./fwd.hpp" #include #include namespace cruft::cmdopt2 { class parser { public: int parse (int argc, char const* const* argv); positional& add (positional const&) &; keyword& add (keyword const&) &; void usage (int argc, char const * const* argv, FILE*) const; void usage (int argc, char const * const* argv, std::ostream&) const; private: int parse_named (int argc, char const* const* argv) const; int parse_short (int argc, char const* const* argv) const; int parse_long (int argc, char const* const* argv) const; std::vector m_positional; std::vector m_keyword; }; }