diff --git a/include/cppargs.h b/include/cppargs.h index c3c2448..c487dca 100644 --- a/include/cppargs.h +++ b/include/cppargs.h @@ -1,6 +1,5 @@ #pragma once -#include "cppargs/option.h" -#include "cppargs/parser.h" - -#include "cppargs/option.inl" +#include +#include +#include diff --git a/include/cppargs/group.h b/include/cppargs/group.h new file mode 100644 index 0000000..7d34be5 --- /dev/null +++ b/include/cppargs/group.h @@ -0,0 +1,9 @@ +#pragma once + +#include +#include +#include + +#include +#include +#include diff --git a/include/cppargs/group/group.h b/include/cppargs/group/group.h new file mode 100644 index 0000000..aecb45b --- /dev/null +++ b/include/cppargs/group/group.h @@ -0,0 +1,68 @@ +#pragma once + +#include +#include +#include + +namespace cppargs +{ + + /** + * @brief Struct to collect group meta data. + */ + struct group_meta + { + const std::string name { "" }; //!< Name of the group. + const std::string description { "" }; //!< Description of the group. + }; + + /** + * @brief Struct to manage options and subgroups. + */ + struct group + { + public: + using option_type = option; + using option_ptr_type = std::unique_ptr; + using option_vector_type = std::vector; + + using group_type = group; + using group_ptr_type = std::unique_ptr; + using group_vector_type = std::vector; + + 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 + inline group( + const group_meta& p_meta, + T_args&&... p_args); + + /** + * @brief Move constructor. + */ + inline group(group&&) = default; + + /** + * @brief Destructor. + */ + virtual ~group() = default; + }; + +} diff --git a/include/cppargs/group/group.inl b/include/cppargs/group/group.inl new file mode 100644 index 0000000..bb145aa --- /dev/null +++ b/include/cppargs/group/group.inl @@ -0,0 +1,58 @@ +#pragma once + +#include + +#include "group.h" + +namespace cppargs +{ + + template + struct group_init; + + template + struct group_init< + std::unique_ptr, + utl::mp::enable_if>> + { + using option_ptr_type = std::unique_ptr