Added support for call comment directive to inject calls in comments (Fixes #196)
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user