@@ -131,7 +131,7 @@ components (path, host, and so forth).
131
131
- Parse and validate a URL from an ASCII or a valid UTF-8 string.
132
132
133
133
```cpp
134
- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> ("https://www.google.com");
134
+ auto url = ada::parse("https://www.google.com");
135
135
if (url) { /* URL is valid */ }
136
136
```
137
137
@@ -140,14 +140,14 @@ accessing it when you are not sure that it will succeed. The following
140
140
code is unsafe:
141
141
142
142
``` cpp
143
- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> (" some bad url" );
143
+ auto url = ada::parse(" some bad url" );
144
144
url->get_href ();
145
145
```
146
146
147
147
You should do...
148
148
149
149
``` cpp
150
- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> (" some bad url" );
150
+ auto url = ada::parse(" some bad url" );
151
151
if (url) {
152
152
// next line is now safe:
153
153
url->get_href();
@@ -165,7 +165,7 @@ UTF-8 strings.
165
165
- Get/Update credentials
166
166
167
167
``` cpp
168
- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> (" https://www.google.com" );
168
+ auto url = ada::parse(" https://www.google.com" );
169
169
url->set_username ("username");
170
170
url->set_password("password");
171
171
// ada->get_href() will return "
https://username:[email protected] / "
@@ -174,7 +174,7 @@ url->set_password("password");
174
174
- Get/Update Protocol
175
175
176
176
```cpp
177
- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> ("https://www.google.com");
177
+ auto url = ada::parse("https://www.google.com");
178
178
url->set_protocol("wss");
179
179
// url->get_protocol() will return "wss:"
180
180
// url->get_href() will return "wss://www.google.com/"
@@ -183,7 +183,7 @@ url->set_protocol("wss");
183
183
- Get/Update host
184
184
185
185
``` cpp
186
- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> (" https://www.google.com" );
186
+ auto url = ada::parse(" https://www.google.com" );
187
187
url->set_host ("github.com");
188
188
// url->get_host() will return "github.com"
189
189
// you can use ` url.set_hostname ` depending on your usage.
@@ -192,31 +192,31 @@ url->set_host("github.com");
192
192
- Get/Update port
193
193
194
194
```cpp
195
- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> ("https://www.google.com");
195
+ auto url = ada::parse("https://www.google.com");
196
196
url->set_port("8080");
197
197
// url->get_port() will return "8080"
198
198
```
199
199
200
200
- Get/Update pathname
201
201
202
202
``` cpp
203
- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> (" https://www.google.com" );
203
+ auto url = ada::parse(" https://www.google.com" );
204
204
url->set_pathname ("/my-super-long-path")
205
205
// url->get_pathname() will return "/my-super-long-path"
206
206
```
207
207
208
208
- Get/Update search/query
209
209
210
210
```cpp
211
- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> ("https://www.google.com");
211
+ auto url = ada::parse("https://www.google.com");
212
212
url->set_search("target=self");
213
213
// url->get_search() will return "?target=self"
214
214
```
215
215
216
216
- Get/Update hash/fragment
217
217
218
218
``` cpp
219
- ada::result<ada::url_aggregator> url = ada::parse<ada::url_aggregator> (" https://www.google.com" );
219
+ auto url = ada::parse(" https://www.google.com" );
220
220
url->set_hash ("is-this-the-real-life");
221
221
// url->get_hash() will return "#is-this-the-real-life"
222
222
```
0 commit comments