45 std::vector<std::string> _cmdline, int32_t _count,
46 int32_t _max_count, std::vector<std::string> _choices)
48, m_max_count(_max_count)
49, m_name(
std::move(_name))
50, m_env_name(
std::move(_env_name))
51, m_description(
std::move(_descript))
52, m_cmdline(
std::move(_cmdline))
53, m_choices(
std::move(_choices))
60 auto _as_str = [&](
auto _val) {
61 std::stringstream _ss;
66 _ss << std::setprecision(_p);
67 _ss << std::boolalpha << _val;
74 std::stringstream _ss;
75 for(
size_t i = 0; i < _val.size(); ++i)
76 _ss <<
", " << _as_str(_val.at(i));
77 return _ss.str().substr(2);
80 _data[
"name"] = _as_str(
m_name);
81 _data[
"count"] = _as_str(
m_count);
85 _data[
"command_line"] = _arr_as_str(
m_cmdline);
86 _data[
"choices"] = _arr_as_str(
m_choices);
100 auto _cmd_line_exact = [&](
const std::string& itr) {
102 if(itr.length() == 2)
104 auto _with_dash = (itr == inp);
105 auto _pos = itr.find_first_not_of(
'-');
106 if(_with_dash || _pos == std::string::npos)
108 return (itr.substr(_pos) == inp);
115 const auto cre = std::regex_constants::icase;
116 const std::regex re(inp, cre);
121 auto _cmd_line_regex = [&](
const std::string& itr) {
123 if(itr.length() == 2)
125 return std::regex_search(itr, re);
TIMEMORY_SETTINGS_LINKAGE(vsettings::display_map_t) vsettings
tim::mpl::apply< std::string > string
#define TIMEMORY_SETTINGS_INLINE
virtual display_map_t get_display(std::ios::fmtflags fmt={}, int _w=-1, int _p=-1)
virtual bool matches(const std::string &, bool exact=true) const
std::vector< std::string > m_choices
vsettings(std::string _name="", std::string _env_name="", std::string _descript="", std::vector< std::string > _cmdline={}, int32_t _count=-1, int32_t _max_count=-1, std::vector< std::string > _choices={})
std::map< std::string, std::string > display_map_t
std::string m_description
std::vector< std::string > m_cmdline
virtual std::shared_ptr< vsettings > clone()=0