Added diagram templates to config

This commit is contained in:
Bartek Kryza
2023-03-07 23:03:02 +01:00
parent 0dc7445909
commit 2092a0e3e6
6 changed files with 151 additions and 1 deletions

View File

@@ -18,6 +18,7 @@
#include "enums.h"
#include <cassert>
#include <stdexcept>
namespace clanguml::common::model {
@@ -135,4 +136,18 @@ std::string to_string(const diagram_t t)
}
}
diagram_t from_string(const std::string &s)
{
if (s == "class")
return diagram_t::kClass;
else if (s == "sequence")
return diagram_t::kSequence;
else if (s == "include")
return diagram_t::kInclude;
else if (s == "package")
return diagram_t::kPackage;
else
throw std::runtime_error{"Invalid diagram type: " + s};
}
} // namespace clanguml::common::model

View File

@@ -80,4 +80,6 @@ std::string to_string(message_t m);
std::string to_string(diagram_t r);
diagram_t from_string(const std::string &s);
} // namespace clanguml::common::model