File Coverage

/usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/XS/Framework.x/i/xs/typemap/string.h
Criterion Covered Total %
statement 9 9 100.0
branch 7 14 50.0
condition n/a
subroutine n/a
pod n/a
total 16 23 69.5


line stmt bran cond sub pod time code
1             #pragma once
2             #include "base.h"
3             #include "../Simple.h"
4             #include
5             #include
6             #include
7              
8             namespace xs {
9              
10             template <> struct Typemap : TypemapBase {
11 8           static inline panda::string in (SV* arg) {
12             STRLEN len;
13 8 100         const char* data = SvPV_nomg(arg, len);
    50          
14 8 50         return panda::string(data, len);
15             }
16 149 50         static inline Sv out (const panda::string& str, const Sv& = Sv()) { return Simple(str); }
17             };
18              
19             template <> struct Typemap : TypemapBase {
20             static inline std::string in (SV* arg) {
21             STRLEN len;
22             const char* data = SvPV_nomg(arg, len);
23             return std::string(data, len);
24             }
25 129 50         static inline Sv out (const std::string& str, const Sv& = Sv()) { return Simple(panda::string_view(str.data(), str.length())); }
26             };
27              
28             template <> struct Typemap : TypemapBase {
29 29           static inline panda::string_view in (SV* arg) {
30             STRLEN len;
31 29 50         const char* data = SvPV_nomg(arg, len);
    0          
32 29           return panda::string_view(data, len);
33             }
34 532           static inline Sv out (const panda::string_view& str, const Sv& = Sv()) { return Simple(str); }
35             };
36              
37             }