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
|
16
|
|
|
|
|
|
struct KeyProxy : Scalar { |
9
|
8
|
50
|
|
|
|
|
KeyProxy (SV** ptr, bool nullok) : Scalar(), ptr(ptr), nullok(nullok) { set(*ptr); } |
10
|
|
|
|
|
|
|
KeyProxy (const KeyProxy&) = default; |
11
|
|
|
|
|
|
|
KeyProxy (KeyProxy&&) = default; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
KeyProxy& operator= (std::nullptr_t) { return operator=(Scalar()); } |
14
|
|
|
|
|
|
|
KeyProxy& operator= (const KeyProxy& v) { return operator=((Scalar)v); } |
15
|
|
|
|
|
|
|
KeyProxy& operator= (const Scalar& val) { |
16
|
|
|
|
|
|
|
Scalar::operator=(val); |
17
|
|
|
|
|
|
|
SV* newsv = val; |
18
|
|
|
|
|
|
|
if (nullok || newsv) SvREFCNT_inc_simple_void(newsv); |
19
|
|
|
|
|
|
|
else newsv = newSV(0); |
20
|
|
|
|
|
|
|
auto old = *ptr; |
21
|
|
|
|
|
|
|
*ptr = newsv; |
22
|
|
|
|
|
|
|
SvREFCNT_dec(old); |
23
|
|
|
|
|
|
|
return *this; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
KeyProxy& operator= (SV* v) { return operator=(Scalar(v)); } |
26
|
|
|
|
|
|
|
KeyProxy& operator= (const Sv& v) { return operator=(Scalar(v)); } |
27
|
|
|
|
|
|
|
KeyProxy& operator= (const Array&) = delete; |
28
|
|
|
|
|
|
|
KeyProxy& operator= (const Hash&) = delete; |
29
|
|
|
|
|
|
|
KeyProxy& operator= (const Sub&) = delete; |
30
|
|
|
|
|
|
|
KeyProxy& operator= (const Io&) = delete; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
template > |
33
|
|
|
|
|
|
|
KeyProxy operator[] (T key) { return _geti(key); } |
34
|
|
|
|
|
|
|
KeyProxy operator[] (const panda::string_view& key); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
private: |
37
|
|
|
|
|
|
|
SV** ptr; |
38
|
|
|
|
|
|
|
bool nullok; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
KeyProxy _geti (size_t key); |
41
|
|
|
|
|
|
|
}; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
} |