line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GraphViz::Diagram::ClassDiagram::ClassElement; |
2
|
|
|
|
|
|
|
#_{ use |
3
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
10
|
use Carp; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
67
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
20
|
use GraphViz::Diagram::ClassDiagram; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
435
|
|
9
|
|
|
|
|
|
|
#_} |
10
|
|
|
|
|
|
|
our $VERSION = $GraphViz::Diagram::ClassDiagram::VERSION; |
11
|
|
|
|
|
|
|
sub new { #_{ |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
0
|
0
|
|
my $class_parent = shift; # Either a GraphViz::Diagram::ClassDiagram::Attribute or a GraphViz::Diagram::ClassDiagram::Method |
14
|
|
|
|
|
|
|
# my $self = shift; |
15
|
0
|
|
|
|
|
|
my $class = shift; # The GraphViz::Diagram::ClassDiagram::Class object in which this ClassElement is being defined |
16
|
0
|
|
|
|
|
|
my $ident = shift; |
17
|
0
|
|
0
|
|
|
|
my $opts = shift // {}; |
18
|
|
|
|
|
|
|
|
19
|
0
|
0
|
0
|
|
|
|
croak "ClassElement - new: passed \$class_parent (= $class_parent) is neither an *::Attribute nor a *::Method" unless |
20
|
|
|
|
|
|
|
$class_parent eq 'GraphViz::Diagram::ClassDiagram::Attribute' or |
21
|
|
|
|
|
|
|
$class_parent eq 'GraphViz::Diagram::ClassDiagram::Method'; |
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
croak "ClassElement -new passed attribute \$class (=$class) is not a GraphViz::Diagram::ClassDiagram::Class" unless ref $class eq 'GraphViz::Diagram::ClassDiagram::Class'; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my $self = {}; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
$self->{class} = $class; |
28
|
0
|
|
|
|
|
|
$self->{ident} = $ident; |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
$self->{comment} = delete $opts->{comment} if exists $opts->{comment}; |
31
|
0
|
0
|
|
|
|
|
$self->{type} = delete $opts->{type} if exists $opts->{type}; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
bless $self, $class_parent; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return $self; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} #_} |
38
|
|
|
|
|
|
|
sub tr { #_{ |
39
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
40
|
0
|
|
|
|
|
|
my $first_row = shift; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my $draw_border_above = 0; |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
if (! $first_row) { |
45
|
0
|
|
|
|
|
|
$draw_border_above = 1; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $border_etc=''; |
49
|
0
|
0
|
|
|
|
|
if ($draw_border_above) { |
50
|
0
|
|
|
|
|
|
$border_etc = " sides='t'"; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
else { |
53
|
0
|
|
|
|
|
|
$border_etc = " border='0'"; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $color_ident = $self->ident_color(); |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
my $td_type = " | "; |
59
|
0
|
0
|
|
|
|
|
$td_type .= $self->{type} if (exists $self->{type}); |
60
|
0
|
|
|
|
|
|
$td_type .= " | ";
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my $td_ident = " | $self->{ident} | ";
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $tr = " |
$td_type$td_ident
";
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
my $colspan_max = GraphViz::Diagram::ClassDiagram::Class::colspan_(); |
67
|
0
|
0
|
|
|
|
|
if ($self->{comment}) { |
68
|
0
|
|
|
|
|
|
my $color_comment = GraphViz::Diagram::ClassDiagram::color_comment(); |
69
|
0
|
|
|
|
|
|
$tr .= " |
$self->{comment} |
";
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return $tr; |
73
|
|
|
|
|
|
|
} #_} |
74
|
|
|
|
|
|
|
sub connector_for_links {#_{ |
75
|
|
|
|
|
|
|
=head2 connector_for_links |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Returns a string that can be used in L -> C. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Must currently (as of version 0.01) be called after C was called! |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Should not be called by a user, it is called by L C<< -> create() >> instead |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
86
|
|
|
|
|
|
|
|
87
|
0
|
0
|
|
|
|
|
croak "ClassElement - connector_for_links: self->{class} is not set - is Class->add_class_as_node_to_graph already run?" unless $self->{class}; |
88
|
0
|
0
|
|
|
|
|
croak "ClassElement - connector_for_links: $self->{class} is not a GraphViz::Diagram::ClassDiagram::Class" unless ref $self->{class} eq 'GraphViz::Diagram::ClassDiagram::Class'; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# return $self->{class}->{class_node}->port($self->{ident}); |
91
|
0
|
|
|
|
|
|
return $self->{class} ->port($self->{ident}); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
} #_} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
'tq84'; |