0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
clanguml::common::model::element Class Reference

Base class for any element qualified by namespace. More...

Detailed Description

Base class for any element qualified by namespace.

Definition at line 38 of file element.h.

#include <element.h>

Public Member Functions

 element (namespace_ using_namespace, path_type pt=path_type::kNamespace)
 
 ~element () override=default
 
std::string name_and_ns () const
 
void set_namespace (const namespace_ &ns)
 
namespace_ get_namespace () const
 
namespace_ get_relative_namespace () const
 
const namespace_path () const
 
void set_module (const std::string &module)
 
std::optional< std::string > module () const
 
void set_module_private (const bool module_private)
 
bool module_private () const
 
virtual std::string full_name_no_ns () const
 
const namespace_using_namespace () const
 
- Public Member Functions inherited from clanguml::common::model::diagram_element
 diagram_element ()
 
 ~diagram_element () override=default
 
const eid_tid () const
 Returns diagram element id.
 
void set_id (eid_t id)
 
std::optional< eid_tparent_element_id () const
 
void set_parent_element_id (eid_t id)
 
virtual std::string alias () const
 Return elements' diagram alias.
 
void set_name (const std::string &name)
 
void set_name (const std::string &parent, const std::string &name)
 
std::string name () const
 
virtual std::string type_name () const
 
std::string full_name (bool relative) const
 Return the elements fully qualified name.
 
std::vector< relationship > & relationships ()
 
const std::vector< relationship > & relationships () const
 
void add_relationship (relationship &&cr)
 
void append (const decorated_element &e)
 
bool is_nested () const
 
void nested (bool nested)
 
bool complete () const
 
void complete (bool completed)
 
void remove_duplicate_relationships ()
 
virtual void apply_filter (const diagram_filter &filter, const std::set< eid_t > &removed)
 
- Public Member Functions inherited from clanguml::common::model::decorated_element
virtual ~decorated_element ()=default
 
bool skip () const
 
bool skip_relationship () const
 
std::pair< relationship_t, std::string > get_relationship () const
 
std::string style_spec () const
 
const std::vector< std::shared_ptr< decorators::decorator > > & decorators () const
 
void add_decorators (const std::vector< std::shared_ptr< decorators::decorator > > &decorators)
 
void append (const decorated_element &de)
 
std::optional< comment_tcomment () const
 
void set_comment (const comment_t &c)
 
virtual std::optional< std::string > doxygen_link () const
 
- Public Member Functions inherited from clanguml::common::model::source_location
 source_location ()=default
 
 source_location (std::string f, unsigned int l)
 
const std::string & file () const
 
void set_file (const std::string &file)
 
const std::string & file_relative () const
 
void set_file_relative (const std::string &file)
 
const std::string & translation_unit () const
 
void set_translation_unit (const std::string &translation_unit)
 
unsigned int line () const
 
void set_line (const unsigned line)
 
unsigned int column () const
 
void set_column (const unsigned column)
 
unsigned int location_id () const
 
void set_location_id (unsigned int h)
 
- Public Member Functions inherited from clanguml::util::memoized< full_name_tag_t, std::string, bool >
auto memoize (bool is_complete, F &&f, Args... args) const
 
void invalidate (Args... args) const
 
- Public Member Functions inherited from clanguml::util::memoized< name_and_ns_tag, std::string >
auto memoize (bool is_complete, F &&f, Args... args) const
 
void invalidate (Args... args) const
 

Protected Member Functions

std::string full_name_impl (bool relative) const override
 
virtual std::string name_and_ns_impl () const
 
virtual std::string full_name_impl (bool) const
 

Private Attributes

namespace_ ns_
 
namespace_ using_namespace_
 
std::optional< std::string > module_
 
bool module_private_ {false}
 

Friends

bool operator== (const element &l, const element &r)
 
std::ostream & operator<< (std::ostream &out, const element &rhs)
 

Additional Inherited Members

- Public Types inherited from clanguml::util::memoized< full_name_tag_t, std::string, bool >
using key_t = std::tuple< Args... >
 
using value_t = std::string
 
- Public Types inherited from clanguml::util::memoized< name_and_ns_tag, std::string >
using key_t = std::tuple< Args... >
 
using value_t = std::string
 

Constructor & Destructor Documentation

◆ element()

clanguml::common::model::element::element ( namespace_  using_namespace,
path_type  pt = path_type::kNamespace 
)

Definition at line 28 of file element.cc.

29 : ns_{pt}
31{
32}

◆ ~element()

clanguml::common::model::element::~element ( )
overridedefault

Member Function Documentation

◆ full_name_impl()

std::string clanguml::common::model::element::full_name_impl ( bool  relative) const
inlineoverrideprotectedvirtual

◆ full_name_no_ns()

virtual std::string clanguml::common::model::element::full_name_no_ns ( ) const
inlinevirtual

Return elements full name but without namespace.

Returns
Elements full name without namespace.

Reimplemented in clanguml::class_diagram::model::class_, clanguml::class_diagram::model::concept_, clanguml::sequence_diagram::model::class_, clanguml::sequence_diagram::model::function, and clanguml::sequence_diagram::model::function_template.

Definition at line 130 of file element.h.

130{ return name(); }

◆ get_namespace()

namespace_ clanguml::common::model::element::get_namespace ( ) const
inline

Return elements namespace.

Returns
Namespace.

Definition at line 72 of file element.h.

72{ return ns_; }

◆ get_relative_namespace()

namespace_ clanguml::common::model::element::get_relative_namespace ( ) const
inline

Return elements relative namespace.

Returns
Namespace.

Definition at line 79 of file element.h.

80 {
82 }

◆ module()

std::optional< std::string > clanguml::common::model::element::module ( ) const
inline

Return elements owning module, if any.

Returns
C++20 module.

Definition at line 106 of file element.h.

106{ return module_; }

◆ module_private()

bool clanguml::common::model::element::module_private ( ) const
inline

Check whether the element is in a private module.

Returns
C++20 module.

Definition at line 123 of file element.h.

123{ return module_private_; }

◆ name_and_ns()

std::string clanguml::common::model::element::name_and_ns ( ) const
inline

Return the elements fully qualified name, but without template arguments or function params.

Returns
Fully qualified element name.

Definition at line 50 of file element.h.

51 {
53 true, [this]() { return name_and_ns_impl(); });
54 }

◆ name_and_ns_impl()

virtual std::string clanguml::common::model::element::name_and_ns_impl ( ) const
inlineprotectedvirtual

Definition at line 157 of file element.h.

158 {
159 auto ns = ns_ | name();
160 return ns.to_string();
161 }

◆ path()

const namespace_ & clanguml::common::model::element::path ( ) const
inline

Return elements namespace as path.

Namespace is a nested path in diagrams where packages are generated from namespaces.

Returns
Namespace.

Definition at line 92 of file element.h.

92{ return ns_; }

◆ set_module()

void clanguml::common::model::element::set_module ( const std::string &  module)
inline

Set elements owning module.

Parameters
moduleC++20 module.

Definition at line 99 of file element.h.

99{ module_ = module; }

◆ set_module_private()

void clanguml::common::model::element::set_module_private ( const bool  module_private)
inline

Set whether the element is in a private module

Parameters
moduleC++20 module.

Definition at line 113 of file element.h.

114 {
116 }

◆ set_namespace()

void clanguml::common::model::element::set_namespace ( const namespace_ ns)
inline

Set elements namespace.

Parameters
nsNamespace.

Definition at line 61 of file element.h.

◆ using_namespace()

const namespace_ & clanguml::common::model::element::using_namespace ( ) const

Return the relative namespace from config.

Returns
Namespace.

Definition at line 34 of file element.cc.

34{ return using_namespace_; }

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
const element rhs 
)
friend

Definition at line 42 of file element.cc.

43{
44 out << "(" << rhs.name() << ", ns=[" << rhs.get_namespace().to_string()
45 << "], full_name=[" << rhs.full_name(true) << "])";
46
47 return out;
48}

◆ operator==

bool operator== ( const element l,
const element r 
)
friend

Definition at line 36 of file element.cc.

37{
38 return (l.type_name() == l.type_name()) &&
39 (l.full_name(false) == r.full_name(false));
40}

Member Data Documentation

◆ module_

std::optional<std::string> clanguml::common::model::element::module_
private

Definition at line 166 of file element.h.

◆ module_private_

bool clanguml::common::model::element::module_private_ {false}
private

Definition at line 167 of file element.h.

◆ ns_

namespace_ clanguml::common::model::element::ns_
private

Definition at line 164 of file element.h.

◆ using_namespace_

namespace_ clanguml::common::model::element::using_namespace_
private

Definition at line 165 of file element.h.


The documentation for this class was generated from the following files: