File Coverage

/usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/XS/Framework.x/i/xs/typemap/auto.h
Criterion Covered Total %
statement 3 3 100.0
branch 1 2 50.0
condition n/a
subroutine n/a
pod n/a
total 4 5 80.0


line stmt bran cond sub pod time code
1             #pragma once
2             #include "base.h"
3             #include
4              
5             namespace xs {
6              
7             // automatic default typemap for if typemap for defined
8             template struct Typemap : Typemap {};
9              
10             // automatic default reference resolving
11             template *>::value> struct TypemapResolveReference {};
12             template struct TypemapResolveReference : Typemap {
13             using Super = Typemap;
14             static TYPE& in (SV* arg) {
15             auto ret = Super::in(arg);
16             if (!ret) throw "invalid value: undef not allowed";
17             return *ret;
18             }
19             static Sv out (TYPE& var, const Sv& = {}) = delete;
20             };
21             template struct TypemapResolveReference : Typemap> {};
22             template struct Typemap : TypemapResolveReference {};
23              
24             // automatic default typemap for > if typemap for defined
25             template struct Typemap, panda::iptr> : Typemap {
26             using Super = Typemap;
27 9850           static panda::iptr in (SV* arg) { return Super::in(arg); }
28              
29 1256           static Sv out (const panda::iptr& var, const Sv& proto = {}) {
30 1256 50         return Super::out(var.get(), proto);
31             }
32             };
33              
34             }