File Coverage

blib/lib/Renard/Incunabula/Common/Types.pm
Criterion Covered Total %
statement 24 24 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 32 32 100.0


line stmt bran cond sub pod time code
1 1     1   9 use Renard::Incunabula::Common::Setup;
  1         3  
  1         9  
2             package Renard::Incunabula::Common::Types;
3             # ABSTRACT: Type library
4             $Renard::Incunabula::Common::Types::VERSION = '0.003';
5 1         21 use Type::Library 0.008 -base,
6             -declare => [qw(
7             DocumentModel
8             RenderableDocumentModel
9             PageNumber
10             PageCount
11             LaxPageNumber
12             ZoomLevel
13             SizeRequest
14 1     1   14 )];
  1         43  
15 1     1   1401 use Type::Utils -all;
  1         5261  
  1         16  
16              
17             # Listed here so that scan-perl-deps can find them
18 1     1   5982 use Types::Path::Tiny ();
  1         17063  
  1         35  
19 1     1   908 use Types::URI ();
  1         65902  
  1         68  
20 1     1   10 use Types::Standard qw(Tuple);
  1         2  
  1         11  
21 1     1   1287 use Types::Common::Numeric qw(PositiveInt PositiveOrZeroInt PositiveNum);
  1         11928  
  1         10  
22              
23 1     1   1545 use Type::Libraries;
  1         495  
  1         5  
24             Type::Libraries->setup_class(
25             __PACKAGE__,
26             qw(
27             Types::Standard
28             Types::Path::Tiny
29             Types::URI
30             Types::Common::Numeric
31             )
32             );
33              
34              
35             class_type "DocumentModel",
36             { class => "Renard::Incunabula::Document" };
37              
38             role_type "RenderableDocumentModel",
39             { role => "Renard::Incunabula::Document::Role::Renderable" };
40              
41             role_type "RenderablePageModel",
42             { role => "Renard::Incunabula::Page::Role::CairoRenderable" };
43              
44             declare "PageNumber", parent => PositiveInt;
45              
46             declare "PageCount", parent => PositiveInt;
47              
48             declare "LaxPageNumber", parent => PositiveOrZeroInt;
49              
50             declare "ZoomLevel", parent => PositiveNum;
51              
52             declare "SizeRequest",
53             parent => Tuple[PositiveInt,PositiveInt];
54              
55             1;
56              
57             __END__
58              
59             =pod
60              
61             =encoding UTF-8
62              
63             =head1 NAME
64              
65             Renard::Incunabula::Common::Types - Type library
66              
67             =head1 VERSION
68              
69             version 0.003
70              
71             =head1 EXTENDS
72              
73             =over 4
74              
75             =item * L<Type::Library>
76              
77             =item * L<Type::Library>
78              
79             =back
80              
81             =head1 TYPES
82              
83             =head2 DocumentModel
84              
85             A type for any reference that extends L<Renard::Incunabula::Document>.
86              
87             =head2 RenderableDocumentModel
88              
89             A type for any reference that does
90             L<Renard::Incunabula::Document::Role::Renderable>.
91              
92             =head2 RenderablePageModel
93              
94             A type for any reference that does
95             L<Renard::Incunabula::Page::Role::CairoRenderable>.
96              
97             =head2 PageNumber
98              
99             An alias to L<PositiveInt> that can be used for document page number semantics.
100              
101             =head2 PageCount
102              
103             An alias to L<PositiveInt> that can be used for document page number count semantics.
104              
105             =head2 LaxPageNumber
106              
107             An alias to L<PositiveOrZeroInt> that can be used for document page number
108             semantics when the source data may contain invalid pages.
109              
110             =head2 ZoomLevel
111              
112             The amount to zoom in on a page. This is a multiplier such that
113              
114             =over 4
115              
116             =item *
117              
118             when the value is C<1.0>, the page area is the standard area
119              
120             =item *
121              
122             when the value is C<2.0>, the page is C<4> times the standard area
123              
124             =item *
125              
126             when the value is C<0.5>, the page is C<0.25> times the standard area
127              
128             =back
129              
130             =head2 SizeRequest
131              
132             A tuple that represents a size request for a widget.
133              
134             =head1 TYPE LIBRARIES
135              
136             =over 4
137              
138             =item *
139              
140             L<Types::Standard>
141              
142             =item *
143              
144             L<Types::Path::Tiny>
145              
146             =item *
147              
148             L<Types::Common::Numeric>
149              
150             =back
151              
152             =head1 AUTHOR
153              
154             Project Renard
155              
156             =head1 COPYRIGHT AND LICENSE
157              
158             This software is copyright (c) 2017 by Project Renard.
159              
160             This is free software; you can redistribute it and/or modify it under
161             the same terms as the Perl 5 programming language system itself.
162              
163             =cut