xs/Module.xsi

filter: Statementstmt 82.6% 19 / 23 Branchbran 47.4% 37 / 78 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 55.4% 56 / 101 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« src/xs/xlog.h ↑ Summary src/xs/xlog.cc »
1 MODULE = XLog PACKAGE = XLog::Module
2 PROTOTYPES: DISABLE
3  
4 #// ->new($name, [$level])
5 #// ->new($name, $module, [$level])
6 Sv new (SV* cls, string name, Sv arg1 = {}, Sv arg2 = {}) {
7 24 --items;
8 Module* module;
9 24 ▶ if (items == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (items == 1) { 8 16 24
10 8 ▶ module = new Module(name);
Branch: 3 branches
BranchTrueFalseTotal
module = new Module(name); 8 0 8
module = new Module(name); 8 0 8
module = new Module(name); 0 0 0
11 }
12 16 ▶ else if (items == 2) {
Branch: 1 branch
BranchTrueFalseTotal
else if (items == 2) { 15 1 16
13 15 ▶ if (!arg1.defined() || arg1.is_object_ref()) module = new Module(name, xs::in<Module*>(arg1));
Branch: 8 branches
BranchTrueFalseTotal
if (!arg1.defined() || arg1.is_object_ref()) module = new Module(name, xs::in<Module*>(arg1)); 15 0 15
if (!arg1.defined() || arg1.is_object_ref()) module = new Module(name, xs::in<Module*>(arg1)); 13 2 15
if (!arg1.defined() || arg1.is_object_ref()) module = new Module(name, xs::in<Module*>(arg1)); 6 7 13
if (!arg1.defined() || arg1.is_object_ref()) module = new Module(name, xs::in<Module*>(arg1)); 8 7 15
if (!arg1.defined() || arg1.is_object_ref()) module = new Module(name, xs::in<Module*>(arg1)); 8 0 8
if (!arg1.defined() || arg1.is_object_ref()) module = new Module(name, xs::in<Module*>(arg1)); 8 0 8
if (!arg1.defined() || arg1.is_object_ref()) module = new Module(name, xs::in<Module*>(arg1)); 8 0 8
if (!arg1.defined() || arg1.is_object_ref()) module = new Module(name, xs::in<Module*>(arg1)); 0 0 0
14 7 ▶ else module = new Module(name, xs::in<Level>(arg1));
Branch: 4 branches
BranchTrueFalseTotal
else module = new Module(name, xs::in<Level>(arg1)); 7 0 7
else module = new Module(name, xs::in<Level>(arg1)); 7 0 7
else module = new Module(name, xs::in<Level>(arg1)); 7 0 7
else module = new Module(name, xs::in<Level>(arg1)); 0 0 0
15 } else {
16 1 ▶ module = new Module(name, xs::in<Module*>(arg1), xs::in<Level>(arg2));
Branch: 5 branches
BranchTrueFalseTotal
module = new Module(name, xs::in<Module*>(arg1), xs::in<Level>(arg2)); 1 0 1
module = new Module(name, xs::in<Module*>(arg1), xs::in<Level>(arg2)); 1 0 1
module = new Module(name, xs::in<Module*>(arg1), xs::in<Level>(arg2)); 1 0 1
module = new Module(name, xs::in<Module*>(arg1), xs::in<Level>(arg2)); 1 0 1
module = new Module(name, xs::in<Module*>(arg1), xs::in<Level>(arg2)); 0 0 0
17 }
18
19 // Module* has non-owning ptr typemap. In case of creating object from perl we must switch to "owning" behaviour
20 // so we need to hook sv destruction and delete the object if we created it in this method.
21 static Sv::payload_marker_t module_dtor_marker;
22 24 module_dtor_marker.svt_free = [](pTHX_ SV*, MAGIC* mg) {
23 19 ▶ delete (Module*)mg->mg_ptr;
Branch: 1 branch
BranchTrueFalseTotal
delete (Module*)mg->mg_ptr; 19 0 19
24 19 return 0;
25 };
26
27 24 ▶ Object o = xs::out(module, cls);
Branch: 2 branches
BranchTrueFalseTotal
Object o = xs::out(module, cls); 24 0 24
Object o = xs::out(module, cls); 24 0 24
28 24 ▶ o.payload_attach(module, &module_dtor_marker);
Branch: 1 branch
BranchTrueFalseTotal
o.payload_attach(module, &module_dtor_marker); 24 0 24
29
30 24 ▶ RETVAL = o.ref();
Branch: 2 branches
BranchTrueFalseTotal
RETVAL = o.ref(); 24 0 24
RETVAL = o.ref(); 24 0 24
31 }
32  
33 4 ▶string Module::name ()
Branch: 2 branches
BranchTrueFalseTotal
string Module::name () 4 0 4
string Module::name () 4 0 4
34  
35 5 Level Module::level ()
36 5 ▶ 
Branch: 2 branches
BranchTrueFalseTotal
5 0 5
5 0 5
37 0 ▶bool Module::passthrough ()
Branch: 1 branch
BranchTrueFalseTotal
bool Module::passthrough () 0 0 0
38  
39 2 void Module::set_level (Level level)
40  
41 4 ▶void Module::set_logger (ILoggerSP logger, bool passthrough = false)
Branch: 2 branches
BranchTrueFalseTotal
void Module::set_logger (ILoggerSP logger, bool passthrough = false) 4 0 4
void Module::set_logger (ILoggerSP logger, bool passthrough = false) 4 0 4
42  
43 2 ▶void Module::set_formatter (IFormatterSP formatter)
Branch: 2 branches
BranchTrueFalseTotal
void Module::set_formatter (IFormatterSP formatter) 2 0 2
void Module::set_formatter (IFormatterSP formatter) 2 0 2
44  
45 0 ILoggerSP Module::get_logger ()
46 0 ▶ 
Branch: 2 branches
BranchTrueFalseTotal
0 0 0
0 0 0
47 0 IFormatterSP Module::get_formatter ()
« src/xs/xlog.h ↑ Summary src/xs/xlog.cc »