File Coverage

lib/ExtUtils/XSpp/Typemap/reference.pm
Criterion Covered Total %
statement 15 16 93.7
branch 1 2 50.0
condition n/a
subroutine 6 6 100.0
pod 4 5 80.0
total 26 29 89.6


line stmt bran cond sub pod time code
1             package ExtUtils::XSpp::Typemap::reference;
2              
3 21     21   102 use base 'ExtUtils::XSpp::Typemap';
  21         38  
  21         784  
4              
5             sub init {
6 59     59 0 148 my $this = shift;
7 59         235 my %args = @_;
8              
9 59 50       229 if( my $base = $args{base} ) {
10 0         0 %args = ( xs_type => $base->{XS_TYPE},
11             xs_input_code => $base->{XS_INPUT_CODE},
12             xs_output_code => $base->{XS_OUTPUT_CODE},
13             %args );
14             }
15              
16 59         240 $this->{XS_TYPE} = $args{xs_type};
17 59         132 $this->{NAME} = $args{name};
18 59         228 $this->{TYPE} = $args{type};
19             }
20              
21             sub cpp_type {
22 14     14 1 64 my $type = $_[0]->type;
23 14         43 $type->base_type . $type->print_tmpl_args . ('*' x ($type->is_pointer+1))
24             }
25 1     1 1 6 sub output_code { undef }
26 5     5 1 17 sub call_parameter_code { "*( $_[1] )" }
27             sub call_function_code {
28 2     2 1 8 my $type = $_[0]->type;
29 2         8 $_[2] . ' = new ' . $type->base_type . $type->print_tmpl_args . '( ' . $_[1] . " )";
30             }
31              
32             1;