src/xs/date.h

filter: Statementstmt 100% 3 / 3 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 71.4% 5 / 7 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« xs/main_xsgen.cc ↑ Summary xs/main.xs »
1 #pragma once
2 #include <xs.h>
3 #include <xs/Scope.h>
4 #include <panda/date.h>
5 #include <panda/time.h>
6  
7 namespace xs { namespace date {
8  
9 using namespace panda::date;
10 using namespace panda::time;
11  
12 extern panda::string_view strict_hint_name;
13  
14 62 inline bool is_strict_mode () { return Scope::Hints::exists(strict_hint_name); }
15  
16 Date sv2date (const Sv& arg, const TimezoneSP& zone = {}, int fmt = Date::InputFormat::all);
17 DateRel sv2daterel (const Sv& arg);
18  
19 }}
20  
21 namespace xs {
22  
23 template <> struct Typemap<const panda::time::Timezone*> : TypemapObject<const panda::time::Timezone*, const panda::time::Timezone*, ObjectTypeForeignPtr, ObjectStorageMG> {
24 static std::string package () { return "Date::Timezone"; }
25 };
26  
27 template <> struct Typemap<panda::time::TimezoneSP> : Typemap<const panda::time::Timezone*> {
28 using Super = Typemap<const panda::time::Timezone*>;
29  
30 static inline panda::time::TimezoneSP in (const Sv& arg) {
31 if (arg.is_object_ref()) return Super::in(arg);
32 if (!arg) return {};
33 if (!arg.is_true()) return panda::time::tzlocal();
34 return panda::time::tzget(xs::in<panda::string_view>(arg));
35 }
36 };
37  
38 template <class TYPE> struct Typemap<panda::date::Date*, TYPE> : TypemapObject<panda::date::Date*, TYPE, ObjectTypePtr, ObjectStorageMG> {
39 132 ▶ static std::string package () { return "Date"; }
Branch: 1 branch
BranchTrueFalseTotal
static std::string package () { return "Date"; } 44 0 44
40 };
41  
42 template <> struct Typemap<panda::date::Date> : TypemapBase<panda::date::Date> {
43 static inline panda::date::Date in (const Sv& arg) { return xs::date::sv2date(arg); }
44 static inline Sv out (const panda::date::Date& v, const Sv& proto = Sv()) { return xs::out(new panda::date::Date(v), proto); }
45 };
46  
47 template <class TYPE> struct Typemap<panda::date::DateRel*, TYPE*> : TypemapObject<panda::date::DateRel*, TYPE*, ObjectTypePtr, ObjectStorageMG> {
48 318 ▶ static std::string package () { return "Date::Rel"; }
Branch: 1 branch
BranchTrueFalseTotal
static std::string package () { return "Date::Rel"; } 106 0 106
49 };
50  
51 template <> struct Typemap<panda::date::DateRel> : TypemapBase<panda::date::DateRel> {
52 static inline panda::date::DateRel in (const Sv& arg) { return xs::date::sv2daterel(arg); }
53 static inline Sv out (const panda::date::DateRel& v, const Sv& proto = Sv()) { return xs::out(new panda::date::DateRel(v), proto); }
54 };
55  
56 }
« xs/main_xsgen.cc ↑ Summary xs/main.xs »