t/cookbook/recipe05.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/recipe04.xsi ↑ Summary t/cookbook/recipe10.xsi »
1 MODE: INLINE
2  
3 #include <iostream>
4  
5 struct TimezoneRecipe05: public panda::Refcnt {
6 const char* get_name() const { return name.c_str(); }
7 TimezoneRecipe05(const char* name_): name{name_} { }
8 ~TimezoneRecipe05() { std::cout << "~TimezoneRecipe05()\n"; }
9 private:
10 std::string name;
11 };
12  
13 using TimezoneRecipe05SP = panda::iptr<TimezoneRecipe05>;
14  
15 struct DateRecipe05 {
16 DateRecipe05() { update() ; }
17 void update() { epoch = std::time(nullptr); }
18  
19 int get_epoch() const { return epoch; }
20 void set_timezone(TimezoneRecipe05SP tz_) { tz = tz_; }
21 TimezoneRecipe05SP get_timezone() { return tz; }
22 private:
23 std::time_t epoch;
24 TimezoneRecipe05SP tz;
25 };
26  
27  
28 namespace xs {
29 template <>
30 struct Typemap<TimezoneRecipe05*> : TypemapObject<TimezoneRecipe05*, TimezoneRecipe05*, ObjectTypeRefcntPtr, ObjectStorageMG, StaticCast> {
31 static std::string package () { return "MyTest::Cookbook::TimezoneRecipe05"; }
32 };
33 }
34  
35 namespace xs {
36 template <>
37 struct Typemap<DateRecipe05*> : TypemapObject<DateRecipe05*, DateRecipe05*, ObjectTypePtr, ObjectStorageMG, StaticCast> {
38 static std::string package () { return "MyTest::Cookbook::DateRecipe05"; }
39 };
40 }
41  
42  
43 MODULE = MyTest::Cookbook PACKAGE = MyTest::Cookbook::TimezoneRecipe05
44 PROTOTYPES: DISABLE
45  
46 0 const char* TimezoneRecipe05::get_name() { RETVAL = THIS->get_name(); }
47  
48 0 TimezoneRecipe05SP create(const char* name) { RETVAL = TimezoneRecipe05SP(new TimezoneRecipe05(name)); }
49 0 ▶ 
Branch: 4 branches
BranchTrueFalseTotal
0 0 0
0 0 0
0 0 0
0 0 0
50 MODULE = MyTest::Cookbook PACKAGE = MyTest::Cookbook::DateRecipe05
51 PROTOTYPES: DISABLE
52  
53 0 DateRecipe05* DateRecipe05::new() { RETVAL = new DateRecipe05(); }
54 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
0 0 0
55 0 ▶void DateRecipe05::update()
Branch: 4 branches
BranchTrueFalseTotal
void DateRecipe05::update() 0 0 0
void DateRecipe05::update() 0 0 0
void DateRecipe05::update() 0 0 0
void DateRecipe05::update() 0 0 0
56  
57 0 std::time_t DateRecipe05::get_epoch()
58 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
0 0 0
59 0 TimezoneRecipe05SP DateRecipe05::get_timezone()
60 0 ▶ 
Branch: 2 branches
BranchTrueFalseTotal
0 0 0
0 0 0
61 0 ▶void DateRecipe05::set_timezone(TimezoneRecipe05SP tz)
Branch: 1 branch
BranchTrueFalseTotal
void DateRecipe05::set_timezone(TimezoneRecipe05SP tz) 0 0 0
« t/cookbook/recipe04.xsi ↑ Summary t/cookbook/recipe10.xsi »