t/cookbook/recipe10.xsi

filter: Statementstmt 0.0% 0 / 11 Branchbran 0.0% 0 / 26 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 37 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« t/cookbook/recipe05.xsi ↑ Summary t/cookbook/recipe11.xsi »
1 MODE: INLINE
2  
3 #include <iostream>
4  
5 struct DateRecipe10;
6  
7 struct TimezoneRecipe10 {
8 const char* get_name() const { return name.c_str(); }
9 private:
10 TimezoneRecipe10(const char* name_): name{name_} { }
11 std::string name;
12 friend struct DateRecipe10;
13 };
14  
15 struct DateRecipe10 {
16 DateRecipe10(const char* tz_ = "Europe/Minsk"): tz(tz_) { update(); }
17 ~DateRecipe10() { std::cout << "~DateRecipe10()\n"; }
18 void update() { epoch = std::time(nullptr); }
19  
20 int get_epoch() const { return epoch; }
21 TimezoneRecipe10& get_timezone() { return tz; }
22 private:
23 std::time_t epoch;
24 TimezoneRecipe10 tz;
25 };
26  
27 namespace xs {
28 template <>
29 struct Typemap<DateRecipe10*> : TypemapObject<DateRecipe10*, DateRecipe10*, ObjectTypePtr, ObjectStorageMG> {
30 static std::string package () { return "MyTest::Cookbook::DateRecipe10"; }
31 };
32  
33 template <>
34 struct Typemap<TimezoneRecipe10*> : TypemapObject<TimezoneRecipe10*, TimezoneRecipe10*, ObjectTypeForeignPtr, ObjectStorageMG> {
35 static std::string package () { return "MyTest::Cookbook::TimezoneRecipe10"; }
36 };
37 };
38  
39 static xs::Sv::payload_marker_t payload_marker_10;
40  
41  
42 MODULE = MyTest::Cookbook PACKAGE = MyTest::Cookbook::TimezoneRecipe10
43 PROTOTYPES: DISABLE
44  
45 0 const char* TimezoneRecipe10::get_name()
46  
47 MODULE = MyTest::Cookbook PACKAGE = MyTest::Cookbook::DateRecipe10
48 PROTOTYPES: DISABLE
49  
50 0 DateRecipe10* DateRecipe10::new(const char* name)
51 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
0 0 0
52 0 ▶void DateRecipe10::update()
Branch: 4 branches
BranchTrueFalseTotal
void DateRecipe10::update() 0 0 0
void DateRecipe10::update() 0 0 0
void DateRecipe10::update() 0 0 0
void DateRecipe10::update() 0 0 0
53  
54 0 std::time_t DateRecipe10::get_epoch()
55 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
0 0 0
56 Sv DateRecipe10::get_timezone() {
57 0 ▶ Object self {ST(0)};
Branch: 1 branch
BranchTrueFalseTotal
Object self {ST(0)}; 0 0 0
58 0 ▶ Object tz = xs::out<>(&THIS->get_timezone());
Branch: 2 branches
BranchTrueFalseTotal
Object tz = xs::out<>(&THIS->get_timezone()); 0 0 0
Object tz = xs::out<>(&THIS->get_timezone()); 0 0 0
59 0 ▶ auto self_ref = Ref::create(self);
Branch: 1 branch
BranchTrueFalseTotal
auto self_ref = Ref::create(self); 0 0 0
60 0 ▶ tz.payload_attach(self_ref, &payload_marker_10);
Branch: 1 branch
BranchTrueFalseTotal
tz.payload_attach(self_ref, &payload_marker_10); 0 0 0
61 0 ▶ RETVAL = tz.ref();
Branch: 2 branches
BranchTrueFalseTotal
RETVAL = tz.ref(); 0 0 0
RETVAL = tz.ref(); 0 0 0
62 }
« t/cookbook/recipe05.xsi ↑ Summary t/cookbook/recipe11.xsi »