| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#pragma once |
|
2
|
|
|
|
|
|
|
#include "object.h" |
|
3
|
|
|
|
|
|
|
#include "../Object.h" |
|
4
|
|
|
|
|
|
|
#include |
|
5
|
|
|
|
|
|
|
#include |
|
6
|
|
|
|
|
|
|
#include |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
namespace xs { |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
template <> struct Typemap : TypemapObject { |
|
11
|
|
|
|
|
|
|
static panda::string_view package () { return "XS::STL::ErrorCategory"; } |
|
12
|
|
|
|
|
|
|
}; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
template <> struct Typemap : TypemapBase { |
|
15
|
|
|
|
|
|
|
static HV* stash(); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
static std::error_code in (const Sv& arg) { |
|
18
|
|
|
|
|
|
|
if (!arg.defined()) return {}; |
|
19
|
|
|
|
|
|
|
SV* sv = SvROK(arg) ? SvRV(arg) : arg.get(); |
|
20
|
|
|
|
|
|
|
if (!SvOBJECT(sv)) throw panda::exception("invalid std::error_code"); |
|
21
|
|
|
|
|
|
|
if (!SvPOK(sv) || SvCUR(sv) < sizeof(std::error_code)) throw panda::exception("invalid std::error_code"); |
|
22
|
|
|
|
|
|
|
return *((std::error_code*)SvPVX(sv)); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
static Sv out (const std::error_code& var, const Sv& = {}) { |
|
26
|
0
|
0
|
|
|
|
|
if (!var) return Sv::undef; |
|
|
|
0
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
auto base = Simple(panda::string_view(reinterpret_cast(&var), sizeof(var))); |
|
28
|
0
|
0
|
|
|
|
|
return Stash(stash()).bless(base).ref(); |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
}; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
template <> struct Typemap : TypemapObject { |
|
33
|
|
|
|
|
|
|
static panda::string_view package () { return "XS::ErrorCode"; } |
|
34
|
|
|
|
|
|
|
}; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
template <> struct Typemap : Typemap { |
|
37
|
|
|
|
|
|
|
using Super = Typemap; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
static panda::ErrorCode in (const Sv& arg) { |
|
40
|
|
|
|
|
|
|
if (!arg.defined()) return {}; |
|
41
|
|
|
|
|
|
|
if (!arg.is_object_ref()) throw panda::exception("invalid XS::ErrorCode object"); |
|
42
|
|
|
|
|
|
|
if (Object(arg).stash() == Typemap::stash()) return xs::in(arg); |
|
43
|
|
|
|
|
|
|
return *Super::in(arg); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
static Sv out (const panda::ErrorCode& var, const Sv& proto = {}) { |
|
47
|
|
|
|
|
|
|
if (!var) return Sv::undef; |
|
48
|
|
|
|
|
|
|
return Super::out(new panda::ErrorCode(var), proto); |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
}; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} |