From d75b25d50f4df655d1e69ff900cfeee823039296 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Wed, 3 Sep 2025 00:49:27 +0200 Subject: Initial commit Only a basic argument parser to start with. --- src/args.hh | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/args.hh (limited to 'src/args.hh') diff --git a/src/args.hh b/src/args.hh new file mode 100644 index 0000000..75c31b1 --- /dev/null +++ b/src/args.hh @@ -0,0 +1,70 @@ +#ifndef ARGS_HH +#define ARGS_HH + +#include +#include +#include +#include +#include +#include + +class Args { + public: + virtual ~Args() = default; + + class Option { + public: + virtual ~Option() = default; + + virtual bool is_set() const = 0; + + protected: + Option() = default; + Option(Option const&) = delete; + Option& operator=(Option const&) = delete; + }; + + class OptionArgument : public Option { + public: + virtual bool has_argument() const = 0; + virtual const std::string& argument() const = 0; + }; + + static std::unique_ptr create(std::string prgname = std::string()); + + virtual std::shared_ptr