20 lines
429 B
C++
20 lines
429 B
C++
|
|
#include <libfoundation/URL.h>
|
||
|
|
#include <string>
|
||
|
|
|
||
|
|
namespace LFoundation {
|
||
|
|
|
||
|
|
URL::Scheme URL::parse_scheme(const std::string& path)
|
||
|
|
{
|
||
|
|
if (path.starts_with("file://")) {
|
||
|
|
return Scheme::File;
|
||
|
|
} else if (path.starts_with("http://")) {
|
||
|
|
return Scheme::Http;
|
||
|
|
} else if (path.starts_with("https://")) {
|
||
|
|
return Scheme::Https;
|
||
|
|
}
|
||
|
|
|
||
|
|
// Unknown scheme.
|
||
|
|
std::abort();
|
||
|
|
}
|
||
|
|
|
||
|
|
} // namespace LFoundation
|