|
- #pragma once
-
- #include <list>
- #include <vector>
-
- #include <cpputils/misc/type_helper.h>
- #include <cppargs/misc/misc.h>
-
- namespace cppargs
- {
-
- inline std::string enwrap_type(const std::string& type, bool optional)
- {
- auto opn = optional ? "(" : "<";
- auto cls = optional ? ")" : ">";
- return std::string(opn) + type + cls;
- }
-
- template<>
- struct argument_props<std::string, void>
- {
- static std::string type(bool optional = false)
- { return enwrap_type("string", false); }
- };
-
- template<typename T_value>
- struct argument_props<T_value, utl::mp::enable_if_c<!std::is_class<T_value>::value>>
- {
- static std::string type(bool optional = false)
- { return enwrap_type(utl::type_helper<T_value>::name(), false); }
- };
-
- template<typename T_value>
- struct argument_props<std::list<T_value>, void>
- {
- static std::string type(bool optional = false)
- {
- return
- argument_props<T_value>::type(false) + ' ' +
- argument_props<T_value>::type(true) + ' ' +
- enwrap_type("...", true);
- }
- };
-
- template<typename T_value>
- struct argument_props<std::vector<T_value>, void>
- {
- static std::string type(bool optional = false)
- {
- return
- argument_props<T_value>::type(false) + ' ' +
- argument_props<T_value>::type(true) + ' ' +
- enwrap_type("...", true);
- }
- };
-
- }
|