line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#pragma once |
2
|
|
|
|
|
|
|
#include |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
namespace xs { |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
struct Sub; struct Hash; struct Array; |
7
|
|
|
|
|
|
|
|
8
|
638
|
|
|
|
|
|
struct KeyProxy : Scalar { |
9
|
319
|
50
|
|
|
|
|
KeyProxy (SV** ptr, bool nullok) : Scalar(), ptr(ptr), nullok(nullok) { set(*ptr); } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
KeyProxy& operator= (std::nullptr_t) { return operator=(Scalar()); } |
12
|
|
|
|
|
|
|
KeyProxy& operator= (const KeyProxy& v) { return operator=((Scalar)v); } |
13
|
|
|
|
|
|
|
KeyProxy& operator= (const Scalar& val) { |
14
|
|
|
|
|
|
|
Scalar::operator=(val); |
15
|
|
|
|
|
|
|
SV* newsv = val; |
16
|
|
|
|
|
|
|
if (nullok || newsv) SvREFCNT_inc_simple_void(newsv); |
17
|
|
|
|
|
|
|
else newsv = newSV(0); |
18
|
|
|
|
|
|
|
auto old = *ptr; |
19
|
|
|
|
|
|
|
*ptr = newsv; |
20
|
|
|
|
|
|
|
SvREFCNT_dec(old); |
21
|
|
|
|
|
|
|
return *this; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
KeyProxy& operator= (SV* v) { return operator=(Scalar(v)); } |
24
|
|
|
|
|
|
|
KeyProxy& operator= (const Sv& v) { return operator=(Scalar(v)); } |
25
|
|
|
|
|
|
|
KeyProxy& operator= (const Array&) = delete; |
26
|
|
|
|
|
|
|
KeyProxy& operator= (const Hash&) = delete; |
27
|
|
|
|
|
|
|
KeyProxy& operator= (const Sub&) = delete; |
28
|
|
|
|
|
|
|
KeyProxy& operator= (const Io&) = delete; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
template > |
31
|
|
|
|
|
|
|
KeyProxy operator[] (T key) { return _geti(key); } |
32
|
|
|
|
|
|
|
KeyProxy operator[] (const panda::string_view& key); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
private: |
35
|
|
|
|
|
|
|
SV** ptr; |
36
|
|
|
|
|
|
|
bool nullok; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
KeyProxy _geti (size_t key); |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
} |