File Coverage

/root/.cpan/build/URI-XS-2.1.2-0/clib/src/panda/uri/encode.h
Criterion Covered Total %
statement 12 12 100.0
branch 1 2 50.0
condition n/a
subroutine n/a
pod n/a
total 13 14 92.8


line stmt bran cond sub pod time code
1             #pragma once
2             #include
3              
4             namespace panda { namespace uri {
5              
6             struct URIComponent {
7             static const char scheme[256];
8             static const char user_info[256];
9             static const char host[256];
10             static const char path[256];
11             static const char path_segment[256];
12             static const char query[256];
13             static const char query_param[256];
14             static const char query_param_plus[256];
15             static const char fragment[256];
16             };
17              
18             size_t encode_uri_component (const string_view src, char* dest, const char* component = URIComponent::query_param);
19             size_t decode_uri_component (const string_view src, char* dest);
20              
21 4           inline void encode_uri_component (const string_view src, string& dest, const char* component = URIComponent::query_param) {
22 4           size_t final_size = encode_uri_component(src, dest.reserve(src.length()*3), component);
23 4           dest.length(final_size);
24 4           }
25              
26 7           inline void decode_uri_component (const string_view src, string& dest) {
27 7           size_t final_size = decode_uri_component(src, dest.reserve(src.length()));
28 7           dest.length(final_size);
29 7           }
30              
31             inline string encode_uri_component (const string_view src, const char* component = URIComponent::query_param) {
32             string ret;
33             encode_uri_component(src, ret, component);
34             return ret;
35             }
36              
37 7           inline string decode_uri_component (const string_view src) {
38 7           string ret;
39 7 50         decode_uri_component(src, ret);
40 7           return ret;
41             }
42              
43             }}