File Coverage

src/panda/uri/Strict.h
Criterion Covered Total %
statement 22 22 100.0
branch 91 254 35.8
condition n/a
subroutine n/a
pod n/a
total 113 276 40.9


line stmt bran cond sub pod time code
1             #pragma once
2             #include
3              
4             namespace panda { namespace uri {
5              
6 72 50         struct URIStrict : URI {
7             using URI::URI;
8 38           URIStrict (const URI& source) : URI(source) {}
9             };
10              
11             template
12 70 50         struct URI::Strict : URIStrict {
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
13             Strict () : URIStrict() {}
14             Strict (const string& source, int flags = 0) : URIStrict(source, flags) { strict_scheme(); }
15 19 50         Strict (const URI& source) : URIStrict(source) { strict_scheme(); }
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
16              
17             using URI::assign;
18 3           void assign (const URI& source) override {
19 3           URI::assign(source);
20 3           strict_scheme();
21 2           }
22              
23             using URI::scheme;
24 8           void scheme (const string& scheme) override {
25 8           URI::scheme(scheme);
26 8           strict_scheme();
27 3           }
28              
29             protected:
30 2           void parse (const string& uristr) override {
31 2           URI::parse(uristr);
32 2           strict_scheme();
33 1           }
34              
35 49           void strict_scheme () {
36 49 50         if (!_scheme.length()) {
    50          
    50          
    50          
    100          
    50          
    50          
    100          
    100          
37 3 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 46 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 8 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 41           }
43             };
44              
45             }}