| 10 | namespace Valdi { |
| 11 | |
| 12 | URL::URL(const StringBox& url) : _url(url) { |
| 13 | auto schemeIndex = url.find("://"); |
| 14 | if (schemeIndex) { |
| 15 | _scheme = url.substring(0, schemeIndex.value()); |
| 16 | _path = url.substring(schemeIndex.value() + 3); |
| 17 | } else { |
| 18 | if (url.hasPrefix("data:")) { |
| 19 | _scheme = url.substring(0, 4); |
| 20 | } |
| 21 | _path = url; |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | URL::URL(StringBox&& scheme, StringBox&& path) : _scheme(std::move(scheme)), _path(std::move(path)) { |
| 26 | if (!_scheme.isEmpty()) { |