MCPcopy Create free account
hub / github.com/comaps/comaps / FindUrlPrefix

Function FindUrlPrefix

libs/map/mwm_url.cpp:104–113  ·  view source on GitHub ↗

A helper for SetUrlAndParse() below. kGe0Prefixes supports API and ge0 links, kLegacyMwmPrefixes - only API.

Source from the content-addressed store, hash-verified

102// A helper for SetUrlAndParse() below.
103// kGe0Prefixes supports API and ge0 links, kLegacyMwmPrefixes - only API.
104std::tuple<size_t, bool> FindUrlPrefix(std::string const & url)
105{
106 for (auto const prefix : ge0::Ge0Parser::kGe0Prefixes)
107 if (url.starts_with(prefix))
108 return {prefix.size(), true};
109 for (auto const prefix : kLegacyMwmPrefixes)
110 if (url.starts_with(prefix))
111 return {prefix.size(), false};
112 return {std::string::npos, false};
113}
114} // namespace
115
116ParsedMapApi::UrlType ParsedMapApi::SetUrlAndParse(std::string const & raw)

Callers 1

SetUrlAndParseMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected