| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | #pragma once | 
| 2 |  |  |  |  |  |  | #include | 
| 3 |  |  |  |  |  |  | #include | 
| 4 |  |  |  |  |  |  | #include | 
| 5 |  |  |  |  |  |  | #include | 
| 6 |  |  |  |  |  |  | #include | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | namespace xs { | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | using xs::my_perl; | 
| 11 |  |  |  |  |  |  |  | 
| 12 | 182 |  |  |  |  |  | struct Glob : Scalar { | 
| 13 |  |  |  |  |  |  | static Glob create (const Stash& stash, panda::string_view name, U32 flags = 0); | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | Glob (std::nullptr_t = nullptr) {} | 
| 16 |  |  |  |  |  |  | Glob (SV* sv, bool policy = INCREMENT) : Scalar(sv, policy) { _validate(); } | 
| 17 |  |  |  |  |  |  | Glob (GV* sv, bool policy = INCREMENT) : Scalar(sv, policy) {} | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | Glob (const Glob&   oth) : Scalar(oth)            {} | 
| 20 |  |  |  |  |  |  | Glob (Glob&&        oth) : Scalar(std::move(oth)) {} | 
| 21 |  |  |  |  |  |  | Glob (const Scalar& oth) : Scalar(oth)            { _validate(); } | 
| 22 |  |  |  |  |  |  | Glob (Scalar&&      oth) : Scalar(std::move(oth)) { _validate(); } | 
| 23 |  |  |  |  |  |  | Glob (const Sv&     oth) : Scalar(oth)            { _validate(); } | 
| 24 |  |  |  |  |  |  | Glob (Sv&&          oth) : Scalar(std::move(oth)) { _validate(); } | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | Glob (const Simple&) = delete; | 
| 27 |  |  |  |  |  |  | Glob (const Ref&)    = delete; | 
| 28 |  |  |  |  |  |  | Glob (const Array&)  = delete; | 
| 29 |  |  |  |  |  |  | Glob (const Hash&)   = delete; | 
| 30 |  |  |  |  |  |  | Glob (const Sub&)    = delete; | 
| 31 |  |  |  |  |  |  | Glob (const Io&)     = delete; | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | Glob& operator= (SV* val)           { Scalar::operator=(val); _validate(); return *this; } | 
| 34 |  |  |  |  |  |  | Glob& operator= (GV* val)           { Scalar::operator=(val); return *this; } | 
| 35 |  |  |  |  |  |  | Glob& operator= (const Glob& oth)   { Scalar::operator=(oth); return *this; } | 
| 36 |  |  |  |  |  |  | Glob& operator= (Glob&& oth)        { Scalar::operator=(std::move(oth)); return *this; } | 
| 37 |  |  |  |  |  |  | Glob& operator= (const Scalar& oth) { Scalar::operator=(oth); _validate(); return *this; } | 
| 38 |  |  |  |  |  |  | Glob& operator= (Scalar&& oth)      { Scalar::operator=(std::move(oth)); _validate(); return *this; } | 
| 39 |  |  |  |  |  |  | Glob& operator= (const Sv& oth)     { return operator=(oth.get()); } | 
| 40 |  |  |  |  |  |  | Glob& operator= (Sv&& oth)          { Sv::operator=(std::move(oth)); _validate(); return *this; } | 
| 41 |  |  |  |  |  |  | Glob& operator= (const Simple&)     = delete; | 
| 42 |  |  |  |  |  |  | Glob& operator= (const Ref&)        = delete; | 
| 43 |  |  |  |  |  |  | Glob& operator= (const Array&)      = delete; | 
| 44 |  |  |  |  |  |  | Glob& operator= (const Hash&)       = delete; | 
| 45 |  |  |  |  |  |  | Glob& operator= (const Sub&)        = delete; | 
| 46 |  |  |  |  |  |  | Glob& operator= (const Io&)         = delete; | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | void set (SV* val) { Sv::operator=(val); } | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | operator AV* () const = delete; | 
| 51 |  |  |  |  |  |  | operator HV* () const = delete; | 
| 52 |  |  |  |  |  |  | operator CV* () const = delete; | 
| 53 |  |  |  |  |  |  | operator IO* () const = delete; | 
| 54 |  |  |  |  |  |  | operator GV* () const { return (GV*)sv; } | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | GV* operator->() const { return (GV*)sv; } | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | template  panda::enable_if_one_of_t* get () const { return (T*)sv; } | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | template  panda::enable_if_one_of_t slot () const; | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | Scalar scalar () const { return sv ? GvSV((GV*)sv) : nullptr; } | 
| 63 |  |  |  |  |  |  | Array  array  () const { return sv ? GvAV((GV*)sv) : nullptr; } | 
| 64 |  |  |  |  |  |  | Hash   hash   () const { return sv ? GvHV((GV*)sv) : nullptr; } | 
| 65 |  |  |  |  |  |  | Sub    sub    () const { return sv ? GvCV((GV*)sv) : nullptr; } | 
| 66 |  |  |  |  |  |  | Io     io     () const { return sv ? GvIO((GV*)sv) : nullptr; } | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | void slot (SV*); | 
| 69 |  |  |  |  |  |  | void slot (AV*); | 
| 70 |  |  |  |  |  |  | void slot (HV*); | 
| 71 |  |  |  |  |  |  | void slot (CV*); | 
| 72 |  |  |  |  |  |  | void slot (IO*); | 
| 73 |  |  |  |  |  |  | void slot (const Scalar&); | 
| 74 |  |  |  |  |  |  | void slot (const Sv&     v) { slot(v.get()); } | 
| 75 |  |  |  |  |  |  | void slot (const Array&  v) { slot(v.get()); } | 
| 76 |  |  |  |  |  |  | void slot (const Hash&   v) { slot(v.get()); } | 
| 77 |  |  |  |  |  |  | void slot (const Sub&    v) { slot(v.get()); } | 
| 78 |  |  |  |  |  |  | void slot (const Io&     v) { slot(v.get()); } | 
| 79 |  |  |  |  |  |  | void slot (GV*)             = delete; | 
| 80 |  |  |  |  |  |  | void slot (const Glob&)     = delete; | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | void scalar (const Scalar& val) { slot(val); } | 
| 83 |  |  |  |  |  |  | void array  (const Array&  val) { slot(val); } | 
| 84 |  |  |  |  |  |  | void hash   (const Hash&   val) { slot(val); } | 
| 85 |  |  |  |  |  |  | void sub    (const Sub&    val) { slot(val); } | 
| 86 |  |  |  |  |  |  | void io     (const Io&     val) { slot(val); } | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | Sv get_const () const { return gv_const_sv((GV*)sv); } | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | panda::string_view name           () const { return panda::string_view(GvNAME((GV*)sv), GvNAMELEN((GV*)sv)); } | 
| 91 |  |  |  |  |  |  | panda::string_view effective_name () const { return panda::string_view(GvENAME((GV*)sv), GvENAMELEN((GV*)sv)); } | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | Stash stash           () const; | 
| 94 |  |  |  |  |  |  | Stash effective_stash () const; | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | private: | 
| 97 |  |  |  |  |  |  | void _validate () { | 
| 98 |  |  |  |  |  |  | if (!sv) return; | 
| 99 |  |  |  |  |  |  | if (type() == SVt_PVGV) return; | 
| 100 |  |  |  |  |  |  | if (SvROK(sv)) { | 
| 101 |  |  |  |  |  |  | SV* val = SvRV(sv); | 
| 102 |  |  |  |  |  |  | if (SvTYPE(val) == SVt_PVGV) { | 
| 103 |  |  |  |  |  |  | Sv::operator=(val); | 
| 104 |  |  |  |  |  |  | return; | 
| 105 |  |  |  |  |  |  | } | 
| 106 |  |  |  |  |  |  | } | 
| 107 |  |  |  |  |  |  | if (is_undef()) return reset(); | 
| 108 |  |  |  |  |  |  | reset(); | 
| 109 |  |  |  |  |  |  | throw std::invalid_argument("SV is not a Glob or Glob reference"); | 
| 110 |  |  |  |  |  |  | } | 
| 111 |  |  |  |  |  |  | }; | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | template <> inline Scalar Glob::slot () const { return scalar(); } | 
| 114 |  |  |  |  |  |  | template <> inline Array  Glob::slot  () const { return array(); } | 
| 115 |  |  |  |  |  |  | template <> inline Hash   Glob::slot   () const { return hash(); } | 
| 116 |  |  |  |  |  |  | template <> inline Sub    Glob::slot    () const { return sub(); } | 
| 117 |  |  |  |  |  |  | template <> inline Io     Glob::slot     () const { return io(); } | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | } |