File Coverage

t/typemap/object/single.xsi
Criterion Covered Total %
statement 18 19 94.7
branch 16 32 50.0
condition n/a
subroutine n/a
pod n/a
total 34 51 66.6


line stmt bran cond sub pod time code
1             MODE: INLINE
2              
3             template
4             class _MyBase {
5             public:
6             int val;
7             _MyBase (int arg) : val(arg) {}
8             virtual _MyBase* clone () const { return new _MyBase(val); }
9             virtual ~_MyBase () { dcnt.c++; }
10             };
11              
12             using MyBase = _MyBase<0>;
13             using PTRMyBase = _MyBase<1>;
14              
15             namespace xs {
16             template struct Typemap : TypemapObject {
17             static std::string package () { return "MyTest::PTRMyBase"; }
18             };
19             template struct Typemap : TypemapObject {
20             static std::string package () { return "MyTest::MyBase"; }
21             static MyBase* dup (const MyBase* obj) { return obj->clone(); }
22             };
23             }
24              
25              
26             MODULE = MyTest::Typemap::Object PACKAGE = MyTest::PTRMyBase
27             PROTOTYPES: DISABLE
28              
29             PTRMyBase* PTRMyBase::new (int arg) {
30 7           if (!arg) XSRETURN_UNDEF;
31 4 50         RETVAL = new PTRMyBase(arg);
32 4 100         }
33 3 50          
34             int PTRMyBase::val (SV* newval = NULL) {
35 5 50         if (newval) THIS->val = SvIV(newval);
    0          
    0          
36 5           RETVAL = THIS->val;
37             }
38              
39             void PTRMyBase::set_from (PTRMyBase* other) {
40 2 100         if (other) THIS->val = other->val;
41             }
42              
43             void PTRMyBase::DESTROY () {
44 5           dcnt.perl++;
45 5 50         }
46              
47              
48             MODULE = MyTest::Typemap::Object PACKAGE = MyTest::MyBase
49             PROTOTYPES: DISABLE
50              
51             MyBase* MyBase::new (int arg) {
52 9           if (!arg) XSRETURN_UNDEF;
53 5 50         RETVAL = new MyBase(arg);
54 5 100         }
55 4 50          
56             int MyBase::val (SV* newval = NULL) {
57 9 50         if (newval) THIS->val = SvIV(newval);
    0          
    0          
58 9           RETVAL = THIS->val;
59             }
60              
61             int MyBase::get_val () {
62 0           RETVAL = THIS->val;
63             }
64              
65             void MyBase::set_from (MyBase* other) {
66 2 100         if (other) THIS->val = other->val;
67             }
68              
69             void MyBase::DESTROY () {
70 10           dcnt.perl++;
71 10 50         }