t/cookbook/recipe11.xsi

filter: Statementstmt 0.0% 0 / 7 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 19 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« t/cookbook/recipe10.xsi ↑ Summary t/cookbook/recipe13.xsi »
1 MODE: INLINE
2  
3 struct DateRecipe11;
4  
5 struct TimezoneRecipe11: public panda::Refcnt {
6 const char* get_name() const { return name.c_str(); }
7 private:
8 TimezoneRecipe11(const char* name_): name{name_} { }
9 std::string name;
10 friend struct DateRecipe11;
11 };
12  
13 using TimezoneRecipe11SP = panda::iptr<TimezoneRecipe11>;
14  
15 struct DateRecipe11: public panda::Refcnt {
16 DateRecipe11(const char* tz_ = "Europe/Minsk"): tz(new TimezoneRecipe11(tz_)) { update(); }
17 void update() { epoch = std::time(nullptr); }
18  
19 int get_epoch() const { return epoch; }
20 TimezoneRecipe11SP get_timezone() { return tz; }
21 private:
22 std::time_t epoch;
23 TimezoneRecipe11SP tz;
24 };
25  
26 namespace xs {
27 template <>
28 struct Typemap<DateRecipe11*> : TypemapObject<DateRecipe11*, DateRecipe11*, ObjectTypeRefcntPtr, ObjectStorageMG> {
29 static std::string package () { return "MyTest::Cookbook::DateRecipe11"; }
30 };
31  
32 template <>
33 struct Typemap<TimezoneRecipe11*> : TypemapObject<TimezoneRecipe11*, TimezoneRecipe11*, ObjectTypeRefcntPtr, ObjectStorageMG> {
34 static std::string package () { return "MyTest::Cookbook::TimezoneRecipe11"; }
35 };
36 };
37  
38 MODULE = MyTest::Cookbook PACKAGE = MyTest::Cookbook::TimezoneRecipe11
39 PROTOTYPES: DISABLE
40  
41 0 const char* TimezoneRecipe11::get_name()
42  
43 MODULE = MyTest::Cookbook PACKAGE = MyTest::Cookbook::DateRecipe11
44 PROTOTYPES: DISABLE
45  
46 0 DateRecipe11* DateRecipe11::new(const char* name)
47 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
0 0 0
48 0 ▶void DateRecipe11::update()
Branch: 4 branches
BranchTrueFalseTotal
void DateRecipe11::update() 0 0 0
void DateRecipe11::update() 0 0 0
void DateRecipe11::update() 0 0 0
void DateRecipe11::update() 0 0 0
49  
50 0 std::time_t DateRecipe11::get_epoch()
51 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
0 0 0
52 0 TimezoneRecipe11SP DateRecipe11::get_timezone()
« t/cookbook/recipe10.xsi ↑ Summary t/cookbook/recipe13.xsi »