line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#pragma once |
2
|
|
|
|
|
|
|
#include |
3
|
|
|
|
|
|
|
#include |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
namespace xs { |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
using xs::my_perl; |
8
|
|
|
|
|
|
|
|
9
|
0
|
|
|
|
|
|
struct Scalar : Sv { |
10
|
|
|
|
|
|
|
static const Scalar undef; |
11
|
|
|
|
|
|
|
static const Scalar yes; |
12
|
|
|
|
|
|
|
static const Scalar no; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
static Scalar create () { return Scalar(newSV(0), NONE); } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
static Scalar noinc (SV* val) { return Scalar(val, NONE); } |
17
|
|
|
|
|
|
|
static Scalar noinc (GV* val) { return Scalar(val, NONE); } |
18
|
|
|
|
|
|
|
|
19
|
13818
|
|
|
|
|
|
Scalar (std::nullptr_t = nullptr) {} |
20
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
Scalar (SV* sv, bool policy = INCREMENT) : Sv(sv, policy) { _validate(); } |
22
|
|
|
|
|
|
|
Scalar (GV* sv, bool policy = INCREMENT) : Sv(sv, policy) {} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Scalar (const Scalar& oth) : Sv(oth) {} |
25
|
|
|
|
|
|
|
Scalar (Scalar&& oth) : Sv(std::move(oth)) {} |
26
|
210
|
|
|
|
|
|
Scalar (const Sv& oth) : Scalar(oth.get()) {} |
27
|
|
|
|
|
|
|
Scalar (Sv&& oth) : Sv(std::move(oth)) { _validate(); } |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Scalar (const Array&) = delete; |
30
|
|
|
|
|
|
|
Scalar (const Hash&) = delete; |
31
|
|
|
|
|
|
|
Scalar (const Sub&) = delete; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Scalar& operator= (SV* val) { |
34
|
|
|
|
|
|
|
Sv::operator=(val); |
35
|
|
|
|
|
|
|
_validate(); |
36
|
|
|
|
|
|
|
return *this; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Scalar& operator= (GV* val) { |
40
|
|
|
|
|
|
|
Sv::operator=(val); |
41
|
|
|
|
|
|
|
return *this; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Scalar& operator= (const Scalar& oth) { |
45
|
|
|
|
|
|
|
Sv::operator=(oth.sv); |
46
|
|
|
|
|
|
|
return *this; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Scalar& operator= (Scalar&& oth) { |
50
|
|
|
|
|
|
|
Sv::operator=(std::move(oth)); |
51
|
|
|
|
|
|
|
return *this; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Scalar& operator= (const Sv& oth) { return operator=(oth.get()); } |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Scalar& operator= (Sv&& oth) { |
57
|
|
|
|
|
|
|
Sv::operator=(std::move(oth)); |
58
|
|
|
|
|
|
|
_validate(); |
59
|
|
|
|
|
|
|
return *this; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Scalar& operator= (const Array&) = delete; |
63
|
|
|
|
|
|
|
Scalar& operator= (const Hash&) = delete; |
64
|
|
|
|
|
|
|
Scalar& operator= (const Sub&) = delete; |
65
|
|
|
|
|
|
|
|
66
|
652
|
|
|
|
|
|
void set (SV* val) { Sv::operator=(val); } |
67
|
|
|
|
|
|
|
void set (GV* val) { Sv::operator=(val); } |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
operator AV* () const = delete; |
70
|
|
|
|
|
|
|
operator HV* () const = delete; |
71
|
|
|
|
|
|
|
operator CV* () const = delete; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
template panda::enable_if_one_of_t* get () const { return (T*)sv; } |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
void upgrade (svtype type) { |
76
|
|
|
|
|
|
|
if (type > SVt_PVMG && type != SVt_PVGV) throw std::logic_error("can't upgrade Scalar to something bigger than PVMG (and != PVGV)"); |
77
|
|
|
|
|
|
|
Sv::upgrade(type); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
template T as_string () const; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
template T as_number () const; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
static void __at_perl_destroy (); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
private: |
87
|
180
|
|
|
|
|
|
void _validate () { |
88
|
180
|
50
|
|
|
|
|
if (!sv) return; |
89
|
180
|
50
|
|
|
|
|
if (is_scalar_unsafe()) return; |
90
|
0
|
|
|
|
|
|
reset(); |
91
|
180
|
0
|
|
|
|
|
throw std::invalid_argument("wrong SV* type for Scalar"); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
}; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
} |