2#ifndef _LOGIT_ARGUMENT_UTILS_HPP_INCLUDED
3#define _LOGIT_ARGUMENT_UTILS_HPP_INCLUDED
16 inline std::vector<VariableValue>
args_to_array(std::vector<std::string>::const_iterator name_iter) {
27 template <
typename T,
typename... Ts>
28 std::vector<VariableValue>
args_to_array(std::vector<std::string>::const_iterator name_iter,
const T& first_arg,
const Ts&... args) {
30 std::vector<VariableValue> result;
35 result.insert(result.end(), tail_result.begin(), tail_result.end());
39 using crev_it_t = std::string::const_reverse_iterator;
46 if (*left_it !=
'>' || left_it == right_it)
return false;
48 while (left_it != right_it && (
54 || *left_it ==
'\v')) {
57 return *left_it ==
':' && (left_it != right_it) && *(left_it-1) ==
':';
64 auto result = std::vector<std::string>{};
65 if (all_names.empty())
return result;
67 auto right_cut = all_names.crbegin();
68 auto left_cut = all_names.crbegin();
69 auto const left_end = all_names.crend();
70 auto parenthesis_count =
int{0};
71 auto angle_bracket_count =
int{0};
77 if (left_cut != left_end && (left_cut+1) != left_end) {
79 if (*left_cut ==
'"' && *(left_cut+1) !=
'\\') {
83 (left_cut+1) == left_end
84 || (*left_cut ==
'"' && *(left_cut+1) !=
'\\')
90 if (*left_cut ==
'\'' && *(left_cut+1) !=
'\\') {
94 (left_cut+1) == left_end
95 || (*left_cut ==
'\'' && *(left_cut+1) !=
'\\')
103 if (left_cut == left_end ||
104 (*left_cut ==
',' && parenthesis_count == 0 && angle_bracket_count == 0)){
109 auto e_it = left_cut - 1;
110 while (*e_it ==
' ') --e_it;
114 while (*right_cut ==
' ') ++right_cut;
116 result.emplace(result.begin(), e_it.base(), right_cut.base());
117 if (left_cut != left_end) {
118 right_cut = left_cut + 1;
123 if (*left_cut ==
')') {
126 if (*left_cut ==
'(') {
132 ++angle_bracket_count;
133 }
else if (*left_cut ==
'<' && angle_bracket_count > 0) {
134 --angle_bracket_count;
137 if (left_cut == left_end) {
Structure for storing variables of various types.
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.