Added support for C++20 coroutines in class diagrams (#221)
This commit is contained in:
@@ -63,6 +63,7 @@ void to_json(nlohmann::json &j, const class_method &c)
|
||||
j["is_noexcept"] = c.is_noexcept();
|
||||
j["is_constexpr"] = c.is_constexpr();
|
||||
j["is_consteval"] = c.is_consteval();
|
||||
j["is_coroutine"] = c.is_coroutine();
|
||||
j["is_constructor"] = c.is_constructor();
|
||||
j["is_move_assignment"] = c.is_move_assignment();
|
||||
j["is_copy_assignment"] = c.is_copy_assignment();
|
||||
|
||||
@@ -251,6 +251,9 @@ void generator::generate_method(
|
||||
if (m.is_consteval()) {
|
||||
method_mods.emplace_back("consteval");
|
||||
}
|
||||
if (m.is_coroutine()) {
|
||||
method_mods.emplace_back("coroutine");
|
||||
}
|
||||
|
||||
if (!method_mods.empty()) {
|
||||
ostr << fmt::format("[{}] ", fmt::join(method_mods, ","));
|
||||
|
||||
@@ -338,6 +338,9 @@ void generator::generate_method(
|
||||
else if (m.is_deleted())
|
||||
ostr << " = deleted";
|
||||
|
||||
if (m.is_coroutine())
|
||||
ostr << " [coroutine]";
|
||||
|
||||
ostr << " : " << type;
|
||||
|
||||
if (config().generate_links) {
|
||||
|
||||
@@ -70,6 +70,13 @@ void class_method::is_consteval(bool is_consteval)
|
||||
is_consteval_ = is_consteval;
|
||||
}
|
||||
|
||||
bool class_method::is_coroutine() const { return is_coroutine_; }
|
||||
|
||||
void class_method::is_coroutine(bool is_coroutine)
|
||||
{
|
||||
is_coroutine_ = is_coroutine;
|
||||
}
|
||||
|
||||
bool class_method::is_noexcept() const { return is_noexcept_; }
|
||||
|
||||
void class_method::is_noexcept(bool is_noexcept) { is_noexcept_ = is_noexcept; }
|
||||
|
||||
@@ -152,6 +152,20 @@ public:
|
||||
*/
|
||||
void is_consteval(bool is_consteval);
|
||||
|
||||
/**
|
||||
* @brief Whether the method is a C++20 coroutine.
|
||||
*
|
||||
* @return True, if the method is a coroutine
|
||||
*/
|
||||
bool is_coroutine() const;
|
||||
|
||||
/**
|
||||
* @brief Set whether the method is a C++20 coroutine.
|
||||
*
|
||||
* @param is_coroutine True, if the method is a coroutine
|
||||
*/
|
||||
void is_coroutine(bool is_coroutine);
|
||||
|
||||
/**
|
||||
* @brief Whether the method is noexcept.
|
||||
*
|
||||
@@ -262,6 +276,7 @@ private:
|
||||
bool is_noexcept_{false};
|
||||
bool is_constexpr_{false};
|
||||
bool is_consteval_{false};
|
||||
bool is_coroutine_{false};
|
||||
bool is_constructor_{false};
|
||||
bool is_destructor_{false};
|
||||
bool is_move_assignment_{false};
|
||||
|
||||
@@ -1369,6 +1369,7 @@ void translation_unit_visitor::process_method_properties(
|
||||
method.is_move_assignment(mf.isMoveAssignmentOperator());
|
||||
method.is_copy_assignment(mf.isCopyAssignmentOperator());
|
||||
method.is_noexcept(isNoexceptExceptionSpec(mf.getExceptionSpecType()));
|
||||
method.is_coroutine(common::is_coroutine(mf));
|
||||
}
|
||||
|
||||
void translation_unit_visitor::
|
||||
|
||||
Reference in New Issue
Block a user