@@ -36,43 +36,43 @@ class URL {
36
36
};
37
37
38
38
URL () = default ;
39
- URL (const StringView&);
40
- URL (const char * string)
39
+ URL (StringView const &);
40
+ URL (char const * string)
41
41
: URL(StringView(string))
42
42
{
43
43
}
44
- URL (const String& string)
44
+ URL (String const & string)
45
45
: URL(string.view())
46
46
{
47
47
}
48
48
49
- bool is_valid () const { return m_valid; }
49
+ bool const & is_valid () const { return m_valid; }
50
50
51
- String scheme () const { return m_scheme; }
52
- String protocol () const { return m_scheme; }
53
- String username () const { return m_username; }
54
- String password () const { return m_password; }
55
- String host () const { return m_host; }
56
- const Vector<String>& paths () const { return m_paths; }
57
- String query () const { return m_query; }
58
- String fragment () const { return m_fragment; }
51
+ String const & scheme () const { return m_scheme; }
52
+ String const & protocol () const { return m_scheme; }
53
+ String const & username () const { return m_username; }
54
+ String const & password () const { return m_password; }
55
+ String const & host () const { return m_host; }
56
+ Vector<String> const & paths () const { return m_paths; }
57
+ String const & query () const { return m_query; }
58
+ String const & fragment () const { return m_fragment; }
59
59
u16 port () const { return m_port ? m_port : default_port_for_scheme (m_scheme); }
60
- bool cannot_be_a_base_url () const { return m_cannot_be_a_base_url; }
60
+ bool const & cannot_be_a_base_url () const { return m_cannot_be_a_base_url; }
61
61
62
62
bool includes_credentials () const { return !m_username.is_empty () || !m_password.is_empty (); }
63
63
bool is_special () const { return is_special_scheme (m_scheme); }
64
64
65
- void set_scheme (const String& );
66
- void set_protocol (const String& protocol) { set_scheme (protocol); }
67
- void set_username (const String& );
68
- void set_password (const String& );
69
- void set_host (const String& );
70
- void set_port (const u16 );
71
- void set_paths (const Vector<String>& );
72
- void set_query (const String& );
73
- void set_fragment (const String& );
74
- void set_cannot_be_a_base_url (const bool value) { m_cannot_be_a_base_url = value; }
75
- void append_path (const String& path) { m_paths.append (path); }
65
+ void set_scheme (String);
66
+ void set_protocol (String protocol) { set_scheme (move ( protocol) ); }
67
+ void set_username (String);
68
+ void set_password (String);
69
+ void set_host (String);
70
+ void set_port (u16 );
71
+ void set_paths (Vector<String>);
72
+ void set_query (String);
73
+ void set_fragment (String);
74
+ void set_cannot_be_a_base_url (bool value) { m_cannot_be_a_base_url = value; }
75
+ void append_path (String path) { m_paths.append (path); }
76
76
77
77
String path () const ;
78
78
String basename () const ;
@@ -83,27 +83,27 @@ class URL {
83
83
String to_string () const { return serialize (); }
84
84
String to_string_encoded () const { return serialize (); }
85
85
86
- bool equals (const URL& other, ExcludeFragment = ExcludeFragment::No) const ;
86
+ bool equals (URL const & other, ExcludeFragment = ExcludeFragment::No) const ;
87
87
88
- URL complete_url (const String&) const ;
88
+ URL complete_url (String const &) const ;
89
89
90
90
bool data_payload_is_base64 () const { return m_data_payload_is_base64; }
91
- const String& data_mime_type () const { return m_data_mime_type; }
92
- const String& data_payload () const { return m_data_payload; }
91
+ String const & data_mime_type () const { return m_data_mime_type; }
92
+ String const & data_payload () const { return m_data_payload; }
93
93
94
- static URL create_with_url_or_path (const String&);
95
- static URL create_with_file_scheme (const String& path, const String& fragment = {}, const String& hostname = {});
96
- static URL create_with_file_protocol (const String& path, const String& fragment = {}) { return create_with_file_scheme (path, fragment); }
97
- static URL create_with_data (const StringView& mime_type, const StringView& payload, bool is_base64 = false );
94
+ static URL create_with_url_or_path (String const &);
95
+ static URL create_with_file_scheme (String const & path, String const & fragment = {}, String const & hostname = {});
96
+ static URL create_with_file_protocol (String const & path, String const & fragment = {}) { return create_with_file_scheme (path, fragment); }
97
+ static URL create_with_data (String mime_type, String payload, bool is_base64 = false ) { return URL ( move (mime_type), move (payload), is_base64); } ;
98
98
99
- static bool scheme_requires_port (const StringView&);
100
- static u16 default_port_for_scheme (const StringView&);
101
- static bool is_special_scheme (const StringView&);
99
+ static bool scheme_requires_port (StringView const &);
100
+ static u16 default_port_for_scheme (StringView const &);
101
+ static bool is_special_scheme (StringView const &);
102
102
103
- static String percent_encode (const StringView& input, PercentEncodeSet set = PercentEncodeSet::Userinfo);
104
- static String percent_decode (const StringView& input);
103
+ static String percent_encode (StringView const & input, PercentEncodeSet set = PercentEncodeSet::Userinfo);
104
+ static String percent_decode (StringView const & input);
105
105
106
- bool operator ==(const URL& other) const
106
+ bool operator ==(URL const & other) const
107
107
{
108
108
if (this == &other)
109
109
return true ;
@@ -148,15 +148,15 @@ class URL {
148
148
149
149
template <>
150
150
struct Formatter <URL> : Formatter<StringView> {
151
- void format (FormatBuilder& builder, const URL& value)
151
+ void format (FormatBuilder& builder, URL const & value)
152
152
{
153
153
Formatter<StringView>::format (builder, value.serialize ());
154
154
}
155
155
};
156
156
157
157
template <>
158
158
struct Traits <URL> : public GenericTraits<URL> {
159
- static unsigned hash (const URL& url) { return url.to_string ().hash (); }
159
+ static unsigned hash (URL const & url) { return url.to_string ().hash (); }
160
160
};
161
161
162
162
}
0 commit comments