Refactored namespace_relative to ns_relative
This commit is contained in:
@@ -99,7 +99,7 @@ public:
|
|||||||
else
|
else
|
||||||
ostr << "class ";
|
ostr << "class ";
|
||||||
|
|
||||||
ostr << namespace_relative(m_config.using_namespace, c.name) << " {"
|
ostr << ns_relative(m_config.using_namespace, c.name) << " {"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -149,9 +149,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &r : c.relationships) {
|
for (const auto &r : c.relationships) {
|
||||||
ostr << namespace_relative(m_config.using_namespace, c.name) << " "
|
ostr << ns_relative(m_config.using_namespace, c.name) << " "
|
||||||
<< to_string(r.type) << " "
|
<< to_string(r.type) << " "
|
||||||
<< namespace_relative(m_config.using_namespace, r.destination);
|
<< ns_relative(m_config.using_namespace, r.destination);
|
||||||
if (!r.label.empty())
|
if (!r.label.empty())
|
||||||
ostr << " : " << r.label;
|
ostr << " : " << r.label;
|
||||||
|
|
||||||
@@ -161,8 +161,8 @@ public:
|
|||||||
|
|
||||||
void generate(const enum_ &e, std::ostream &ostr) const
|
void generate(const enum_ &e, std::ostream &ostr) const
|
||||||
{
|
{
|
||||||
ostr << "Enum " << namespace_relative(m_config.using_namespace, e.name)
|
ostr << "Enum " << ns_relative(m_config.using_namespace, e.name) << " {"
|
||||||
<< " {" << std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
for (const auto &enum_constant : e.constants) {
|
for (const auto &enum_constant : e.constants) {
|
||||||
ostr << enum_constant << std::endl;
|
ostr << enum_constant << std::endl;
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ public:
|
|||||||
|
|
||||||
void generate_call(const message &m, std::ostream &ostr) const
|
void generate_call(const message &m, std::ostream &ostr) const
|
||||||
{
|
{
|
||||||
const auto from = namespace_relative(m_config.using_namespace, m.from);
|
const auto from = ns_relative(m_config.using_namespace, m.from);
|
||||||
const auto to = namespace_relative(m_config.using_namespace, m.to);
|
const auto to = ns_relative(m_config.using_namespace, m.to);
|
||||||
|
|
||||||
ostr << '"' << from << "\" "
|
ostr << '"' << from << "\" "
|
||||||
<< "->"
|
<< "->"
|
||||||
@@ -76,9 +76,8 @@ public:
|
|||||||
void generate_return(const message &m, std::ostream &ostr) const
|
void generate_return(const message &m, std::ostream &ostr) const
|
||||||
{
|
{
|
||||||
if ((m.from != m.to) && (m.return_type != "void")) {
|
if ((m.from != m.to) && (m.return_type != "void")) {
|
||||||
const auto from =
|
const auto from = ns_relative(m_config.using_namespace, m.from);
|
||||||
namespace_relative(m_config.using_namespace, m.from);
|
const auto to = ns_relative(m_config.using_namespace, m.to);
|
||||||
const auto to = namespace_relative(m_config.using_namespace, m.to);
|
|
||||||
|
|
||||||
ostr << '"' << to << "\" "
|
ostr << '"' << to << "\" "
|
||||||
<< "-->"
|
<< "-->"
|
||||||
@@ -89,7 +88,7 @@ public:
|
|||||||
void generate_activity(const activity &a, std::ostream &ostr) const
|
void generate_activity(const activity &a, std::ostream &ostr) const
|
||||||
{
|
{
|
||||||
for (const auto &m : a.messages) {
|
for (const auto &m : a.messages) {
|
||||||
const auto to = namespace_relative(m_config.using_namespace, m.to);
|
const auto to = ns_relative(m_config.using_namespace, m.to);
|
||||||
generate_call(m, ostr);
|
generate_call(m, ostr);
|
||||||
ostr << "activate " << '"' << to << '"' << std::endl;
|
ostr << "activate " << '"' << to << '"' << std::endl;
|
||||||
if (m_model.sequences.find(m.to_usr) != m_model.sequences.end())
|
if (m_model.sequences.find(m.to_usr) != m_model.sequences.end())
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ std::vector<std::string> split(std::string str, std::string delimiter)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string namespace_relative(
|
std::string ns_relative(
|
||||||
const std::vector<std::string> &namespaces, const std::string &n)
|
const std::vector<std::string> &namespaces, const std::string &n)
|
||||||
{
|
{
|
||||||
for (const auto &ns : namespaces) {
|
for (const auto &ns : namespaces) {
|
||||||
|
|||||||
Reference in New Issue
Block a user