Ви не можете вибрати більше 25 тем
Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
|
- #pragma once
-
- #include <memory>
- #include <vector>
- #include <cppargs/options/option.h>
-
- namespace cppargs
- {
-
- /**
- * @brief Struct to collect group meta data.
- */
- struct group_meta
- {
- std::string name { "" }; //!< Name of the group.
- std::string description { "" }; //!< Description of the group.
-
- inline group_meta& set_name (const std::string& value);
- inline group_meta& set_description(const std::string& value);
- };
-
- /**
- * @brief Struct to manage options and subgroups.
- */
- struct group
- {
- public:
- using option_type = option;
- using option_ptr_type = std::unique_ptr<option_type>;
- using option_vector_type = std::vector<option_ptr_type>;
-
- using group_type = group;
- using group_ptr_type = std::unique_ptr<group_type>;
- using group_vector_type = std::vector<group_ptr_type>;
-
- public:
- friend struct parser;
-
- const group_meta meta;
-
- protected:
- option_vector_type _options;
- group_vector_type _groups;
-
- private:
- inline group(const group&) = delete;
-
- public:
- /**
- * @brief Constructor.
- *
- * @param[in] p_meta Meta data of the group.
- * @param[in] p_args Sub groups and options.
- */
- template<typename... T_args>
- inline group(
- const group_meta& p_meta,
- T_args&&... p_args);
-
- /**
- * @brief Move constructor.
- */
- inline group(group&&) = default;
-
- /**
- * @brief Destructor.
- */
- virtual ~group() = default;
-
- /**
- * @brief Get all options assigned to this group.
- */
- inline const option_vector_type& options() const;
-
- /**
- * @brief Get all subgroups assigned to this group.
- */
- inline const group_vector_type& groups() const;
- };
-
- }
|