]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blob - lib/LaTeX/TikZ/Set/Path.pm
Initial commit
[perl/modules/LaTeX-TikZ.git] / lib / LaTeX / TikZ / Set / Path.pm
1 package LaTeX::TikZ::Set::Path;
2
3 use strict;
4 use warnings;
5
6 =head1 NAME
7
8 LaTeX::TikZ::Set::Path - A set object representing a path.
9
10 =head1 VERSION
11
12 Version 0.01
13
14 =cut
15
16 our $VERSION = '0.01';
17
18 use LaTeX::TikZ::Tools;
19
20 use Any::Moose;
21
22 with qw(
23  LaTeX::TikZ::Set::Op
24  LaTeX::TikZ::Set::Mutable
25 );
26
27 has '_ops' => (
28  is       => 'ro',
29  isa      => 'Maybe[ArrayRef[LaTeX::TikZ::Set::Op]]',
30  init_arg => 'ops',
31  default  => sub { [ ] },
32 );
33
34 sub ops { @{$_[0]->_ops} }
35
36 my $ltso_tc = LaTeX::TikZ::Tools::type_constraint('LaTeX::TikZ::Set::Op');
37
38 sub add {
39  my $set = shift;
40
41  $ltso_tc->check($_) for @_;
42
43  push @{$_[0]->_ops}, @_;
44
45  $set;
46 }
47
48 sub path {
49  my $set = shift;
50
51  join ' ', map $_->path(@_), $set->ops;
52 }
53
54 use LaTeX::TikZ::API path => sub {
55  shift;
56
57  __PACKAGE__->new(ops => \@_);
58 };
59
60 __PACKAGE__->meta->make_immutable;
61
62 =head1 AUTHOR
63
64 Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
65
66 You can contact me by mail or on C<irc.perl.org> (vincent).
67
68 =head1 BUGS
69
70 Please report any bugs or feature requests to C<bug-latex-tikz at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=LaTeX-TikZ>.
71 I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
72
73 =head1 SUPPORT
74
75 You can find documentation for this module with the perldoc command.
76
77     perldoc LaTeX::TikZ
78
79 =head1 COPYRIGHT & LICENSE
80
81 Copyright 2010 Vincent Pit, all rights reserved.
82
83 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
84
85 =cut
86
87 1; # End of LaTeX::TikZ::Set::Path