File Coverage

/root/.cpan/build/URI-XS-2.1.2-0/clib/src/panda/uri/Strict.h
Criterion Covered Total %
statement 22 22 100.0
branch 92 254 36.2
condition n/a
subroutine n/a
pod n/a
total 114 276 41.3


line stmt bran cond sub pod time code
1             #pragma once
2             #include
3              
4             namespace panda { namespace uri {
5              
6 274 50         struct URIStrict : URI {
7 210           using URI::URI;
8             URIStrict (const URI& source) : URI(source) {}
9             };
10              
11             template
12 268 50         struct URI::Strict : URIStrict {
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
13             Strict () : URIStrict() {}
14 107 50         Strict (const string& source, int flags = 0) : URIStrict(source, flags) { strict_scheme(); }
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    100          
15             Strict (const URI& source) : URIStrict(source) { strict_scheme(); }
16              
17             using URI::assign;
18 6           void assign (const URI& source) override {
19 6           URI::assign(source);
20 6           strict_scheme();
21 4           }
22              
23             using URI::scheme;
24 14           void scheme (const string& scheme) override {
25 14           URI::scheme(scheme);
26 14           strict_scheme();
27 6           }
28              
29             protected:
30 4           void parse (const string& uristr) override {
31 4           URI::parse(uristr);
32 4           strict_scheme();
33 2           }
34              
35 160           void strict_scheme () {
36 160 50         if (!_scheme.length()) {
    50          
    50          
    50          
    100          
    50          
    50          
    100          
    100          
37 6 0         if (_host.length()) URI::scheme(TYPE1::default_scheme());
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    50          
    50          
    0          
    0          
    0          
    0          
    50          
    50          
    50          
    50          
38             }
39 154 50         else if (!scheme_info || (*(scheme_info->type_info) != typeid(TYPE1) && *(scheme_info->type_info) != typeid(TYPE2))) {
    50          
    0          
    50          
    50          
    50          
    0          
    50          
    50          
    50          
    0          
    50          
    50          
    50          
    0          
    50          
    50          
    50          
    0          
    50          
    50          
    100          
    50          
    100          
    50          
    100          
    50          
    50          
    50          
    100          
    50          
    100          
    50          
    100          
    100          
    100          
40 14 0         throw WrongScheme("URI: wrong scheme '" + _scheme + "' for " + typeid(TYPE1).name());
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    50          
    50          
    50          
    50          
    50          
    0          
    0          
    0          
    0          
    0          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
41             }
42 146           }
43             };
44              
45             }}