Added 'title' diagram property

This commit is contained in:
Bartek Kryza
2023-10-09 13:53:14 +02:00
parent 03bd5ada31
commit 8a6b497cc9
52 changed files with 173 additions and 66 deletions

View File

@@ -494,6 +494,20 @@ struct SequenceDiagramAliasMatcher {
};
}
ContainsMatcher HasTitle(std::string const &str,
CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes)
{
return ContainsMatcher(CasedString("title " + str, caseSensitivity));
}
namespace mermaid {
ContainsMatcher HasTitle(std::string const &str,
CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes)
{
return ContainsMatcher(CasedString("title: " + str, caseSensitivity));
}
}
ContainsMatcher IsClass(std::string const &str,
CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes)
{
@@ -1231,6 +1245,11 @@ std::string expand_name(const nlohmann::json &j, const std::string &name)
return fmt::format("{}::{}", j["using_namespace"].get<std::string>(), name);
}
bool HasTitle(const nlohmann::json &j, const std::string &title)
{
return j.contains("title") && j["title"] == title;
}
bool IsClass(const nlohmann::json &j, const std::string &name)
{
auto e = get_element(j, expand_name(j, name));