Refactored standard template aliases to configuration file
This commit is contained in:
@@ -64,8 +64,6 @@ void generator::generate_alias(const class_ &c, std::ostream &ostr) const
|
||||
else
|
||||
full_name = c.full_name();
|
||||
|
||||
// util::replace_all(full_name, "std::basic_string<char>", "std::string");
|
||||
|
||||
if (full_name.empty())
|
||||
full_name = "<<anonymous>>";
|
||||
|
||||
|
||||
@@ -36,14 +36,7 @@ void template_parameter::set_type(const std::string &type) { type_ = type; }
|
||||
|
||||
std::string template_parameter::type() const { return type_; }
|
||||
|
||||
void template_parameter::set_name(const std::string &name)
|
||||
{
|
||||
name_ = name;
|
||||
// TODO: Add a configurable mapping for simplifying non-interesting
|
||||
// std templates
|
||||
util::replace_all(name_, "std::basic_string<char>", "std::string");
|
||||
util::replace_all(name_, "std::basic_string<wchar_t>", "std::wstring");
|
||||
}
|
||||
void template_parameter::set_name(const std::string &name) { name_ = name; }
|
||||
|
||||
std::string template_parameter::name() const
|
||||
{
|
||||
@@ -157,10 +150,6 @@ std::string template_parameter::to_string(
|
||||
res += default_value();
|
||||
}
|
||||
|
||||
// TODO: Refactor this to external configurable class
|
||||
util::replace_all(res, "std::basic_string<char>", "std::string");
|
||||
util::replace_all(res, "std::basic_string<wchar_t>", "std::wstring");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -2077,20 +2077,8 @@ const cppast::cpp_type &translation_unit_visitor::resolve_alias_template(
|
||||
bool translation_unit_visitor::simplify_system_template(
|
||||
template_parameter &ct, const std::string &full_name)
|
||||
{
|
||||
if (full_name == "std::basic_string<char>") {
|
||||
ct.set_name("std::string");
|
||||
return true;
|
||||
}
|
||||
else if (full_name == "std::basic_string<wchar_t>") {
|
||||
ct.set_name("std::wstring");
|
||||
return true;
|
||||
}
|
||||
else if (full_name == "std::basic_string<char16_t>") {
|
||||
ct.set_name("std::u16string");
|
||||
return true;
|
||||
}
|
||||
else if (full_name == "std::basic_string<char32_t>") {
|
||||
ct.set_name("std::u32string");
|
||||
if (ctx.config().template_aliases().count(full_name) > 0) {
|
||||
ct.set_name(ctx.config().template_aliases().at(full_name));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user