You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- #pragma once
-
- #include <string>
- #include <cppargs/misc/context.h>
-
- namespace cppargs
- {
-
- /**
- * @brief Class to store all meta data for a option.
- */
- struct option_meta
- {
- const std::string long_name { "" }; //!< long name of the option (without the prepending --)
- const char short_name { '\0' }; //!< short option of the option (without the prependding -)
- const std::string description { "" }; //!< description for this option
- const std::string default_value { "" }; //!< default value for this option
- const bool optional { true }; //!< TRUE if this option is optional, FALSE otherwise
- };
-
- /**
- * @brief Option to parse from command line arguments
- */
- struct option
- {
- public:
- const option_meta meta; //!< meta data of the option
-
- protected:
- /**
- * @brief Constructor.
- *
- * @param[in] p_long_name Long name of the option.
- * @param[in] p_short_name Short name of the option.
- */
- inline option(const option_meta& meta);
-
- public:
- /**
- * @brief Destructor.
- */
- virtual ~option() = default;
-
- /**
- * @brief Parse the option using the current context.
- *
- * @param[in|out] c Context to use for parsing.
- */
- virtual void parse(context& c) const = 0;
- };
-
- }
|