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