line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FreeMind::Document; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
544472
|
use 5.010001; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
82
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
65
|
|
5
|
2
|
|
|
2
|
|
17
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
82
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
8
|
2
|
|
|
2
|
|
4
|
$FreeMind::Document::AUTHORITY = 'cpan:TOBYINK'; |
9
|
2
|
|
|
|
|
55
|
$FreeMind::Document::VERSION = '0.001'; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use XML::LibXML::Augment |
13
|
0
|
|
|
|
|
|
-type => 'Document', |
14
|
|
|
|
|
|
|
-names => ['map'], |
15
|
2
|
|
|
2
|
|
1867
|
; |
|
0
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
require FreeMind::Map; |
18
|
|
|
|
|
|
|
require FreeMind::Node; |
19
|
|
|
|
|
|
|
require FreeMind::Icon; |
20
|
|
|
|
|
|
|
require FreeMind::Edge; |
21
|
|
|
|
|
|
|
require FreeMind::Font; |
22
|
|
|
|
|
|
|
require FreeMind::Cloud; |
23
|
|
|
|
|
|
|
require FreeMind::ArrowLink; |
24
|
|
|
|
|
|
|
require FreeMind::Text; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use Carp; |
27
|
|
|
|
|
|
|
use Types::Standard; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _has |
30
|
|
|
|
|
|
|
{ |
31
|
|
|
|
|
|
|
my $pkg = shift; |
32
|
|
|
|
|
|
|
while (@_) |
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
my $name = shift; |
35
|
|
|
|
|
|
|
my $opts; $opts = shift if ref $_[0]; |
36
|
|
|
|
|
|
|
next if $pkg->can($name); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $type = $opts->{isa} || Types::Standard::Str; |
39
|
|
|
|
|
|
|
my $required = $opts->{required}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $sub = sub { |
42
|
|
|
|
|
|
|
my $node = shift; |
43
|
|
|
|
|
|
|
return $node->getAttribute($name) unless @_; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $v = $_[0]; |
46
|
|
|
|
|
|
|
if (defined $v) |
47
|
|
|
|
|
|
|
{ |
48
|
|
|
|
|
|
|
$type->assert_valid($v); |
49
|
|
|
|
|
|
|
$v = $v ? "true" : "false" if $type->name eq 'Bool'; |
50
|
|
|
|
|
|
|
$node->setAttribute($name, $v); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
else |
53
|
|
|
|
|
|
|
{ |
54
|
|
|
|
|
|
|
croak "cannot set required attribute '$name' to undef" if $required; |
55
|
|
|
|
|
|
|
$node->removeAttribute($name); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
}; |
58
|
|
|
|
|
|
|
{ no strict "refs"; *{$pkg."::".lc $name} = $sub } |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub load |
63
|
|
|
|
|
|
|
{ |
64
|
|
|
|
|
|
|
shift; |
65
|
|
|
|
|
|
|
"XML::LibXML::Augment"->rebless( |
66
|
|
|
|
|
|
|
"XML::LibXML"->load_xml(@_), |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub root |
71
|
|
|
|
|
|
|
{ |
72
|
|
|
|
|
|
|
shift->findnodes('/map/node')->[0]; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub toHash |
76
|
|
|
|
|
|
|
{ |
77
|
|
|
|
|
|
|
shift->root->toHash; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub toText |
81
|
|
|
|
|
|
|
{ |
82
|
|
|
|
|
|
|
shift->root->toText(@_); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |