File Coverage

t/typemap/object/mixin.xsi
Criterion Covered Total %
statement 34 35 97.1
branch 52 90 57.7
condition n/a
subroutine n/a
pod n/a
total 86 125 68.8


line stmt bran cond sub pod time code
1             MODE: INLINE
2              
3             class MixBase {
4             public:
5             int val;
6             MixBase (int arg) : val(arg) {}
7             virtual ~MixBase () { dcnt.c++; }
8             };
9              
10             class MixPluginA {
11             public:
12             int val;
13             MixPluginA () : val(0) {}
14             virtual ~MixPluginA () { dcnt.c++; }
15             };
16              
17             class MixPluginB {
18             public:
19             int val;
20             MixPluginB () : val(0) {}
21             virtual ~MixPluginB () { dcnt.c++; }
22             };
23              
24             namespace xs {
25              
26             template <> struct Typemap : TypemapObject {
27             static std::string package () { return "MyTest::MixBase"; }
28             };
29            
30             template <> struct Typemap : TypemapObject {
31             static std::string package () { return "MyTest::MixPluginA"; }
32             };
33            
34             template <> struct Typemap : TypemapObject {
35             static std::string package () { return "MyTest::MixPluginB"; }
36             };
37              
38             }
39              
40             MODULE = MyTest::Typemap::Object PACKAGE = MyTest::MixBase
41             PROTOTYPES: DISABLE
42              
43             MixBase* MixBase::new (int arg) {
44 9           if (!arg) XSRETURN_UNDEF;
45 5 50         RETVAL = new MixBase(arg);
46 5 100         }
47 4 50          
48             int MixBase::val (SV* newval = NULL) {
49 5 100         if (newval) THIS->val = SvIV(newval);
    50          
    0          
50 5           RETVAL = THIS->val;
51             }
52              
53             void MixBase::set_from (MixBase* other) {
54 2 100         if (other) THIS->val = other->val;
55             }
56              
57             void MixBase::DESTROY () {
58 4           dcnt.perl++;
59 4 50         Object(ST(0)).call_next_maybe(cv, &ST(1), items-1);
    50          
    50          
60 4 50         }
61              
62 0           int CLONE_SKIP (SV*) { RETVAL = 1; }
63              
64              
65             MODULE = MyTest::Typemap::Object PACKAGE = MyTest::MixPluginA
66             PROTOTYPES: DISABLE
67              
68             MixPluginA* MixPluginA::new (...) {
69 7           PROTO = Stash::from_name(CLASS).call_next(cv, &ST(1), items-1);
70 4 50         if (!PROTO.defined()) XSRETURN_UNDEF;
71 4 50         RETVAL = new MixPluginA();
    50          
    50          
72 4 100         }
73 3 50          
74             int MixPluginA::val_a (SV* newval = NULL) {
75 6 100         if (newval) THIS->val = SvIV(newval);
    50          
    0          
76 6           RETVAL = THIS->val;
77             }
78              
79             void MixPluginA::set_from (MixPluginA* other) {
80 2 50         Object(ST(0)).call_next(cv, &ST(1), items-1);
    50          
    50          
81 2 100         if (other) THIS->val = other->val;
82             }
83              
84             void MixPluginA::DESTROY () {
85 3           dcnt.perl++;
86 3 50         Object(ST(0)).call_next(cv, &ST(1), items-1);
    50          
    50          
87 3 50         }
88              
89              
90              
91             MODULE = MyTest::Typemap::Object PACKAGE = MyTest::MixPluginB
92             PROTOTYPES: DISABLE
93              
94             MixPluginB* MixPluginB::new (...) {
95 9           PROTO = Stash::from_name(CLASS).call_next(cv, &ST(1), items-1);
96 5 50         if (!PROTO.defined()) XSRETURN_UNDEF;
97 5 50         RETVAL = new MixPluginB();
    50          
    50          
98 5 100         }
99 4 50          
100             int MixPluginB::val_b (SV* newval = NULL) {
101 6 100         if (newval) THIS->val = SvIV(newval);
    50          
    0          
102 6           RETVAL = THIS->val;
103             }
104              
105             void MixPluginB::set_from (MixPluginB* other) {
106 3 50         Object(ST(0)).call_next(cv, &ST(1), items-1);
    50          
    100          
107 2 100         if (other) THIS->val = other->val;
108             }
109              
110             void MixPluginB::DESTROY () {
111 4           dcnt.perl++;
112 4 50         Object(ST(0)).call_next(cv, &ST(1), items-1);
    50          
    50          
113 4 50         }