2#ifndef _LOGIT_ARGUMENT_UTILS_HPP_INCLUDED
3#define _LOGIT_ARGUMENT_UTILS_HPP_INCLUDED
15 inline std::vector<VariableValue>
args_to_array(std::vector<std::string>::const_iterator name_iter) {
26 template <
typename T,
typename... Ts>
27 std::vector<VariableValue>
args_to_array(std::vector<std::string>::const_iterator name_iter,
const T& first_arg,
const Ts&... args) {
29 std::vector<VariableValue> result;
34 result.insert(result.end(), tail_result.begin(), tail_result.end());
38 using crev_it_t = std::string::const_reverse_iterator;
45 if (*left_it !=
'>' || left_it == right_it)
return false;
47 while (left_it != right_it && (
53 || *left_it ==
'\v')) {
56 return *left_it ==
':' && (left_it != right_it) && *(left_it-1) ==
':';
63 auto result = std::vector<std::string>{};
64 if (all_names.empty())
return result;
66 auto right_cut = all_names.crbegin();
67 auto left_cut = all_names.crbegin();
68 auto const left_end = all_names.crend();
69 auto parenthesis_count =
int{0};
70 auto angle_bracket_count =
int{0};
76 if (left_cut != left_end && (left_cut+1) != left_end) {
78 if (*left_cut ==
'"' && *(left_cut+1) !=
'\\') {
82 (left_cut+1) == left_end
83 || (*left_cut ==
'"' && *(left_cut+1) !=
'\\')
89 if (*left_cut ==
'\'' && *(left_cut+1) !=
'\\') {
93 (left_cut+1) == left_end
94 || (*left_cut ==
'\'' && *(left_cut+1) !=
'\\')
102 if (left_cut == left_end ||
103 (*left_cut ==
',' && parenthesis_count == 0 && angle_bracket_count == 0)){
108 auto e_it = left_cut - 1;
109 while (*e_it ==
' ') --e_it;
113 while (*right_cut ==
' ') ++right_cut;
115 result.emplace(result.begin(), e_it.base(), right_cut.base());
116 if (left_cut != left_end) {
117 right_cut = left_cut + 1;
122 if (*left_cut ==
')') {
125 if (*left_cut ==
'(') {
131 ++angle_bracket_count;
132 }
else if (*left_cut ==
'<' && angle_bracket_count > 0) {
133 --angle_bracket_count;
136 if (left_cut == left_end) {
The primary namespace for the LogIt++ library.
std::vector< std::string > split_arguments(const std::string &all_names)
Splits a string of argument names into individual names, ignoring nested templates,...
bool is_closing_template(crev_it_t left_it, crev_it_t right_it)
Checks if the '>' character is the closing of a template argument list.
std::string::const_reverse_iterator crev_it_t
std::vector< VariableValue > args_to_array(std::vector< std::string >::const_iterator name_iter)
Base case of recursion for argument conversion — when there are no more arguments.
Structure for storing values of various types, including enumerations.