File Coverage

Error.xsi
Criterion Covered Total %
statement 39 58 67.2
branch 33 92 35.8
condition n/a
subroutine n/a
pod n/a
total 72 150 48.0


line stmt bran cond sub pod time code
1             MODE: INLINE
2              
3             void register_error_constants(); // regerror.cc, because fucking xsubpp removes preprocessor directives
4              
5             MODULE = XS::Framework PACKAGE = XS::STL::ErrorCode
6             PROTOTYPES: DISABLE
7              
8             BOOT {
9 36           register_error_constants();
10             }
11              
12             std::error_code new (SV*, int ec, const std::error_category* category) {
13 2           if (!category) throw "category required";
14 1 50         RETVAL = std::error_code(ec, *category);
15 1           }
16              
17             int value (std::error_code ec) {
18 126           RETVAL = ec.value();
19             }
20              
21             const std::error_category* category (std::error_code ec) {
22 4           RETVAL = &ec.category();
23 2           }
24              
25             std::string message (std::error_code ec) {
26 2 50         RETVAL = ec.message();
    50          
27             }
28              
29             std::string _op_string (std::error_code ec, ...) {
30 0 0         RETVAL = ec.message();
    0          
31 0 0         RETVAL += " (";
32 0 0         RETVAL += std::to_string(ec.value());
    0          
33 0 0         RETVAL += ":";
34 0 0         RETVAL += ec.category().name();
35 0 0         RETVAL += ")";
36             }
37              
38             bool _op_bool (std::error_code ec, ...) {
39 0           RETVAL = ec.value();
40             }
41              
42             bool _op_eq (std::error_code ec1, Sv sv_ec2, ...) {
43 65 100         if (sv_ec2.is_object_ref()) {
44 124 50         Object ec2 = sv_ec2;
45 62 50         auto class_name = ec2.stash().name();
46 62 50         if (class_name == "XS::ErrorCode") {
    50          
47 0 0         RETVAL = ec1 & xs::in(sv_ec2);
48 62 50         } else if (class_name == "XS::STL::ErrorCode") {
    50          
49 62 50         RETVAL = ec1 == xs::in(sv_ec2);
50             } else {
51 0           RETVAL = false;
52             }
53 3 100         } else if (SvIOK(sv_ec2)) {
54 2 50         int code = Simple(sv_ec2);
    50          
55 2           RETVAL = ec1.value() == code;
56             } else {
57 1           RETVAL = false;
58             }
59             }
60              
61             MODULE = XS::Framework PACKAGE = XS::STL::ErrorCategory
62             PROTOTYPES: DISABLE
63              
64 3           const char* std::error_category::name () : const
65              
66 0 0         std::string std::error_category::message (int ec) : const
    0          
67              
68             std::string std::error_category::_op_string (...) : const {
69 0 0         RETVAL = THIS->name();
70             }
71              
72             bool std::error_category::_op_eq (const std::error_category* oth, ...) : const {
73 3           RETVAL = *THIS == *oth;
74             }
75              
76             MODULE = XS::Framework PACKAGE = XS::ErrorCode
77             PROTOTYPES: DISABLE
78              
79             ErrorCode new (SV*, std::error_code c, ErrorCode next = ErrorCode()) {
80 0           if (next) RETVAL = ErrorCode(c, next);
81 0 0         else RETVAL = ErrorCode(c);
82 0           }
83              
84             int value (ErrorCode ec) {
85 2           RETVAL = ec.value();
86             }
87              
88             const std::error_category* category (ErrorCode ec) {
89 2           RETVAL = &ec.category();
90 1           }
91              
92             std::string message (ErrorCode ec) {
93 1 50         RETVAL = ec.message();
    50          
94             }
95              
96             std::error_code code (ErrorCode ec) {
97 2           RETVAL = ec.code();
98 1           }
99              
100             ErrorCode next (ErrorCode ec) {
101 2           RETVAL = ec.next();
102 1           }
103              
104             std::string _op_string (ErrorCode ec, ...) {
105 0 0         if (!ec) XSRETURN_UNDEF;
106 0 0         RETVAL = ec.what();
    0          
    0          
107             }
108              
109             bool _op_bool (ErrorCode ec, ...) {
110 0           RETVAL = ec.value();
111             }
112              
113             bool _op_eq (ErrorCode ec1, Sv sv_ec2, ...) {
114 8 100         if (sv_ec2.is_object_ref()) {
115 14 50         Object ec2 = sv_ec2;
116 7 50         auto class_name = ec2.stash().name();
117 7 50         if (class_name == "XS::ErrorCode") {
    100          
118 1 50         RETVAL = ec1 == xs::in(sv_ec2);
119 6 50         } else if (class_name == "XS::STL::ErrorCode") {
    50          
120 6 50         RETVAL = ec1 & xs::in(sv_ec2);
121             } else {
122 0           RETVAL = false;
123             }
124 1 50         } else if (SvIOK(sv_ec2)) {
125 1 50         int code = Simple(sv_ec2);
    50          
126 1           RETVAL = ec1.value() == code;
127             } else {
128 0           RETVAL = false;
129             }
130             }
131              
132             bool contains(ErrorCode ec, std::error_code c) {
133 1 50         RETVAL = ec.contains(c);
134             }
135              
136