#include "url/third_party/mozilla/url_parse.h"
#include <stdlib.h>
#include <ostream>
#include <string_view>
#include "base/check_op.h"
#include "url/url_parse_internal.h"
#include "url/url_util.h"
#include "url/url_util_internal.h"
namespace url {
std::ostream& operator<<(std::ostream& os, const Parsed& parsed) { … }
namespace {
inline bool IsPortDigit(char16_t ch) { … }
template <typename CHAR>
int FindNextAuthorityTerminator(const CHAR* spec,
int start_offset,
int spec_len,
ParserMode parser_mode) { … }
template <typename CHAR>
void ParseUserInfo(const CHAR* spec,
const Component& user,
Component* username,
Component* password) { … }
template <typename CHAR>
void ParseServerInfo(const CHAR* spec,
const Component& serverinfo,
Component* hostname,
Component* port_num) { … }
template <typename CHAR>
void DoParseAuthority(const CHAR* spec,
const Component& auth,
ParserMode parser_mode,
Component* username,
Component* password,
Component* hostname,
Component* port_num) { … }
template <typename CHAR>
inline void FindQueryAndRefParts(const CHAR* spec,
const Component& path,
int* query_separator,
int* ref_separator) { … }
template <typename CHAR>
void ParsePath(const CHAR* spec,
const Component& path,
Component* filepath,
Component* query,
Component* ref) { … }
template <typename CharT>
bool DoExtractScheme(std::basic_string_view<CharT> url, Component* scheme) { … }
template <typename CHAR>
void DoParseAfterSpecialScheme(const CHAR* spec,
int spec_len,
int after_scheme,
Parsed* parsed) { … }
template <typename CharT>
Parsed DoParseStandardURL(std::basic_string_view<CharT> url) { … }
template <typename CHAR>
void DoParseAfterNonSpecialScheme(const CHAR* spec,
int spec_len,
int after_scheme,
Parsed* parsed) { … }
template <typename CharT>
Parsed DoParseNonSpecialURL(std::basic_string_view<CharT> url,
bool trim_path_end) { … }
template <typename CharT>
Parsed DoParseFileSystemURL(std::basic_string_view<CharT> url) { … }
template <typename CharT>
Parsed DoParsePathURL(std::basic_string_view<CharT> url, bool trim_path_end) { … }
template <typename CharT>
Parsed DoParseMailtoURL(std::basic_string_view<CharT> url) { … }
template <typename CHAR>
int DoParsePort(const CHAR* spec, const Component& component) { … }
template <typename CHAR>
void DoExtractFileName(const CHAR* spec,
const Component& path,
Component* file_name) { … }
template <typename CharT>
bool DoExtractQueryKeyValue(std::basic_string_view<CharT> spec,
Component* query,
Component* key,
Component* value) { … }
}
COMPONENT_EXPORT(URL)
std::ostream& operator<<(std::ostream& os, const Component& component) { … }
Parsed::Parsed() = default;
Parsed::Parsed(const Parsed& other)
: … { … }
Parsed& Parsed::operator=(const Parsed& other) { … }
Parsed::~Parsed() { … }
int Parsed::Length() const { … }
int Parsed::CountCharactersBefore(ComponentType type,
bool include_delimiter) const { … }
Component Parsed::GetContent() const { … }
bool ExtractScheme(std::string_view url, Component* scheme) { … }
bool ExtractScheme(std::u16string_view url, Component* scheme) { … }
bool ExtractScheme(const char* url, int url_len, Component* scheme) { … }
bool ExtractScheme(const char16_t* url, int url_len, Component* scheme) { … }
bool IsAuthorityTerminator(char16_t ch, ParserMode parser_mode) { … }
void ExtractFileName(const char* url,
const Component& path,
Component* file_name) { … }
void ExtractFileName(const char16_t* url,
const Component& path,
Component* file_name) { … }
bool ExtractQueryKeyValue(std::string_view url,
Component* query,
Component* key,
Component* value) { … }
bool ExtractQueryKeyValue(std::u16string_view url,
Component* query,
Component* key,
Component* value) { … }
void ParseAuthority(const char* spec,
const Component& auth,
Component* username,
Component* password,
Component* hostname,
Component* port_num) { … }
void ParseAuthority(const char16_t* spec,
const Component& auth,
Component* username,
Component* password,
Component* hostname,
Component* port_num) { … }
void ParseAuthority(const char* spec,
const Component& auth,
ParserMode parser_mode,
Component* username,
Component* password,
Component* hostname,
Component* port_num) { … }
void ParseAuthority(const char16_t* spec,
const Component& auth,
ParserMode parser_mode,
Component* username,
Component* password,
Component* hostname,
Component* port_num) { … }
int ParsePort(const char* url, const Component& port) { … }
int ParsePort(const char16_t* url, const Component& port) { … }
Parsed ParseStandardURL(std::string_view url) { … }
Parsed ParseStandardURL(std::u16string_view url) { … }
void ParseStandardURL(const char* url, int url_len, Parsed* parsed) { … }
Parsed ParseNonSpecialURL(std::string_view url) { … }
Parsed ParseNonSpecialURL(std::u16string_view url) { … }
Parsed ParseNonSpecialURLInternal(std::string_view url, bool trim_path_end) { … }
Parsed ParseNonSpecialURLInternal(std::u16string_view url, bool trim_path_end) { … }
Parsed ParsePathURL(std::string_view url, bool trim_path_end) { … }
Parsed ParsePathURL(std::u16string_view url, bool trim_path_end) { … }
void ParsePathURL(const char* url,
int url_len,
bool trim_path_end,
Parsed* parsed) { … }
Parsed ParseFileSystemURL(std::string_view url) { … }
Parsed ParseFileSystemURL(std::u16string_view url) { … }
Parsed ParseMailtoURL(std::string_view url) { … }
Parsed ParseMailtoURL(std::u16string_view url) { … }
void ParsePathInternal(const char* spec,
const Component& path,
Component* filepath,
Component* query,
Component* ref) { … }
void ParsePathInternal(const char16_t* spec,
const Component& path,
Component* filepath,
Component* query,
Component* ref) { … }
void ParseAfterSpecialScheme(const char* spec,
int spec_len,
int after_scheme,
Parsed* parsed) { … }
void ParseAfterSpecialScheme(const char16_t* spec,
int spec_len,
int after_scheme,
Parsed* parsed) { … }
void ParseAfterNonSpecialScheme(const char* spec,
int spec_len,
int after_scheme,
Parsed* parsed) { … }
void ParseAfterNonSpecialScheme(const char16_t* spec,
int spec_len,
int after_scheme,
Parsed* parsed) { … }
}