@@ -21,19 +21,19 @@ The project is otherwise self-contained and it has no dependency.
2121
2222## Usage
2323
24- Ada supports two types of URL instances, ` ada:url ` and ` ada:url_aggregator ` . The usage is
24+ Ada supports two types of URL instances, ` ada:: url ` and ` ada: :url_aggregator ` . The usage is
2525the same in either case: we have an parsing function template ` ada::parse ` which can return
26- either a result of type ` ada::result<ada:url> ` or of type ` ada::result<ada:url_aggregator> `
27- depending on your needs. The ` ada:url_aggregator ` class is smaller and it is backed by a precomputed
28- serialized URL string. The ` ada:url ` class is made of several separate strings for the various
26+ either a result of type ` ada::result<ada:: url> ` or of type ` ada::result<ada: :url_aggregator> `
27+ depending on your needs. The ` ada:: url_aggregator ` class is smaller and it is backed by a precomputed
28+ serialized URL string. The ` ada:: url ` class is made of several separate strings for the various
2929components (path, host, and so forth).
3030
3131### Parsing & Validation
3232
3333- Parse and validate a URL
3434
3535``` cpp
36- ada::result<ada::url_aggregator> url = ada::parse<ada:url_aggregator>(" https://www.google.com" );
36+ ada::result<ada::url_aggregator> url = ada::parse<ada:: url_aggregator>(" https://www.google.com" );
3737if (url) { /* URL is valid * / }
3838```
3939
@@ -42,14 +42,14 @@ accessing it when you are not sure that it will succeed. The following
4242code is unsafe:
4343
4444```cpp
45- ada::result<ada:url_aggregator> url = ada::parse<ada:url_aggregator>("some bad url");
45+ ada::result<ada:: url_aggregator> url = ada::parse<ada: :url_aggregator>("some bad url");
4646url->get_href();
4747```
4848
4949You should do...
5050
5151``` cpp
52- ada::result<ada:url_aggregator> url = ada::parse<ada:url_aggregator>(" some bad url" );
52+ ada::result<ada:: url_aggregator> url = ada::parse<ada: :url_aggregator>(" some bad url" );
5353if (url) {
5454 // next line is now safe:
5555 url->get_href();
@@ -66,7 +66,7 @@ we know that parsing succeeds.
6666- Get/Update credentials
6767
6868``` cpp
69- ada::result<ada:url_aggregator> url = ada::parse<ada:url_aggregator>(" https://www.google.com" );
69+ ada::result<ada:: url_aggregator> url = ada::parse<ada: :url_aggregator>(" https://www.google.com" );
7070url->set_username ("username");
7171url->set_password("password");
7272// ada->get_href() will return "https://username:password@www.google.com/ "
@@ -75,7 +75,7 @@ url->set_password("password");
7575- Get/Update Protocol
7676
7777```cpp
78- ada::result<ada:url_aggregator> url = ada::parse<ada:url_aggregator>("https://www.google.com");
78+ ada::result<ada:: url_aggregator> url = ada::parse<ada: :url_aggregator>("https://www.google.com");
7979url->set_protocol("wss");
8080// url->get_protocol() will return "wss:"
8181// url->get_href() will return "wss://www.google.com/"
@@ -84,7 +84,7 @@ url->set_protocol("wss");
8484- Get/Update host
8585
8686``` cpp
87- ada::result<ada:url_aggregator> url = ada::parse<ada:url_aggregator>(" https://www.google.com" );
87+ ada::result<ada:: url_aggregator> url = ada::parse<ada: :url_aggregator>(" https://www.google.com" );
8888url->set_host ("github.com");
8989// url->get_host() will return "github.com"
9090// you can use ` url.set_hostname ` depending on your usage.
@@ -93,31 +93,31 @@ url->set_host("github.com");
9393- Get/Update port
9494
9595```cpp
96- ada::result<ada:url_aggregator> url = ada::parse<ada:url_aggregator>("https://www.google.com");
96+ ada::result<ada:: url_aggregator> url = ada::parse<ada: :url_aggregator>("https://www.google.com");
9797url->set_port("8080");
9898// url->get_port() will return "8080"
9999```
100100
101101- Get/Update pathname
102102
103103``` cpp
104- ada::result<ada:url_aggregator> url = ada::parse<ada:url_aggregator>(" https://www.google.com" );
104+ ada::result<ada:: url_aggregator> url = ada::parse<ada: :url_aggregator>(" https://www.google.com" );
105105url->set_pathname ("/my-super-long-path")
106106// url->get_pathname() will return "/my-super-long-path"
107107```
108108
109109- Get/Update search/query
110110
111111```cpp
112- ada::result<ada:url_aggregator> url = ada::parse<ada:url_aggregator>("https://www.google.com");
112+ ada::result<ada:: url_aggregator> url = ada::parse<ada: :url_aggregator>("https://www.google.com");
113113url->set_search("target=self");
114114// url->get_search() will return "?target=self"
115115```
116116
117117- Get/Update hash/fragment
118118
119119``` cpp
120- ada::result<ada:url_aggregator> url = ada::parse<ada:url_aggregator>(" https://www.google.com" );
120+ ada::result<ada:: url_aggregator> url = ada::parse<ada: :url_aggregator>(" https://www.google.com" );
121121url->set_hash ("is-this-the-real-life");
122122// url->get_hash() will return "#is-this-the-real-life"
123123```
0 commit comments