Ada
3.4.3
Fast spec-compliant URL parser
Toggle main menu visibility
Loading...
Searching...
No Matches
url_components.cpp
Go to the documentation of this file.
1
#include "
ada/helpers.h
"
2
#include "
ada/url_components-inl.h
"
3
4
#include <iterator>
5
#include <string>
6
7
namespace
ada
{
8
9
[[nodiscard]] std::string
url_components::to_string
()
const
{
10
std::string answer;
11
auto
back = std::back_insert_iterator(answer);
12
answer.append(
"{\n"
);
13
14
answer.append(
"\t\"protocol_end\":\""
);
15
helpers::encode_json(std::to_string(
protocol_end
), back);
16
answer.append(
"\",\n"
);
17
18
answer.append(
"\t\"username_end\":\""
);
19
helpers::encode_json(std::to_string(
username_end
), back);
20
answer.append(
"\",\n"
);
21
22
answer.append(
"\t\"host_start\":\""
);
23
helpers::encode_json(std::to_string(
host_start
), back);
24
answer.append(
"\",\n"
);
25
26
answer.append(
"\t\"host_end\":\""
);
27
helpers::encode_json(std::to_string(
host_end
), back);
28
answer.append(
"\",\n"
);
29
30
answer.append(
"\t\"port\":\""
);
31
helpers::encode_json(std::to_string(
port
), back);
32
answer.append(
"\",\n"
);
33
34
answer.append(
"\t\"pathname_start\":\""
);
35
helpers::encode_json(std::to_string(
pathname_start
), back);
36
answer.append(
"\",\n"
);
37
38
answer.append(
"\t\"search_start\":\""
);
39
helpers::encode_json(std::to_string(
search_start
), back);
40
answer.append(
"\",\n"
);
41
42
answer.append(
"\t\"hash_start\":\""
);
43
helpers::encode_json(std::to_string(
hash_start
), back);
44
answer.append(
"\",\n"
);
45
46
answer.append(
"\n}"
);
47
return
answer;
48
}
49
50
}
// namespace ada
helpers.h
Definitions for helper functions used within Ada.
ada
Definition
ada_idna.h:13
ada::url_components::pathname_start
uint32_t pathname_start
Definition
url_components.h:69
ada::url_components::hash_start
uint32_t hash_start
Definition
url_components.h:75
ada::url_components::port
uint32_t port
Definition
url_components.h:66
ada::url_components::to_string
std::string to_string() const
Definition
url_components.cpp:9
ada::url_components::protocol_end
uint32_t protocol_end
Definition
url_components.h:51
ada::url_components::search_start
uint32_t search_start
Definition
url_components.h:72
ada::url_components::host_end
uint32_t host_end
Definition
url_components.h:63
ada::url_components::username_end
uint32_t username_end
Definition
url_components.h:57
ada::url_components::host_start
uint32_t host_start
Definition
url_components.h:60
url_components-inl.h