Added support for call comment directive to inject calls in comments (Fixes #196)

This commit is contained in:
Bartek Kryza
2023-10-21 21:47:26 +02:00
parent 4f43253c0d
commit 0d237fec0a
8 changed files with 92 additions and 18 deletions
+14
View File
@@ -47,6 +47,9 @@ std::shared_ptr<decorator> decorator::from_string(std::string_view c)
if (c.find(association::label) == 0) {
return association::from_string(c);
}
if (c.find(call::label) == 0) {
return call::from_string(c);
}
return {};
}
@@ -173,6 +176,17 @@ std::shared_ptr<decorator> association::from_string(std::string_view c)
return res;
}
std::shared_ptr<decorator> call::from_string(std::string_view c)
{
auto res = std::make_shared<call>();
auto toks = res->tokenize(call::label, c);
res->diagrams = toks.diagrams;
res->callee = util::trim(toks.text);
return res;
}
std::vector<std::shared_ptr<decorator>> parse(
std::string documentation_block, const std::string &clanguml_tag)
{
+11
View File
@@ -140,6 +140,17 @@ struct association : public relationship {
static std::shared_ptr<decorator> from_string(std::string_view c);
};
/**
* @brief Represents a call message in sequence diagram
*/
struct call : public decorator {
static inline const std::string label{"call"};
std::string callee;
static std::shared_ptr<decorator> from_string(std::string_view c);
};
/**
* @brief Parse a documentation block and extract all clang-uml decorators
*