Initial support for concept dependency relationships in class diagrams
This commit is contained in:
72
src/class_diagram/model/concept.cc
Normal file
72
src/class_diagram/model/concept.cc
Normal file
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* src/class_diagram/model/concept.cc
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "concept.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace clanguml::class_diagram::model {
|
||||
|
||||
concept_::concept_(const common::model::namespace_ &using_namespace)
|
||||
: element{using_namespace}
|
||||
{
|
||||
}
|
||||
|
||||
bool operator==(const concept_ &l, const concept_ &r)
|
||||
{
|
||||
return l.id() == r.id();
|
||||
}
|
||||
|
||||
std::string concept_::full_name_no_ns() const
|
||||
{
|
||||
using namespace clanguml::util;
|
||||
|
||||
std::ostringstream ostr;
|
||||
|
||||
ostr << name();
|
||||
|
||||
render_template_params(ostr, using_namespace(), false);
|
||||
|
||||
return ostr.str();
|
||||
}
|
||||
|
||||
std::string concept_::full_name(bool relative) const
|
||||
{
|
||||
using namespace clanguml::util;
|
||||
using clanguml::common::model::namespace_;
|
||||
|
||||
std::ostringstream ostr;
|
||||
|
||||
ostr << name_and_ns();
|
||||
|
||||
render_template_params(ostr, using_namespace(), relative);
|
||||
|
||||
std::string res;
|
||||
|
||||
if (relative)
|
||||
res = using_namespace().relative(ostr.str());
|
||||
else
|
||||
res = ostr.str();
|
||||
|
||||
if (res.empty())
|
||||
return "<<anonymous>>";
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user