29 std::vector<std::string> cv_qualifiers;
31 cv_qualifiers.emplace_back(
"const");
33 cv_qualifiers.emplace_back(
"volatile");
35 auto res = fmt::format(
"{}", fmt::join(cv_qualifiers,
" "));
65 return "template_type";
67 return "template_template_type";
69 return "non_type_template";
73 return "concept_constraint";
90 const std::string &name,
const std::optional<std::string> &default_value,
104 const std::string &name,
const std::optional<std::string> &default_value,
117 const std::string &type,
const std::optional<std::string> &name,
118 const std::optional<std::string> &default_value,
bool is_variadic)
132 const std::string &type,
const std::optional<std::string> &default_value)
143 const std::string &type,
const std::optional<std::string> &default_value)
183 return type_.value() +
"...";
214 return name_.value() +
"...";
233 is_variadic_ = is_variadic;
268 auto maybe_base_template_parameter_type = base_template_parameter.
type();
269 auto maybe_template_parameter_type =
type();
271 if (maybe_base_template_parameter_type.has_value() &&
272 maybe_template_parameter_type.has_value() &&
275 if (maybe_base_template_parameter_type.value() !=
276 maybe_template_parameter_type.value())
301 if (params_match == 0)
321 res +=
static_cast<int>(
338const std::vector<template_parameter> &
346 std::vector<std::string> deduced_contexts;
349 deduced_contexts.push_back(c.to_string());
352 return fmt::format(
"{}", fmt::join(deduced_contexts,
" "));
357 bool skip_qualifiers)
const
372 auto element_type = it->to_string(using_namespace, relative);
375 std::vector<std::string> dimension_args;
377 dimension_args.push_back(it->to_string(using_namespace, relative));
380 "{}[{}]", element_type, fmt::join(dimension_args,
"]["));
385 auto return_type = it->to_string(using_namespace, relative);
388 std::vector<std::string> function_args;
390 function_args.push_back(it->to_string(using_namespace, relative));
393 "{}({})", return_type, fmt::join(function_args,
","));
399 std::string unqualified = fmt::format(
"{} {}::*",
413 auto return_type = it->to_string(using_namespace, relative);
415 auto class_type = it->to_string(using_namespace, relative);
417 std::vector<std::string> args;
420 args.push_back(it->to_string(using_namespace, relative));
423 std::string unqualified = fmt::format(
424 "{} ({}::*)({})", return_type, class_type, fmt::join(args,
","));
432 const auto maybe_type =
type();
444 if (maybe_concept_constraint) {
448 res +=
namespace_{maybe_concept_constraint.value()}
453 const auto maybe_name =
name();
456 if ((maybe_type && !maybe_type.value().empty()) ||
457 maybe_concept_constraint)
470 std::vector<std::string> params;
474 template_param.to_string(using_namespace, relative));
477 res += fmt::format(
"<{}>", fmt::join(params,
","));
480 if (!skip_qualifiers)
484 if (maybe_default_value) {
486 res += maybe_default_value.value();
494 const clang::Decl *>> &nested_relationships,
496 const std::function<
bool(
const std::string &full_name)> &should_include)
499 bool added_aggregation_relationship{
false};
503 const auto maybe_type =
type();
508 if (maybe_type && should_include(maybe_type.value())) {
512 const auto maybe_id =
id();
514 nested_relationships.emplace_back(maybe_id.value(), hint, decl);
515 added_aggregation_relationship =
524 const auto maybe_id = template_argument.id();
525 const auto maybe_arg_type = template_argument.type();
527 if (maybe_id && maybe_arg_type && should_include(*maybe_arg_type)) {
529 if (template_argument.is_association() &&
533 nested_relationships.emplace_back(maybe_id.value(), hint, decl);
535 added_aggregation_relationship =
539 if (template_argument.is_function_template())
542 added_aggregation_relationship =
543 template_argument.find_nested_relationships(
544 decl, nested_relationships, hint, should_include);
549 return added_aggregation_relationship;
568 bool is_template_template_parameter)
647 const std::vector<template_parameter> &specialization_params,
648 const std::vector<template_parameter> &template_params)
652 if (specialization_params.size() != template_params.size() &&
653 !std::any_of(template_params.begin(), template_params.end(),
654 [](
const auto &t) { return t.is_variadic(); })) {
658 if (!specialization_params.empty() && !template_params.empty()) {
659 auto template_index{0U};
662 while (arg_index < specialization_params.size() &&
663 template_index < template_params.size()) {
664 auto match = specialization_params.at(arg_index)
665 .calculate_specialization_match(
666 template_params.at(template_index));
675 if (!specialization_params.at(arg_index).is_template_parameter())
680 if (!template_params.at(template_index).is_template_parameter())
683 if (!template_params.at(template_index).is_variadic())
691 if (arg_index == specialization_params.size()) {
694 template_index = template_params.size() - 1;
695 arg_index = specialization_params.size() - 1;
698 auto match = specialization_params.at(arg_index)
699 .calculate_specialization_match(
700 template_params.at(template_index));
705 if (arg_index == 0 || template_index == 0)
710 if (!template_params.at(template_index).is_variadic())