Everywhere: Pass AK::StringView by value

This commit is contained in:
Andreas Kling 2021-11-11 00:55:02 +01:00
parent ad5d217e76
commit 8b1108e485
Notes: sideshowbarker 2024-07-18 01:17:49 +09:00
392 changed files with 978 additions and 978 deletions

View File

@ -38,7 +38,7 @@ static constexpr auto make_lookup_table()
return table;
}
size_t calculate_base64_decoded_length(const StringView& input)
size_t calculate_base64_decoded_length(StringView input)
{
return input.length() * 3 / 4;
}
@ -48,7 +48,7 @@ size_t calculate_base64_encoded_length(ReadonlyBytes input)
return ((4 * input.size() / 3) + 3) & ~3;
}
Optional<ByteBuffer> decode_base64(const StringView& input)
Optional<ByteBuffer> decode_base64(StringView input)
{
auto get = [&](const size_t offset, bool* is_padding) -> Optional<u8> {
constexpr auto table = make_lookup_table();

View File

@ -13,11 +13,11 @@
namespace AK {
size_t calculate_base64_decoded_length(const StringView&);
size_t calculate_base64_decoded_length(StringView);
size_t calculate_base64_encoded_length(ReadonlyBytes);
Optional<ByteBuffer> decode_base64(const StringView&);
Optional<ByteBuffer> decode_base64(StringView);
String encode_base64(ReadonlyBytes);

View File

@ -14,7 +14,7 @@ namespace AK {
class DateTimeLexer : public GenericLexer {
public:
constexpr explicit DateTimeLexer(const StringView& input)
constexpr explicit DateTimeLexer(StringView input)
: GenericLexer(input)
{
}

View File

@ -12,7 +12,7 @@
namespace AK {
inline String demangle(const StringView& name)
inline String demangle(StringView name)
{
int status = 0;
auto* demangled_name = abi::__cxa_demangle(name.to_string().characters(), nullptr, nullptr, &status);

View File

@ -55,7 +55,7 @@ FlyString::FlyString(const String& string)
}
}
FlyString::FlyString(StringView const& string)
FlyString::FlyString(StringView string)
{
if (string.is_null())
return;
@ -95,17 +95,17 @@ template Optional<u16> FlyString::to_uint(TrimWhitespace) const;
template Optional<u32> FlyString::to_uint(TrimWhitespace) const;
template Optional<u64> FlyString::to_uint(TrimWhitespace) const;
bool FlyString::equals_ignoring_case(const StringView& other) const
bool FlyString::equals_ignoring_case(StringView other) const
{
return StringUtils::equals_ignoring_case(view(), other);
}
bool FlyString::starts_with(const StringView& str, CaseSensitivity case_sensitivity) const
bool FlyString::starts_with(StringView str, CaseSensitivity case_sensitivity) const
{
return StringUtils::starts_with(view(), str, case_sensitivity);
}
bool FlyString::ends_with(const StringView& str, CaseSensitivity case_sensitivity) const
bool FlyString::ends_with(StringView str, CaseSensitivity case_sensitivity) const
{
return StringUtils::ends_with(view(), str, case_sensitivity);
}
@ -132,7 +132,7 @@ bool FlyString::operator==(const String& other) const
return !__builtin_memcmp(characters(), other.characters(), length());
}
bool FlyString::operator==(const StringView& string) const
bool FlyString::operator==(StringView string) const
{
return *this == String(string);
}

View File

@ -23,7 +23,7 @@ public:
{
}
FlyString(const String&);
FlyString(const StringView&);
FlyString(StringView);
FlyString(const char* string)
: FlyString(static_cast<String>(string))
{
@ -58,8 +58,8 @@ public:
bool operator==(const String&) const;
bool operator!=(const String& string) const { return !(*this == string); }
bool operator==(const StringView&) const;
bool operator!=(const StringView& string) const { return !(*this == string); }
bool operator==(StringView) const;
bool operator!=(StringView string) const { return !(*this == string); }
bool operator==(const char*) const;
bool operator!=(const char* string) const { return !(*this == string); }
@ -78,9 +78,9 @@ public:
template<typename T = unsigned>
Optional<T> to_uint(TrimWhitespace = TrimWhitespace::Yes) const;
bool equals_ignoring_case(const StringView&) const;
bool starts_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
bool ends_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
bool equals_ignoring_case(StringView) const;
bool starts_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
bool ends_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
static void did_destroy_impl(Badge<StringImpl>, StringImpl&);

View File

@ -13,7 +13,7 @@ namespace AK {
class GenericLexer {
public:
constexpr explicit GenericLexer(const StringView& input)
constexpr explicit GenericLexer(StringView input)
: m_input(input)
{
}
@ -93,7 +93,7 @@ public:
return consume_specific(StringView { next });
}
constexpr char consume_escaped_character(char escape_char = '\\', const StringView& escape_map = "n\nr\rt\tb\bf\f")
constexpr char consume_escaped_character(char escape_char = '\\', StringView escape_map = "n\nr\rt\tb\bf\f")
{
if (!consume_specific(escape_char))
return consume();
@ -215,7 +215,7 @@ private:
Result<u32, UnicodeEscapeError> decode_single_or_paired_surrogate(bool combine_surrogate_pairs);
};
constexpr auto is_any_of(const StringView& values)
constexpr auto is_any_of(StringView values)
{
return [values](auto c) { return values.contains(c); };
}

View File

@ -15,7 +15,7 @@
namespace AK {
Optional<ByteBuffer> decode_hex(const StringView& input)
Optional<ByteBuffer> decode_hex(StringView input)
{
if ((input.length() % 2) != 0)
return {};

View File

@ -24,7 +24,7 @@ constexpr u8 decode_hex_digit(char digit)
return 255;
}
Optional<ByteBuffer> decode_hex(const StringView&);
Optional<ByteBuffer> decode_hex(StringView);
String encode_hex(ReadonlyBytes);

View File

@ -66,7 +66,7 @@ public:
octet(SubnetClass::A));
}
static Optional<IPv4Address> from_string(const StringView& string)
static Optional<IPv4Address> from_string(StringView string)
{
if (string.is_null())
return {};

View File

@ -39,7 +39,7 @@ public:
}
#endif
void add(const StringView& value)
void add(StringView value)
{
begin_item();
(void)m_builder.append('"');

View File

@ -33,14 +33,14 @@ public:
}
#ifndef KERNEL
void add(const StringView& key, const JsonValue& value)
void add(StringView key, const JsonValue& value)
{
begin_item(key);
value.serialize(m_builder);
}
#endif
void add(const StringView& key, const StringView& value)
void add(StringView key, StringView value)
{
begin_item(key);
(void)m_builder.append('"');
@ -48,7 +48,7 @@ public:
(void)m_builder.append('"');
}
void add(const StringView& key, const String& value)
void add(StringView key, const String& value)
{
begin_item(key);
(void)m_builder.append('"');
@ -56,7 +56,7 @@ public:
(void)m_builder.append('"');
}
void add(const StringView& key, const char* value)
void add(StringView key, const char* value)
{
begin_item(key);
(void)m_builder.append('"');
@ -64,63 +64,63 @@ public:
(void)m_builder.append('"');
}
void add(const StringView& key, bool value)
void add(StringView key, bool value)
{
begin_item(key);
(void)m_builder.append(value ? "true" : "false");
}
void add(const StringView& key, int value)
void add(StringView key, int value)
{
begin_item(key);
(void)m_builder.appendff("{}", value);
}
void add(const StringView& key, unsigned value)
void add(StringView key, unsigned value)
{
begin_item(key);
(void)m_builder.appendff("{}", value);
}
void add(const StringView& key, long value)
void add(StringView key, long value)
{
begin_item(key);
(void)m_builder.appendff("{}", value);
}
void add(const StringView& key, long unsigned value)
void add(StringView key, long unsigned value)
{
begin_item(key);
(void)m_builder.appendff("{}", value);
}
void add(const StringView& key, long long value)
void add(StringView key, long long value)
{
begin_item(key);
(void)m_builder.appendff("{}", value);
}
void add(const StringView& key, long long unsigned value)
void add(StringView key, long long unsigned value)
{
begin_item(key);
(void)m_builder.appendff("{}", value);
}
#ifndef KERNEL
void add(const StringView& key, double value)
void add(StringView key, double value)
{
begin_item(key);
(void)m_builder.appendff("{}", value);
}
#endif
JsonArraySerializer<Builder> add_array(const StringView& key)
JsonArraySerializer<Builder> add_array(StringView key)
{
begin_item(key);
return JsonArraySerializer(m_builder);
}
JsonObjectSerializer<Builder> add_object(const StringView& key)
JsonObjectSerializer<Builder> add_object(StringView key)
{
begin_item(key);
return JsonObjectSerializer(m_builder);
@ -134,7 +134,7 @@ public:
}
private:
void begin_item(const StringView& key)
void begin_item(StringView key)
{
if (!m_empty)
(void)m_builder.append(',');

View File

@ -13,7 +13,7 @@ namespace AK {
class JsonParser : private GenericLexer {
public:
explicit JsonParser(const StringView& input)
explicit JsonParser(StringView input)
: GenericLexer(input)
{
}

View File

@ -27,7 +27,7 @@ public:
{
}
JsonPathElement(const StringView& key)
JsonPathElement(StringView key)
: m_kind(Kind::Key)
, m_key(key)
{

View File

@ -228,7 +228,7 @@ void JsonValue::clear()
}
#ifndef KERNEL
Optional<JsonValue> JsonValue::from_string(const StringView& input)
Optional<JsonValue> JsonValue::from_string(StringView input)
{
return JsonParser(input).parse();
}

View File

@ -30,7 +30,7 @@ public:
Object,
};
static Optional<JsonValue> from_string(const StringView&);
static Optional<JsonValue> from_string(StringView);
explicit JsonValue(Type = Type::Null);
~JsonValue() { clear(); }

View File

@ -67,7 +67,7 @@ Vector<String> LexicalPath::parts() const
return vector;
}
bool LexicalPath::has_extension(StringView const& extension) const
bool LexicalPath::has_extension(StringView extension) const
{
return m_string.ends_with(extension, CaseSensitivity::CaseInsensitive);
}
@ -129,7 +129,7 @@ String LexicalPath::absolute_path(String dir_path, String target)
return LexicalPath::canonicalized_path(join(dir_path, target).string());
}
String LexicalPath::relative_path(StringView const& a_path, StringView const& a_prefix)
String LexicalPath::relative_path(StringView a_path, StringView a_prefix)
{
if (!a_path.starts_with('/') || !a_prefix.starts_with('/')) {
// FIXME: This should probably VERIFY or return an Optional<String>.
@ -159,7 +159,7 @@ String LexicalPath::relative_path(StringView const& a_path, StringView const& a_
return path;
}
LexicalPath LexicalPath::append(StringView const& value) const
LexicalPath LexicalPath::append(StringView value) const
{
return LexicalPath::join(m_string, value);
}

View File

@ -19,22 +19,22 @@ public:
bool is_absolute() const { return !m_string.is_empty() && m_string[0] == '/'; }
String const& string() const { return m_string; }
StringView const& dirname() const { return m_dirname; }
StringView const& basename() const { return m_basename; }
StringView const& title() const { return m_title; }
StringView const& extension() const { return m_extension; }
StringView dirname() const { return m_dirname; }
StringView basename() const { return m_basename; }
StringView title() const { return m_title; }
StringView extension() const { return m_extension; }
Vector<StringView> const& parts_view() const { return m_parts; }
[[nodiscard]] Vector<String> parts() const;
bool has_extension(StringView const&) const;
bool has_extension(StringView) const;
[[nodiscard]] LexicalPath append(StringView const&) const;
[[nodiscard]] LexicalPath append(StringView) const;
[[nodiscard]] LexicalPath parent() const;
[[nodiscard]] static String canonicalized_path(String);
[[nodiscard]] static String absolute_path(String dir_path, String target);
[[nodiscard]] static String relative_path(StringView const& absolute_path, StringView const& prefix);
[[nodiscard]] static String relative_path(StringView absolute_path, StringView prefix);
template<typename... S>
[[nodiscard]] static LexicalPath join(StringView first, S&&... rest)

View File

@ -58,7 +58,7 @@ public:
return String::formatted("{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", m_data[0], m_data[1], m_data[2], m_data[3], m_data[4], m_data[5]);
}
static Optional<MACAddress> from_string(const StringView& string)
static Optional<MACAddress> from_string(StringView string)
{
if (string.is_null())
return {};

View File

@ -31,7 +31,7 @@ bool String::operator==(const String& other) const
return *m_impl == *other.m_impl;
}
bool String::operator==(const StringView& other) const
bool String::operator==(StringView other) const
{
if (!m_impl)
return !other.m_characters;
@ -202,7 +202,7 @@ template Optional<u16> String::to_uint(TrimWhitespace) const;
template Optional<u32> String::to_uint(TrimWhitespace) const;
template Optional<u64> String::to_uint(TrimWhitespace) const;
bool String::starts_with(const StringView& str, CaseSensitivity case_sensitivity) const
bool String::starts_with(StringView str, CaseSensitivity case_sensitivity) const
{
return StringUtils::starts_with(*this, str, case_sensitivity);
}
@ -214,7 +214,7 @@ bool String::starts_with(char ch) const
return characters()[0] == ch;
}
bool String::ends_with(const StringView& str, CaseSensitivity case_sensitivity) const
bool String::ends_with(StringView str, CaseSensitivity case_sensitivity) const
{
return StringUtils::ends_with(*this, str, case_sensitivity);
}
@ -236,7 +236,7 @@ String String::repeated(char ch, size_t count)
return *impl;
}
String String::repeated(const StringView& string, size_t count)
String String::repeated(StringView string, size_t count)
{
if (!count || string.is_empty())
return empty();
@ -327,17 +327,17 @@ String String::roman_number_from(size_t value)
return builder.to_string();
}
bool String::matches(const StringView& mask, Vector<MaskSpan>& mask_spans, CaseSensitivity case_sensitivity) const
bool String::matches(StringView mask, Vector<MaskSpan>& mask_spans, CaseSensitivity case_sensitivity) const
{
return StringUtils::matches(*this, mask, case_sensitivity, &mask_spans);
}
bool String::matches(const StringView& mask, CaseSensitivity case_sensitivity) const
bool String::matches(StringView mask, CaseSensitivity case_sensitivity) const
{
return StringUtils::matches(*this, mask, case_sensitivity);
}
bool String::contains(const StringView& needle, CaseSensitivity case_sensitivity) const
bool String::contains(StringView needle, CaseSensitivity case_sensitivity) const
{
return StringUtils::contains(*this, needle, case_sensitivity);
}
@ -347,7 +347,7 @@ bool String::contains(char needle, CaseSensitivity case_sensitivity) const
return StringUtils::contains(*this, StringView(&needle, 1), case_sensitivity);
}
bool String::equals_ignoring_case(const StringView& other) const
bool String::equals_ignoring_case(StringView other) const
{
return StringUtils::equals_ignoring_case(view(), other);
}
@ -361,7 +361,7 @@ String String::reverse() const
return reversed_string.to_string();
}
String escape_html_entities(const StringView& html)
String escape_html_entities(StringView html)
{
StringBuilder builder;
for (size_t i = 0; i < html.length(); ++i) {

View File

@ -43,7 +43,7 @@ public:
String() = default;
String(const StringView& view)
String(StringView view)
{
m_impl = StringImpl::create(view.characters_without_null_termination(), view.length());
}
@ -96,7 +96,7 @@ public:
String(const FlyString&);
[[nodiscard]] static String repeated(char, size_t count);
[[nodiscard]] static String repeated(const StringView&, size_t count);
[[nodiscard]] static String repeated(StringView, size_t count);
[[nodiscard]] static String bijective_base_from(size_t value, unsigned base = 26, StringView map = {});
[[nodiscard]] static String roman_number_from(size_t value);
@ -109,8 +109,8 @@ public:
return builder.build();
}
[[nodiscard]] bool matches(const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;
[[nodiscard]] bool matches(const StringView& mask, Vector<MaskSpan>&, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;
[[nodiscard]] bool matches(StringView mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;
[[nodiscard]] bool matches(StringView mask, Vector<MaskSpan>&, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;
template<typename T = int>
[[nodiscard]] Optional<T> to_int(TrimWhitespace = TrimWhitespace::Yes) const;
@ -125,7 +125,7 @@ public:
[[nodiscard]] bool is_whitespace() const { return StringUtils::is_whitespace(*this); }
#ifndef KERNEL
[[nodiscard]] String trim(const StringView& characters, TrimMode mode = TrimMode::Both) const
[[nodiscard]] String trim(StringView characters, TrimMode mode = TrimMode::Both) const
{
return StringUtils::trim(view(), characters, mode);
}
@ -136,9 +136,9 @@ public:
}
#endif
[[nodiscard]] bool equals_ignoring_case(const StringView&) const;
[[nodiscard]] bool equals_ignoring_case(StringView) const;
[[nodiscard]] bool contains(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
[[nodiscard]] bool contains(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
[[nodiscard]] bool contains(char, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
[[nodiscard]] Vector<String> split_limit(char separator, size_t limit, bool keep_empty = false) const;
@ -146,12 +146,12 @@ public:
[[nodiscard]] Vector<StringView> split_view(char separator, bool keep_empty = false) const;
[[nodiscard]] Optional<size_t> find(char needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); }
[[nodiscard]] Optional<size_t> find(StringView const& needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); }
[[nodiscard]] Optional<size_t> find(StringView needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); }
[[nodiscard]] Optional<size_t> find_last(char needle) const { return StringUtils::find_last(*this, needle); }
// FIXME: Implement find_last(StringView const&) for API symmetry.
// FIXME: Implement find_last(StringView) for API symmetry.
Vector<size_t> find_all(StringView needle) const;
using SearchDirection = StringUtils::SearchDirection;
[[nodiscard]] Optional<size_t> find_any_of(StringView const& needles, SearchDirection direction) const { return StringUtils::find_any_of(*this, needles, direction); }
[[nodiscard]] Optional<size_t> find_any_of(StringView needles, SearchDirection direction) const { return StringUtils::find_any_of(*this, needles, direction); }
[[nodiscard]] String substring(size_t start, size_t length) const;
[[nodiscard]] String substring(size_t start) const;
@ -185,16 +185,16 @@ public:
[[nodiscard]] constexpr ConstIterator begin() const { return ConstIterator::begin(*this); }
[[nodiscard]] constexpr ConstIterator end() const { return ConstIterator::end(*this); }
[[nodiscard]] bool starts_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
[[nodiscard]] bool ends_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
[[nodiscard]] bool starts_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
[[nodiscard]] bool ends_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
[[nodiscard]] bool starts_with(char) const;
[[nodiscard]] bool ends_with(char) const;
bool operator==(const String&) const;
bool operator!=(const String& other) const { return !(*this == other); }
bool operator==(const StringView&) const;
bool operator!=(const StringView& other) const { return !(*this == other); }
bool operator==(StringView) const;
bool operator!=(StringView other) const { return !(*this == other); }
bool operator==(const FlyString&) const;
bool operator!=(const FlyString& other) const { return !(*this == other); }
@ -285,8 +285,8 @@ public:
return { characters(), length() };
}
[[nodiscard]] String replace(const StringView& needle, const StringView& replacement, bool all_occurrences = false) const { return StringUtils::replace(*this, needle, replacement, all_occurrences); }
[[nodiscard]] size_t count(StringView const& needle) const { return StringUtils::count(*this, needle); }
[[nodiscard]] String replace(StringView needle, StringView replacement, bool all_occurrences = false) const { return StringUtils::replace(*this, needle, replacement, all_occurrences); }
[[nodiscard]] size_t count(StringView needle) const { return StringUtils::count(*this, needle); }
[[nodiscard]] String reverse() const;
template<typename... Ts>
@ -314,7 +314,7 @@ bool operator>=(const char*, const String&);
bool operator>(const char*, const String&);
bool operator<=(const char*, const String&);
String escape_html_entities(const StringView& html);
String escape_html_entities(StringView html);
InputStream& operator>>(InputStream& stream, String& string);

View File

@ -38,7 +38,7 @@ StringBuilder::StringBuilder(size_t initial_capacity)
m_buffer.ensure_capacity(initial_capacity);
}
void StringBuilder::append(StringView const& str)
void StringBuilder::append(StringView str)
{
if (str.is_empty())
return;
@ -129,7 +129,7 @@ void StringBuilder::append_as_lowercase(char ch)
append(ch);
}
void StringBuilder::append_escaped_for_json(StringView const& string)
void StringBuilder::append_escaped_for_json(StringView string)
{
for (auto ch : string) {
switch (ch) {

View File

@ -21,7 +21,7 @@ public:
explicit StringBuilder(size_t initial_capacity = inline_capacity);
~StringBuilder() = default;
void append(StringView const&);
void append(StringView);
void append(Utf16View const&);
void append(Utf32View const&);
void append(char);
@ -30,7 +30,7 @@ public:
void appendvf(char const*, va_list);
void append_as_lowercase(char);
void append_escaped_for_json(StringView const&);
void append_escaped_for_json(StringView);
template<typename... Parameters>
void appendff(CheckedFormatString<Parameters...>&& fmtstr, Parameters const&... parameters)

View File

@ -19,7 +19,7 @@ namespace AK {
namespace StringUtils {
bool matches(const StringView& str, const StringView& mask, CaseSensitivity case_sensitivity, Vector<MaskSpan>* match_spans)
bool matches(StringView str, StringView mask, CaseSensitivity case_sensitivity, Vector<MaskSpan>* match_spans)
{
auto record_span = [&match_spans](size_t start, size_t length) {
if (match_spans)
@ -79,7 +79,7 @@ bool matches(const StringView& str, const StringView& mask, CaseSensitivity case
}
template<typename T>
Optional<T> convert_to_int(const StringView& str, TrimWhitespace trim_whitespace)
Optional<T> convert_to_int(StringView str, TrimWhitespace trim_whitespace)
{
auto string = trim_whitespace == TrimWhitespace::Yes
? str.trim_whitespace()
@ -113,14 +113,14 @@ Optional<T> convert_to_int(const StringView& str, TrimWhitespace trim_whitespace
return value;
}
template Optional<i8> convert_to_int(const StringView& str, TrimWhitespace);
template Optional<i16> convert_to_int(const StringView& str, TrimWhitespace);
template Optional<i32> convert_to_int(const StringView& str, TrimWhitespace);
template Optional<long> convert_to_int(const StringView& str, TrimWhitespace);
template Optional<long long> convert_to_int(const StringView& str, TrimWhitespace);
template Optional<i8> convert_to_int(StringView str, TrimWhitespace);
template Optional<i16> convert_to_int(StringView str, TrimWhitespace);
template Optional<i32> convert_to_int(StringView str, TrimWhitespace);
template Optional<long> convert_to_int(StringView str, TrimWhitespace);
template Optional<long long> convert_to_int(StringView str, TrimWhitespace);
template<typename T>
Optional<T> convert_to_uint(const StringView& str, TrimWhitespace trim_whitespace)
Optional<T> convert_to_uint(StringView str, TrimWhitespace trim_whitespace)
{
auto string = trim_whitespace == TrimWhitespace::Yes
? str.trim_whitespace()
@ -144,16 +144,16 @@ Optional<T> convert_to_uint(const StringView& str, TrimWhitespace trim_whitespac
return value;
}
template Optional<u8> convert_to_uint(const StringView& str, TrimWhitespace);
template Optional<u16> convert_to_uint(const StringView& str, TrimWhitespace);
template Optional<u32> convert_to_uint(const StringView& str, TrimWhitespace);
template Optional<unsigned long> convert_to_uint(const StringView& str, TrimWhitespace);
template Optional<unsigned long long> convert_to_uint(const StringView& str, TrimWhitespace);
template Optional<long> convert_to_uint(const StringView& str, TrimWhitespace);
template Optional<long long> convert_to_uint(const StringView& str, TrimWhitespace);
template Optional<u8> convert_to_uint(StringView str, TrimWhitespace);
template Optional<u16> convert_to_uint(StringView str, TrimWhitespace);
template Optional<u32> convert_to_uint(StringView str, TrimWhitespace);
template Optional<unsigned long> convert_to_uint(StringView str, TrimWhitespace);
template Optional<unsigned long long> convert_to_uint(StringView str, TrimWhitespace);
template Optional<long> convert_to_uint(StringView str, TrimWhitespace);
template Optional<long long> convert_to_uint(StringView str, TrimWhitespace);
template<typename T>
Optional<T> convert_to_uint_from_hex(const StringView& str, TrimWhitespace trim_whitespace)
Optional<T> convert_to_uint_from_hex(StringView str, TrimWhitespace trim_whitespace)
{
auto string = trim_whitespace == TrimWhitespace::Yes
? str.trim_whitespace()
@ -186,12 +186,12 @@ Optional<T> convert_to_uint_from_hex(const StringView& str, TrimWhitespace trim_
return value;
}
template Optional<u8> convert_to_uint_from_hex(const StringView& str, TrimWhitespace);
template Optional<u16> convert_to_uint_from_hex(const StringView& str, TrimWhitespace);
template Optional<u32> convert_to_uint_from_hex(const StringView& str, TrimWhitespace);
template Optional<u64> convert_to_uint_from_hex(const StringView& str, TrimWhitespace);
template Optional<u8> convert_to_uint_from_hex(StringView str, TrimWhitespace);
template Optional<u16> convert_to_uint_from_hex(StringView str, TrimWhitespace);
template Optional<u32> convert_to_uint_from_hex(StringView str, TrimWhitespace);
template Optional<u64> convert_to_uint_from_hex(StringView str, TrimWhitespace);
bool equals_ignoring_case(const StringView& a, const StringView& b)
bool equals_ignoring_case(StringView a, StringView b)
{
if (a.length() != b.length())
return false;
@ -202,7 +202,7 @@ bool equals_ignoring_case(const StringView& a, const StringView& b)
return true;
}
bool ends_with(const StringView& str, const StringView& end, CaseSensitivity case_sensitivity)
bool ends_with(StringView str, StringView end, CaseSensitivity case_sensitivity)
{
if (end.is_empty())
return true;
@ -225,7 +225,7 @@ bool ends_with(const StringView& str, const StringView& end, CaseSensitivity cas
return true;
}
bool starts_with(const StringView& str, const StringView& start, CaseSensitivity case_sensitivity)
bool starts_with(StringView str, StringView start, CaseSensitivity case_sensitivity)
{
if (start.is_empty())
return true;
@ -250,7 +250,7 @@ bool starts_with(const StringView& str, const StringView& start, CaseSensitivity
return true;
}
bool contains(const StringView& str, const StringView& needle, CaseSensitivity case_sensitivity)
bool contains(StringView str, StringView needle, CaseSensitivity case_sensitivity)
{
if (str.is_null() || needle.is_null() || str.is_empty() || needle.length() > str.length())
return false;
@ -277,12 +277,12 @@ bool contains(const StringView& str, const StringView& needle, CaseSensitivity c
return false;
}
bool is_whitespace(const StringView& str)
bool is_whitespace(StringView str)
{
return all_of(str, is_ascii_space);
}
StringView trim(const StringView& str, const StringView& characters, TrimMode mode)
StringView trim(StringView str, StringView characters, TrimMode mode)
{
size_t substring_start = 0;
size_t substring_length = str.length();
@ -311,12 +311,12 @@ StringView trim(const StringView& str, const StringView& characters, TrimMode mo
return str.substring_view(substring_start, substring_length);
}
StringView trim_whitespace(const StringView& str, TrimMode mode)
StringView trim_whitespace(StringView str, TrimMode mode)
{
return trim(str, " \n\t\v\f\r", mode);
}
Optional<size_t> find(StringView const& haystack, char needle, size_t start)
Optional<size_t> find(StringView haystack, char needle, size_t start)
{
if (start >= haystack.length())
return {};
@ -327,7 +327,7 @@ Optional<size_t> find(StringView const& haystack, char needle, size_t start)
return {};
}
Optional<size_t> find(StringView const& haystack, StringView const& needle, size_t start)
Optional<size_t> find(StringView haystack, StringView needle, size_t start)
{
if (start > haystack.length())
return {};
@ -337,7 +337,7 @@ Optional<size_t> find(StringView const& haystack, StringView const& needle, size
return index.has_value() ? (*index + start) : index;
}
Optional<size_t> find_last(StringView const& haystack, char needle)
Optional<size_t> find_last(StringView haystack, char needle)
{
for (size_t i = haystack.length(); i > 0; --i) {
if (haystack[i - 1] == needle)
@ -346,7 +346,7 @@ Optional<size_t> find_last(StringView const& haystack, char needle)
return {};
}
Vector<size_t> find_all(StringView const& haystack, StringView const& needle)
Vector<size_t> find_all(StringView haystack, StringView needle)
{
Vector<size_t> positions;
size_t current_position = 0;
@ -362,7 +362,7 @@ Vector<size_t> find_all(StringView const& haystack, StringView const& needle)
return positions;
}
Optional<size_t> find_any_of(StringView const& haystack, StringView const& needles, SearchDirection direction)
Optional<size_t> find_any_of(StringView haystack, StringView needles, SearchDirection direction)
{
if (haystack.is_empty() || needles.is_empty())
return {};
@ -380,7 +380,7 @@ Optional<size_t> find_any_of(StringView const& haystack, StringView const& needl
return {};
}
String to_snakecase(const StringView& str)
String to_snakecase(StringView str)
{
auto should_insert_underscore = [&](auto i, auto current_char) {
if (i == 0)
@ -406,7 +406,7 @@ String to_snakecase(const StringView& str)
return builder.to_string();
}
String to_titlecase(StringView const& str)
String to_titlecase(StringView str)
{
StringBuilder builder;
bool next_is_upper = true;
@ -422,7 +422,7 @@ String to_titlecase(StringView const& str)
return builder.to_string();
}
String replace(StringView const& str, StringView const& needle, StringView const& replacement, bool all_occurrences)
String replace(StringView str, StringView needle, StringView replacement, bool all_occurrences)
{
if (str.is_empty())
return str;
@ -451,7 +451,7 @@ String replace(StringView const& str, StringView const& needle, StringView const
}
// TODO: Benchmark against KMP (AK/MemMem.h) and switch over if it's faster for short strings too
size_t count(StringView const& str, StringView const& needle)
size_t count(StringView str, StringView needle)
{
if (needle.is_empty())
return str.length();

View File

@ -43,36 +43,36 @@ struct MaskSpan {
namespace StringUtils {
bool matches(const StringView& str, const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive, Vector<MaskSpan>* match_spans = nullptr);
bool matches(StringView str, StringView mask, CaseSensitivity = CaseSensitivity::CaseInsensitive, Vector<MaskSpan>* match_spans = nullptr);
template<typename T = int>
Optional<T> convert_to_int(const StringView&, TrimWhitespace = TrimWhitespace::Yes);
Optional<T> convert_to_int(StringView, TrimWhitespace = TrimWhitespace::Yes);
template<typename T = unsigned>
Optional<T> convert_to_uint(const StringView&, TrimWhitespace = TrimWhitespace::Yes);
Optional<T> convert_to_uint(StringView, TrimWhitespace = TrimWhitespace::Yes);
template<typename T = unsigned>
Optional<T> convert_to_uint_from_hex(const StringView&, TrimWhitespace = TrimWhitespace::Yes);
bool equals_ignoring_case(const StringView&, const StringView&);
bool ends_with(const StringView& a, const StringView& b, CaseSensitivity);
bool starts_with(const StringView&, const StringView&, CaseSensitivity);
bool contains(const StringView&, const StringView&, CaseSensitivity);
bool is_whitespace(const StringView&);
StringView trim(const StringView& string, const StringView& characters, TrimMode mode);
StringView trim_whitespace(const StringView& string, TrimMode mode);
Optional<T> convert_to_uint_from_hex(StringView, TrimWhitespace = TrimWhitespace::Yes);
bool equals_ignoring_case(StringView, StringView);
bool ends_with(StringView a, StringView b, CaseSensitivity);
bool starts_with(StringView, StringView, CaseSensitivity);
bool contains(StringView, StringView, CaseSensitivity);
bool is_whitespace(StringView);
StringView trim(StringView string, StringView characters, TrimMode mode);
StringView trim_whitespace(StringView string, TrimMode mode);
Optional<size_t> find(StringView const& haystack, char needle, size_t start = 0);
Optional<size_t> find(StringView const& haystack, StringView const& needle, size_t start = 0);
Optional<size_t> find_last(StringView const& haystack, char needle);
Vector<size_t> find_all(StringView const& haystack, StringView const& needle);
Optional<size_t> find(StringView haystack, char needle, size_t start = 0);
Optional<size_t> find(StringView haystack, StringView needle, size_t start = 0);
Optional<size_t> find_last(StringView haystack, char needle);
Vector<size_t> find_all(StringView haystack, StringView needle);
enum class SearchDirection {
Forward,
Backward
};
Optional<size_t> find_any_of(StringView const& haystack, StringView const& needles, SearchDirection);
Optional<size_t> find_any_of(StringView haystack, StringView needles, SearchDirection);
String to_snakecase(const StringView&);
String to_titlecase(StringView const&);
String to_snakecase(StringView);
String to_titlecase(StringView);
String replace(StringView const&, StringView const& needle, StringView const& replacement, bool all_occurrences = false);
size_t count(StringView const&, StringView const& needle);
String replace(StringView, StringView needle, StringView replacement, bool all_occurrences = false);
size_t count(StringView, StringView needle);
}

View File

@ -56,7 +56,7 @@ Vector<StringView> StringView::split_view(const char separator, bool keep_empty)
return v;
}
Vector<StringView> StringView::split_view(const StringView& separator, bool keep_empty) const
Vector<StringView> StringView::split_view(StringView separator, bool keep_empty) const
{
VERIFY(!separator.is_empty());
@ -129,7 +129,7 @@ bool StringView::starts_with(char ch) const
return ch == characters_without_null_termination()[0];
}
bool StringView::starts_with(const StringView& str, CaseSensitivity case_sensitivity) const
bool StringView::starts_with(StringView str, CaseSensitivity case_sensitivity) const
{
return StringUtils::starts_with(*this, str, case_sensitivity);
}
@ -141,17 +141,17 @@ bool StringView::ends_with(char ch) const
return ch == characters_without_null_termination()[length() - 1];
}
bool StringView::ends_with(const StringView& str, CaseSensitivity case_sensitivity) const
bool StringView::ends_with(StringView str, CaseSensitivity case_sensitivity) const
{
return StringUtils::ends_with(*this, str, case_sensitivity);
}
bool StringView::matches(const StringView& mask, Vector<MaskSpan>& mask_spans, CaseSensitivity case_sensitivity) const
bool StringView::matches(StringView mask, Vector<MaskSpan>& mask_spans, CaseSensitivity case_sensitivity) const
{
return StringUtils::matches(*this, mask, case_sensitivity, &mask_spans);
}
bool StringView::matches(const StringView& mask, CaseSensitivity case_sensitivity) const
bool StringView::matches(StringView mask, CaseSensitivity case_sensitivity) const
{
return StringUtils::matches(*this, mask, case_sensitivity);
}
@ -165,12 +165,12 @@ bool StringView::contains(char needle) const
return false;
}
bool StringView::contains(const StringView& needle, CaseSensitivity case_sensitivity) const
bool StringView::contains(StringView needle, CaseSensitivity case_sensitivity) const
{
return StringUtils::contains(*this, needle, case_sensitivity);
}
bool StringView::equals_ignoring_case(const StringView& other) const
bool StringView::equals_ignoring_case(StringView other) const
{
return StringUtils::equals_ignoring_case(*this, other);
}
@ -190,7 +190,7 @@ String StringView::to_titlecase_string() const
return StringUtils::to_titlecase(*this);
}
StringView StringView::substring_view_starting_from_substring(const StringView& substring) const
StringView StringView::substring_view_starting_from_substring(StringView substring) const
{
const char* remaining_characters = substring.characters_without_null_termination();
VERIFY(remaining_characters >= m_characters);
@ -199,7 +199,7 @@ StringView StringView::substring_view_starting_from_substring(const StringView&
return { remaining_characters, remaining_length };
}
StringView StringView::substring_view_starting_after_substring(const StringView& substring) const
StringView StringView::substring_view_starting_after_substring(StringView substring) const
{
const char* remaining_characters = substring.characters_without_null_termination() + substring.length();
VERIFY(remaining_characters >= m_characters);
@ -249,7 +249,7 @@ bool StringView::operator==(const String& string) const
String StringView::to_string() const { return String { *this }; }
String StringView::replace(const StringView& needle, const StringView& replacement, bool all_occurrences) const
String StringView::replace(StringView needle, StringView replacement, bool all_occurrences) const
{
return StringUtils::replace(*this, needle, replacement, all_occurrences);
}

View File

@ -74,17 +74,17 @@ public:
return string_hash(characters_without_null_termination(), length());
}
[[nodiscard]] bool starts_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
[[nodiscard]] bool ends_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
[[nodiscard]] bool starts_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
[[nodiscard]] bool ends_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
[[nodiscard]] bool starts_with(char) const;
[[nodiscard]] bool ends_with(char) const;
[[nodiscard]] bool matches(const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;
[[nodiscard]] bool matches(const StringView& mask, Vector<MaskSpan>&, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;
[[nodiscard]] bool matches(StringView mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;
[[nodiscard]] bool matches(StringView mask, Vector<MaskSpan>&, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;
[[nodiscard]] bool contains(char) const;
[[nodiscard]] bool contains(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
[[nodiscard]] bool equals_ignoring_case(const StringView& other) const;
[[nodiscard]] bool contains(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
[[nodiscard]] bool equals_ignoring_case(StringView other) const;
[[nodiscard]] StringView trim(const StringView& characters, TrimMode mode = TrimMode::Both) const { return StringUtils::trim(*this, characters, mode); }
[[nodiscard]] StringView trim(StringView characters, TrimMode mode = TrimMode::Both) const { return StringUtils::trim(*this, characters, mode); }
[[nodiscard]] StringView trim_whitespace(TrimMode mode = TrimMode::Both) const { return StringUtils::trim_whitespace(*this, mode); }
[[nodiscard]] String to_lowercase_string() const;
@ -92,14 +92,14 @@ public:
[[nodiscard]] String to_titlecase_string() const;
[[nodiscard]] Optional<size_t> find(char needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); }
[[nodiscard]] Optional<size_t> find(StringView const& needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); }
[[nodiscard]] Optional<size_t> find(StringView needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); }
[[nodiscard]] Optional<size_t> find_last(char needle) const { return StringUtils::find_last(*this, needle); }
// FIXME: Implement find_last(StringView const&) for API symmetry.
// FIXME: Implement find_last(StringView) for API symmetry.
[[nodiscard]] Vector<size_t> find_all(StringView needle) const;
using SearchDirection = StringUtils::SearchDirection;
[[nodiscard]] Optional<size_t> find_any_of(StringView const& needles, SearchDirection direction = SearchDirection::Forward) { return StringUtils::find_any_of(*this, needles, direction); }
[[nodiscard]] Optional<size_t> find_any_of(StringView needles, SearchDirection direction = SearchDirection::Forward) { return StringUtils::find_any_of(*this, needles, direction); }
[[nodiscard]] constexpr StringView substring_view(size_t start, size_t length) const
{
@ -114,7 +114,7 @@ public:
}
[[nodiscard]] Vector<StringView> split_view(char, bool keep_empty = false) const;
[[nodiscard]] Vector<StringView> split_view(const StringView&, bool keep_empty = false) const;
[[nodiscard]] Vector<StringView> split_view(StringView, bool keep_empty = false) const;
[[nodiscard]] Vector<StringView> split_view_if(Function<bool(char)> const& predicate, bool keep_empty = false) const;
@ -145,8 +145,8 @@ public:
// StringView substr { "oo" };
//
// would not work.
[[nodiscard]] StringView substring_view_starting_from_substring(const StringView& substring) const;
[[nodiscard]] StringView substring_view_starting_after_substring(const StringView& substring) const;
[[nodiscard]] StringView substring_view_starting_from_substring(StringView substring) const;
[[nodiscard]] StringView substring_view_starting_after_substring(StringView substring) const;
constexpr bool operator==(const char* cstring) const
{
@ -172,7 +172,7 @@ public:
bool operator==(const String&) const;
constexpr bool operator==(const StringView& other) const
constexpr bool operator==(StringView other) const
{
if (is_null())
return other.is_null();
@ -183,12 +183,12 @@ public:
return !__builtin_memcmp(m_characters, other.m_characters, m_length);
}
constexpr bool operator!=(const StringView& other) const
constexpr bool operator!=(StringView other) const
{
return !(*this == other);
}
bool operator<(const StringView& other) const
bool operator<(StringView other) const
{
if (int c = __builtin_memcmp(m_characters, other.m_characters, min(m_length, other.m_length)))
return c < 0;
@ -199,8 +199,8 @@ public:
[[nodiscard]] bool is_whitespace() const { return StringUtils::is_whitespace(*this); }
[[nodiscard]] String replace(const StringView& needle, const StringView& replacement, bool all_occurrences = false) const;
[[nodiscard]] size_t count(StringView const& needle) const { return StringUtils::count(*this, needle); }
[[nodiscard]] String replace(StringView needle, StringView replacement, bool all_occurrences = false) const;
[[nodiscard]] size_t count(StringView needle) const { return StringUtils::count(*this, needle); }
template<typename... Ts>
[[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of(Ts&&... strings) const
@ -216,7 +216,7 @@ private:
template<>
struct Traits<StringView> : public GenericTraits<StringView> {
static unsigned hash(const StringView& s) { return s.hash(); }
static unsigned hash(StringView s) { return s.hash(); }
};
}

View File

@ -16,7 +16,7 @@
namespace AK {
// FIXME: It could make sense to force users of URL to use URLParser::parse() explicitly instead of using a constructor.
URL::URL(StringView const& string)
URL::URL(StringView string)
: URL(URLParser::parse(string))
{
if constexpr (URL_PARSER_DEBUG) {
@ -135,12 +135,12 @@ bool URL::compute_validity() const
return true;
}
bool URL::scheme_requires_port(StringView const& scheme)
bool URL::scheme_requires_port(StringView scheme)
{
return (default_port_for_scheme(scheme) != 0);
}
u16 URL::default_port_for_scheme(StringView const& scheme)
u16 URL::default_port_for_scheme(StringView scheme)
{
if (scheme == "http")
return 80;
@ -189,7 +189,7 @@ URL URL::create_with_url_or_path(String const& url_or_path)
}
// https://url.spec.whatwg.org/#special-scheme
bool URL::is_special_scheme(StringView const& scheme)
bool URL::is_special_scheme(StringView scheme)
{
return scheme.is_one_of("ftp", "file", "http", "https", "ws", "wss");
}
@ -403,7 +403,7 @@ void URL::append_percent_encoded_if_necessary(StringBuilder& builder, u32 code_p
builder.append_code_point(code_point);
}
String URL::percent_encode(StringView const& input, URL::PercentEncodeSet set)
String URL::percent_encode(StringView input, URL::PercentEncodeSet set)
{
StringBuilder builder;
for (auto code_point : Utf8View(input)) {
@ -412,7 +412,7 @@ String URL::percent_encode(StringView const& input, URL::PercentEncodeSet set)
return builder.to_string();
}
String URL::percent_decode(StringView const& input)
String URL::percent_decode(StringView input)
{
if (!input.contains('%'))
return input;

View File

@ -37,7 +37,7 @@ public:
};
URL() = default;
URL(StringView const&);
URL(StringView);
URL(char const* string)
: URL(StringView(string))
{
@ -100,12 +100,12 @@ public:
static URL create_with_file_protocol(String const& path, String const& fragment = {}) { return create_with_file_scheme(path, fragment); }
static URL create_with_data(String mime_type, String payload, bool is_base64 = false) { return URL(move(mime_type), move(payload), is_base64); };
static bool scheme_requires_port(StringView const&);
static u16 default_port_for_scheme(StringView const&);
static bool is_special_scheme(StringView const&);
static bool scheme_requires_port(StringView);
static u16 default_port_for_scheme(StringView);
static bool is_special_scheme(StringView);
static String percent_encode(StringView const& input, PercentEncodeSet set = PercentEncodeSet::Userinfo);
static String percent_decode(StringView const& input);
static String percent_encode(StringView input, PercentEncodeSet set = PercentEncodeSet::Userinfo);
static String percent_decode(StringView input);
bool operator==(URL const& other) const { return equals(other, ExcludeFragment::No); }

View File

@ -30,7 +30,7 @@ static void report_validation_error(SourceLocation const& location = SourceLocat
dbgln_if(URL_PARSER_DEBUG, "URLParser::parse: Validation error! {}", location);
}
static Optional<String> parse_opaque_host(StringView const& input)
static Optional<String> parse_opaque_host(StringView input)
{
auto forbidden_host_code_points_excluding_percent = "\0\t\n\r #/:<>?@[\\]^|"sv;
for (auto code_point : forbidden_host_code_points_excluding_percent) {
@ -44,7 +44,7 @@ static Optional<String> parse_opaque_host(StringView const& input)
return URL::percent_encode(input, URL::PercentEncodeSet::C0Control);
}
static Optional<String> parse_ipv4_address(StringView const& input)
static Optional<String> parse_ipv4_address(StringView input)
{
// FIXME: Implement the correct IPv4 parser as specified by https://url.spec.whatwg.org/#concept-ipv4-parser.
return input;
@ -52,7 +52,7 @@ static Optional<String> parse_ipv4_address(StringView const& input)
// https://url.spec.whatwg.org/#concept-host-parser
// NOTE: This is a very bare-bones implementation.
static Optional<String> parse_host(StringView const& input, bool is_not_special = false)
static Optional<String> parse_host(StringView input, bool is_not_special = false)
{
if (input.starts_with('[')) {
if (!input.ends_with(']')) {
@ -84,7 +84,7 @@ static Optional<String> parse_host(StringView const& input, bool is_not_special
return ipv4_host;
}
constexpr bool starts_with_windows_drive_letter(StringView const& input)
constexpr bool starts_with_windows_drive_letter(StringView input)
{
if (input.length() < 2)
return false;
@ -95,29 +95,29 @@ constexpr bool starts_with_windows_drive_letter(StringView const& input)
return "/\\?#"sv.contains(input[2]);
}
constexpr bool is_windows_drive_letter(StringView const& input)
constexpr bool is_windows_drive_letter(StringView input)
{
return input.length() == 2 && is_ascii_alpha(input[0]) && (input[1] == ':' || input[1] == '|');
}
constexpr bool is_normalized_windows_drive_letter(StringView const& input)
constexpr bool is_normalized_windows_drive_letter(StringView input)
{
return input.length() == 2 && is_ascii_alpha(input[0]) && input[1] == ':';
}
constexpr bool is_single_dot_path_segment(StringView const& input)
constexpr bool is_single_dot_path_segment(StringView input)
{
return input == "."sv || input.equals_ignoring_case("%2e"sv);
}
constexpr bool is_double_dot_path_segment(StringView const& input)
constexpr bool is_double_dot_path_segment(StringView input)
{
return input == ".."sv || input.equals_ignoring_case(".%2e"sv) || input.equals_ignoring_case("%2e."sv) || input.equals_ignoring_case("%2e%2e"sv);
}
// https://fetch.spec.whatwg.org/#data-urls
// FIXME: This only loosely follows the spec, as we use the same class for "regular" and data URLs, unlike the spec.
Optional<URL> URLParser::parse_data_url(StringView const& raw_input)
Optional<URL> URLParser::parse_data_url(StringView raw_input)
{
dbgln_if(URL_PARSER_DEBUG, "URLParser::parse_data_url: Parsing '{}'.", raw_input);
VERIFY(raw_input.starts_with("data:"));
@ -161,7 +161,7 @@ Optional<URL> URLParser::parse_data_url(StringView const& raw_input)
// NOTE: Since the URL class's member variables contain percent decoded data, we have to deviate from the URL parser specification when setting
// some of those values. Because the specification leaves all values percent encoded in their URL data structure, we have to percent decode
// everything before setting the member variables.
URL URLParser::parse(StringView const& raw_input, URL const* base_url, Optional<URL> url, Optional<State> state_override)
URL URLParser::parse(StringView raw_input, URL const* base_url, Optional<URL> url, Optional<State> state_override)
{
dbgln_if(URL_PARSER_DEBUG, "URLParser::parse: Parsing '{}'", raw_input);
if (raw_input.is_empty())

View File

@ -55,10 +55,10 @@ public:
VERIFY_NOT_REACHED();
}
static URL parse(StringView const& input, URL const* base_url = nullptr, Optional<URL> url = {}, Optional<State> state_override = {});
static URL parse(StringView input, URL const* base_url = nullptr, Optional<URL> url = {}, Optional<State> state_override = {});
private:
static Optional<URL> parse_data_url(StringView const& raw_input);
static Optional<URL> parse_data_url(StringView raw_input);
};
#undef ENUMERATE_STATES

View File

@ -16,7 +16,7 @@ UUID::UUID(Array<u8, 16> uuid_buffer)
uuid_buffer.span().copy_to(m_uuid_buffer);
}
void UUID::convert_string_view_to_uuid(const StringView& uuid_string_view)
void UUID::convert_string_view_to_uuid(StringView uuid_string_view)
{
VERIFY(uuid_string_view.length() == 36);
auto first_unit = decode_hex(uuid_string_view.substring_view(0, 8));
@ -36,7 +36,7 @@ void UUID::convert_string_view_to_uuid(const StringView& uuid_string_view)
m_uuid_buffer.span().overwrite(10, fifth_unit.value().data(), fifth_unit.value().size());
}
UUID::UUID(const StringView& uuid_string_view)
UUID::UUID(StringView uuid_string_view)
{
convert_string_view_to_uuid(uuid_string_view);
}

View File

@ -17,7 +17,7 @@ class UUID {
public:
UUID() = default;
UUID(Array<u8, 16> uuid_buffer);
UUID(const StringView&);
UUID(StringView);
~UUID() = default;
bool operator==(const UUID&) const;
@ -31,7 +31,7 @@ public:
bool is_zero() const;
private:
void convert_string_view_to_uuid(const StringView&);
void convert_string_view_to_uuid(StringView);
Array<u8, 16> m_uuid_buffer {};
};

View File

@ -32,7 +32,7 @@ static Vector<u16, 1> to_utf16_impl(UtfViewType const& view) requires(IsSame<Utf
return utf16_data;
}
Vector<u16, 1> utf8_to_utf16(StringView const& utf8_view)
Vector<u16, 1> utf8_to_utf16(StringView utf8_view)
{
return to_utf16_impl(Utf8View { utf8_view });
}

View File

@ -16,7 +16,7 @@
namespace AK {
Vector<u16, 1> utf8_to_utf16(StringView const&);
Vector<u16, 1> utf8_to_utf16(StringView);
Vector<u16, 1> utf8_to_utf16(Utf8View const&);
Vector<u16, 1> utf32_to_utf16(Utf32View const&);
void code_point_to_utf16(Vector<u16, 1>&, u32);

View File

@ -74,7 +74,7 @@ public:
explicit Utf8View(String&&) = delete;
const StringView& as_string() const { return m_string; }
StringView as_string() const { return m_string; }
Utf8CodePointIterator begin() const { return { begin_ptr(), m_string.length() }; }
Utf8CodePointIterator end() const { return { end_ptr(), 0 }; }

View File

@ -86,12 +86,12 @@ UNMAP_AFTER_INIT CommandLine::CommandLine(const String& cmdline_from_bootloader)
add_arguments(args);
}
Optional<StringView> CommandLine::lookup(const StringView& key) const
Optional<StringView> CommandLine::lookup(StringView key) const
{
return m_params.get(key);
}
bool CommandLine::contains(const StringView& key) const
bool CommandLine::contains(StringView key) const
{
return m_params.contains(key);
}

View File

@ -54,8 +54,8 @@ public:
};
[[nodiscard]] const String& string() const { return m_string; }
Optional<StringView> lookup(const StringView& key) const;
[[nodiscard]] bool contains(const StringView& key) const;
Optional<StringView> lookup(StringView key) const;
[[nodiscard]] bool contains(StringView key) const;
[[nodiscard]] bool is_boot_profiling_enabled() const;
[[nodiscard]] bool is_ide_enabled() const;

View File

@ -149,7 +149,7 @@ ErrorOr<void> DevPtsFSInode::flush_metadata()
return {};
}
ErrorOr<void> DevPtsFSInode::add_child(Inode&, const StringView&, mode_t)
ErrorOr<void> DevPtsFSInode::add_child(Inode&, StringView, mode_t)
{
return EROFS;
}
@ -159,7 +159,7 @@ ErrorOr<NonnullRefPtr<Inode>> DevPtsFSInode::create_child(StringView, mode_t, de
return EROFS;
}
ErrorOr<void> DevPtsFSInode::remove_child(const StringView&)
ErrorOr<void> DevPtsFSInode::remove_child(StringView)
{
return EROFS;
}

View File

@ -54,8 +54,8 @@ private:
virtual ErrorOr<void> flush_metadata() override;
virtual ErrorOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, OpenFileDescription*) override;
virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<void> add_child(Inode&, const StringView& name, mode_t) override;
virtual ErrorOr<void> remove_child(const StringView& name) override;
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override;
virtual ErrorOr<void> remove_child(StringView name) override;
virtual ErrorOr<void> chmod(mode_t) override;
virtual ErrorOr<void> chown(UserID, GroupID) override;

View File

@ -85,7 +85,7 @@ ErrorOr<NonnullRefPtr<Inode>> DevTmpFSInode::create_child(StringView, mode_t, de
VERIFY_NOT_REACHED();
}
ErrorOr<void> DevTmpFSInode::add_child(Inode&, const StringView&, mode_t)
ErrorOr<void> DevTmpFSInode::add_child(Inode&, StringView, mode_t)
{
VERIFY_NOT_REACHED();
}
@ -134,7 +134,7 @@ InodeMetadata DevTmpFSInode::metadata() const
return metadata;
}
ErrorOr<void> DevTmpFSInode::remove_child(const StringView&)
ErrorOr<void> DevTmpFSInode::remove_child(StringView)
{
VERIFY_NOT_REACHED();
}
@ -233,7 +233,7 @@ ErrorOr<NonnullRefPtr<Inode>> DevTmpFSDirectoryInode::lookup(StringView name)
return Error::from_errno(ENOENT);
}
ErrorOr<void> DevTmpFSDirectoryInode::remove_child(const StringView& name)
ErrorOr<void> DevTmpFSDirectoryInode::remove_child(StringView name)
{
MutexLocker locker(m_inode_lock);
for (auto& node : m_nodes) {

View File

@ -55,8 +55,8 @@ protected:
virtual InodeMetadata metadata() const override final;
virtual ErrorOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, OpenFileDescription*) override;
virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<void> add_child(Inode&, const StringView& name, mode_t) override;
virtual ErrorOr<void> remove_child(const StringView& name) override;
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override;
virtual ErrorOr<void> remove_child(StringView name) override;
virtual ErrorOr<void> chmod(mode_t) override;
virtual ErrorOr<void> chown(UserID, GroupID) override;
virtual ErrorOr<void> truncate(u64) override;
@ -137,7 +137,7 @@ protected:
virtual Type node_type() const override { return Type::Directory; }
virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<void> remove_child(const StringView& name) override;
virtual ErrorOr<void> remove_child(StringView name) override;
virtual ErrorOr<void> traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override;
virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
DevTmpFSDirectoryInode(DevTmpFS&, NonnullOwnPtr<KString> name);

View File

@ -1159,7 +1159,7 @@ ErrorOr<NonnullRefPtr<Inode>> Ext2FSInode::create_child(StringView name, mode_t
return fs().create_inode(*this, name, mode, dev, uid, gid);
}
ErrorOr<void> Ext2FSInode::add_child(Inode& child, const StringView& name, mode_t mode)
ErrorOr<void> Ext2FSInode::add_child(Inode& child, StringView name, mode_t mode)
{
MutexLocker locker(m_inode_lock);
VERIFY(is_directory());
@ -1189,7 +1189,7 @@ ErrorOr<void> Ext2FSInode::add_child(Inode& child, const StringView& name, mode_
return {};
}
ErrorOr<void> Ext2FSInode::remove_child(const StringView& name)
ErrorOr<void> Ext2FSInode::remove_child(StringView name)
{
MutexLocker locker(m_inode_lock);
dbgln_if(EXT2_DEBUG, "Ext2FSInode[{}]::remove_child(): Removing '{}'", identifier(), name);

View File

@ -45,8 +45,8 @@ private:
virtual ErrorOr<void> flush_metadata() override;
virtual ErrorOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& data, OpenFileDescription*) override;
virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<void> add_child(Inode& child, const StringView& name, mode_t) override;
virtual ErrorOr<void> remove_child(const StringView& name) override;
virtual ErrorOr<void> add_child(Inode& child, StringView name, mode_t) override;
virtual ErrorOr<void> remove_child(StringView name) override;
virtual ErrorOr<void> set_atime(time_t) override;
virtual ErrorOr<void> set_ctime(time_t) override;
virtual ErrorOr<void> set_mtime(time_t) override;

View File

@ -42,7 +42,7 @@ FileSystem* FileSystem::from_fsid(u32 id)
return nullptr;
}
FileSystem::DirectoryEntryView::DirectoryEntryView(const StringView& n, InodeIdentifier i, u8 ft)
FileSystem::DirectoryEntryView::DirectoryEntryView(StringView n, InodeIdentifier i, u8 ft)
: name(n)
, inode(i)
, file_type(ft)

View File

@ -46,7 +46,7 @@ public:
virtual ErrorOr<void> prepare_to_unmount() { return {}; }
struct DirectoryEntryView {
DirectoryEntryView(const StringView& name, InodeIdentifier, u8 file_type);
DirectoryEntryView(StringView name, InodeIdentifier, u8 file_type);
StringView name;
InodeIdentifier inode;

View File

@ -512,12 +512,12 @@ ErrorOr<NonnullRefPtr<Inode>> ISO9660Inode::create_child(StringView, mode_t, dev
return EROFS;
}
ErrorOr<void> ISO9660Inode::add_child(Inode&, const StringView&, mode_t)
ErrorOr<void> ISO9660Inode::add_child(Inode&, StringView, mode_t)
{
return EROFS;
}
ErrorOr<void> ISO9660Inode::remove_child(const StringView&)
ErrorOr<void> ISO9660Inode::remove_child(StringView)
{
return EROFS;
}
@ -556,7 +556,7 @@ void ISO9660Inode::one_ref_left()
{
}
ISO9660Inode::ISO9660Inode(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView const& name)
ISO9660Inode::ISO9660Inode(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView name)
: Inode(fs, get_inode_index(record, name))
, m_record(record)
{
@ -568,7 +568,7 @@ ISO9660Inode::~ISO9660Inode()
{
}
ErrorOr<NonnullRefPtr<ISO9660Inode>> ISO9660Inode::try_create_from_directory_record(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView const& name)
ErrorOr<NonnullRefPtr<ISO9660Inode>> ISO9660Inode::try_create_from_directory_record(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView name)
{
return adopt_nonnull_ref_or_enomem(new (nothrow) ISO9660Inode(fs, record, name));
}
@ -651,7 +651,7 @@ StringView ISO9660Inode::get_normalized_filename(ISO::DirectoryRecordHeader cons
return { buffer.data(), filename.length() };
}
InodeIndex ISO9660Inode::get_inode_index(ISO::DirectoryRecordHeader const& record, StringView const& name)
InodeIndex ISO9660Inode::get_inode_index(ISO::DirectoryRecordHeader const& record, StringView name)
{
if (name.is_null()) {
// NOTE: This is the index of the root inode.

View File

@ -354,8 +354,8 @@ public:
virtual ErrorOr<void> flush_metadata() override;
virtual ErrorOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, OpenFileDescription*) override;
virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<void> add_child(Inode&, const StringView& name, mode_t) override;
virtual ErrorOr<void> remove_child(const StringView& name) override;
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override;
virtual ErrorOr<void> remove_child(StringView name) override;
virtual ErrorOr<void> chmod(mode_t) override;
virtual ErrorOr<void> chown(UserID, GroupID) override;
virtual ErrorOr<void> truncate(u64) override;
@ -370,10 +370,10 @@ private:
// without any problems, so let's allow it anyway.
static constexpr size_t max_file_identifier_length = 256 - sizeof(ISO::DirectoryRecordHeader);
ISO9660Inode(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView const& name);
static ErrorOr<NonnullRefPtr<ISO9660Inode>> try_create_from_directory_record(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView const& name);
ISO9660Inode(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView name);
static ErrorOr<NonnullRefPtr<ISO9660Inode>> try_create_from_directory_record(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView name);
static InodeIndex get_inode_index(ISO::DirectoryRecordHeader const& record, StringView const& name);
static InodeIndex get_inode_index(ISO::DirectoryRecordHeader const& record, StringView name);
static StringView get_normalized_filename(ISO::DirectoryRecordHeader const& record, Bytes buffer);
void create_metadata();

View File

@ -57,8 +57,8 @@ public:
virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) = 0;
virtual ErrorOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& data, OpenFileDescription*) = 0;
virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) = 0;
virtual ErrorOr<void> add_child(Inode&, const StringView& name, mode_t) = 0;
virtual ErrorOr<void> remove_child(const StringView& name) = 0;
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) = 0;
virtual ErrorOr<void> remove_child(StringView name) = 0;
virtual ErrorOr<void> chmod(mode_t) = 0;
virtual ErrorOr<void> chown(UserID, GroupID) = 0;
virtual ErrorOr<void> truncate(u64) { return {}; }

View File

@ -112,7 +112,7 @@ public:
class Decoder {
public:
explicit Decoder(const StringView& data)
explicit Decoder(StringView data)
: m_data(data)
{
}
@ -144,8 +144,8 @@ public:
Message& operator<<(u16);
Message& operator<<(u32);
Message& operator<<(u64);
Message& operator<<(const StringView&);
void append_data(const StringView&);
Message& operator<<(StringView);
void append_data(StringView);
template<typename T>
Message& operator>>(T& t)
@ -228,7 +228,7 @@ ErrorOr<void> Plan9FS::initialize()
return {};
}
Plan9FS::ProtocolVersion Plan9FS::parse_protocol_version(const StringView& s) const
Plan9FS::ProtocolVersion Plan9FS::parse_protocol_version(StringView s) const
{
if (s == "9P2000.L")
return ProtocolVersion::v9P2000L;
@ -262,7 +262,7 @@ Plan9FS::Message& Plan9FS::Message::operator<<(u64 number)
return append_number(number);
}
Plan9FS::Message& Plan9FS::Message::operator<<(const StringView& string)
Plan9FS::Message& Plan9FS::Message::operator<<(StringView string)
{
*this << static_cast<u16>(string.length());
// FIXME: Handle append failure.
@ -270,7 +270,7 @@ Plan9FS::Message& Plan9FS::Message::operator<<(const StringView& string)
return *this;
}
void Plan9FS::Message::append_data(const StringView& data)
void Plan9FS::Message::append_data(StringView data)
{
*this << static_cast<u32>(data.length());
// FIXME: Handle append failure.
@ -908,13 +908,13 @@ ErrorOr<NonnullRefPtr<Inode>> Plan9FSInode::create_child(StringView, mode_t, dev
return ENOTIMPL;
}
ErrorOr<void> Plan9FSInode::add_child(Inode&, const StringView&, mode_t)
ErrorOr<void> Plan9FSInode::add_child(Inode&, StringView, mode_t)
{
// TODO
return ENOTIMPL;
}
ErrorOr<void> Plan9FSInode::remove_child(const StringView&)
ErrorOr<void> Plan9FSInode::remove_child(StringView)
{
// TODO
return ENOTIMPL;

View File

@ -122,7 +122,7 @@ private:
ErrorOr<void> post_message_and_wait_for_a_reply(Message&);
ErrorOr<void> post_message_and_explicitly_ignore_reply(Message&);
ProtocolVersion parse_protocol_version(const StringView&) const;
ProtocolVersion parse_protocol_version(StringView) const;
size_t adjust_buffer_size(size_t size) const;
void thread_main();
@ -161,8 +161,8 @@ public:
virtual ErrorOr<void> traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override;
virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<void> add_child(Inode&, const StringView& name, mode_t) override;
virtual ErrorOr<void> remove_child(const StringView& name) override;
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override;
virtual ErrorOr<void> remove_child(StringView name) override;
virtual ErrorOr<void> chmod(mode_t) override;
virtual ErrorOr<void> chown(UserID, GroupID) override;
virtual ErrorOr<void> truncate(u64) override;

View File

@ -75,7 +75,7 @@ ErrorOr<void> ProcFSInode::flush_metadata()
return {};
}
ErrorOr<void> ProcFSInode::add_child(Inode&, const StringView&, mode_t)
ErrorOr<void> ProcFSInode::add_child(Inode&, StringView, mode_t)
{
return EROFS;
}
@ -85,7 +85,7 @@ ErrorOr<NonnullRefPtr<Inode>> ProcFSInode::create_child(StringView, mode_t, dev_
return EROFS;
}
ErrorOr<void> ProcFSInode::remove_child(const StringView&)
ErrorOr<void> ProcFSInode::remove_child(StringView)
{
return EROFS;
}

View File

@ -58,8 +58,8 @@ protected:
virtual void did_seek(OpenFileDescription&, off_t) = 0;
virtual ErrorOr<void> flush_metadata() override final;
virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override final;
virtual ErrorOr<void> add_child(Inode&, const StringView& name, mode_t) override final;
virtual ErrorOr<void> remove_child(const StringView& name) override final;
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override final;
virtual ErrorOr<void> remove_child(StringView name) override final;
virtual ErrorOr<void> chmod(mode_t) override final;
virtual ErrorOr<void> chown(UserID, GroupID) override final;
};

View File

@ -163,12 +163,12 @@ ErrorOr<NonnullRefPtr<Inode>> SysFSInode::create_child(StringView, mode_t, dev_t
return EROFS;
}
ErrorOr<void> SysFSInode::add_child(Inode&, StringView const&, mode_t)
ErrorOr<void> SysFSInode::add_child(Inode&, StringView, mode_t)
{
return EROFS;
}
ErrorOr<void> SysFSInode::remove_child(StringView const&)
ErrorOr<void> SysFSInode::remove_child(StringView)
{
return EROFS;
}

View File

@ -141,8 +141,8 @@ protected:
virtual InodeMetadata metadata() const override;
virtual ErrorOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const&, OpenFileDescription*) override;
virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<void> add_child(Inode&, StringView const& name, mode_t) override;
virtual ErrorOr<void> remove_child(StringView const& name) override;
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override;
virtual ErrorOr<void> remove_child(StringView name) override;
virtual ErrorOr<void> chmod(mode_t) override;
virtual ErrorOr<void> chown(UserID, GroupID) override;
virtual ErrorOr<void> truncate(u64) override;

View File

@ -269,7 +269,7 @@ ErrorOr<NonnullRefPtr<Inode>> TmpFSInode::create_child(StringView name, mode_t m
return child;
}
ErrorOr<void> TmpFSInode::add_child(Inode& child, StringView const& name, mode_t)
ErrorOr<void> TmpFSInode::add_child(Inode& child, StringView name, mode_t)
{
VERIFY(is_directory());
VERIFY(child.fsid() == fsid());
@ -289,7 +289,7 @@ ErrorOr<void> TmpFSInode::add_child(Inode& child, StringView const& name, mode_t
return {};
}
ErrorOr<void> TmpFSInode::remove_child(StringView const& name)
ErrorOr<void> TmpFSInode::remove_child(StringView name)
{
MutexLocker locker(m_inode_lock);
VERIFY(is_directory());

View File

@ -59,8 +59,8 @@ public:
virtual ErrorOr<void> flush_metadata() override;
virtual ErrorOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, OpenFileDescription*) override;
virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<void> add_child(Inode&, const StringView& name, mode_t) override;
virtual ErrorOr<void> remove_child(const StringView& name) override;
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override;
virtual ErrorOr<void> remove_child(StringView name) override;
virtual ErrorOr<void> chmod(mode_t) override;
virtual ErrorOr<void> chown(UserID, GroupID) override;
virtual ErrorOr<void> truncate(u64) override;

View File

@ -328,7 +328,7 @@ class Parser;
namespace StaticParsing {
Optional<PhysicalAddress> find_rsdp();
Optional<PhysicalAddress> find_table(PhysicalAddress rsdp, const StringView& signature);
Optional<PhysicalAddress> find_table(PhysicalAddress rsdp, StringView signature);
}
}

View File

@ -75,7 +75,7 @@ UNMAP_AFTER_INIT ACPISysFSDirectory::ACPISysFSDirectory(FirmwareSysFSDirectory&
{
NonnullRefPtrVector<SysFSComponent> components;
size_t ssdt_count = 0;
ACPI::Parser::the()->enumerate_static_tables([&](const StringView& signature, PhysicalAddress p_table, size_t length) {
ACPI::Parser::the()->enumerate_static_tables([&](StringView signature, PhysicalAddress p_table, size_t length) {
if (signature == "SSDT") {
components.append(ACPISysFSComponent::create(String::formatted("{:4s}{}", signature.characters_without_null_termination(), ssdt_count), p_table, length));
ssdt_count++;
@ -96,7 +96,7 @@ UNMAP_AFTER_INIT ACPISysFSDirectory::ACPISysFSDirectory(FirmwareSysFSDirectory&
}
}
void Parser::enumerate_static_tables(Function<void(const StringView&, PhysicalAddress, size_t)> callback)
void Parser::enumerate_static_tables(Function<void(StringView, PhysicalAddress, size_t)> callback)
{
for (auto& p_table : m_sdt_pointers) {
auto table = Memory::map_typed<Structures::SDTHeader>(p_table);
@ -104,9 +104,9 @@ void Parser::enumerate_static_tables(Function<void(const StringView&, PhysicalAd
}
}
static bool match_table_signature(PhysicalAddress table_header, const StringView& signature);
static Optional<PhysicalAddress> search_table_in_xsdt(PhysicalAddress xsdt, const StringView& signature);
static Optional<PhysicalAddress> search_table_in_rsdt(PhysicalAddress rsdt, const StringView& signature);
static bool match_table_signature(PhysicalAddress table_header, StringView signature);
static Optional<PhysicalAddress> search_table_in_xsdt(PhysicalAddress xsdt, StringView signature);
static Optional<PhysicalAddress> search_table_in_rsdt(PhysicalAddress rsdt, StringView signature);
static bool validate_table(const Structures::SDTHeader&, size_t length);
UNMAP_AFTER_INIT void Parser::locate_static_data()
@ -116,7 +116,7 @@ UNMAP_AFTER_INIT void Parser::locate_static_data()
process_fadt_data();
}
UNMAP_AFTER_INIT Optional<PhysicalAddress> Parser::find_table(const StringView& signature)
UNMAP_AFTER_INIT Optional<PhysicalAddress> Parser::find_table(StringView signature)
{
dbgln_if(ACPI_DEBUG, "ACPI: Calling Find Table method!");
for (auto p_sdt : m_sdt_pointers) {
@ -383,7 +383,7 @@ UNMAP_AFTER_INIT Optional<PhysicalAddress> StaticParsing::find_rsdp()
return map_bios().find_chunk_starting_with(signature, 16);
}
UNMAP_AFTER_INIT Optional<PhysicalAddress> StaticParsing::find_table(PhysicalAddress rsdp_address, const StringView& signature)
UNMAP_AFTER_INIT Optional<PhysicalAddress> StaticParsing::find_table(PhysicalAddress rsdp_address, StringView signature)
{
// FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables.
VERIFY(signature.length() == 4);
@ -401,7 +401,7 @@ UNMAP_AFTER_INIT Optional<PhysicalAddress> StaticParsing::find_table(PhysicalAdd
VERIFY_NOT_REACHED();
}
UNMAP_AFTER_INIT static Optional<PhysicalAddress> search_table_in_xsdt(PhysicalAddress xsdt_address, const StringView& signature)
UNMAP_AFTER_INIT static Optional<PhysicalAddress> search_table_in_xsdt(PhysicalAddress xsdt_address, StringView signature)
{
// FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables.
VERIFY(signature.length() == 4);
@ -415,7 +415,7 @@ UNMAP_AFTER_INIT static Optional<PhysicalAddress> search_table_in_xsdt(PhysicalA
return {};
}
static bool match_table_signature(PhysicalAddress table_header, const StringView& signature)
static bool match_table_signature(PhysicalAddress table_header, StringView signature)
{
// FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables.
VERIFY(signature.length() == 4);
@ -424,7 +424,7 @@ static bool match_table_signature(PhysicalAddress table_header, const StringView
return !strncmp(table->h.sig, signature.characters_without_null_termination(), 4);
}
UNMAP_AFTER_INIT static Optional<PhysicalAddress> search_table_in_rsdt(PhysicalAddress rsdt_address, const StringView& signature)
UNMAP_AFTER_INIT static Optional<PhysicalAddress> search_table_in_rsdt(PhysicalAddress rsdt_address, StringView signature)
{
// FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables.
VERIFY(signature.length() == 4);

View File

@ -51,7 +51,7 @@ public:
virtual StringView purpose() const override { return "ACPI Parser"sv; }
virtual bool handle_irq(const RegisterState&) override;
Optional<PhysicalAddress> find_table(const StringView& signature);
Optional<PhysicalAddress> find_table(StringView signature);
void try_acpi_reboot();
bool can_reboot();
@ -64,7 +64,7 @@ public:
PhysicalAddress main_system_description_table() const { return m_main_system_description_table; }
bool is_xsdt_supported() const { return m_xsdt_supported; }
void enumerate_static_tables(Function<void(const StringView&, PhysicalAddress, size_t)>);
void enumerate_static_tables(Function<void(StringView, PhysicalAddress, size_t)>);
virtual bool have_8042() const
{

View File

@ -66,7 +66,7 @@ ErrorOr<void> KBufferBuilder::append_bytes(ReadonlyBytes bytes)
return {};
}
ErrorOr<void> KBufferBuilder::append(const StringView& str)
ErrorOr<void> KBufferBuilder::append(StringView str)
{
if (str.is_empty())
return {};
@ -97,7 +97,7 @@ ErrorOr<void> KBufferBuilder::append(char ch)
return {};
}
ErrorOr<void> KBufferBuilder::append_escaped_for_json(const StringView& string)
ErrorOr<void> KBufferBuilder::append_escaped_for_json(StringView string)
{
for (auto ch : string) {
switch (ch) {

View File

@ -24,11 +24,11 @@ public:
KBufferBuilder& operator=(KBufferBuilder&&) = default;
~KBufferBuilder() = default;
ErrorOr<void> append(const StringView&);
ErrorOr<void> append(StringView);
ErrorOr<void> append(char);
ErrorOr<void> append(const char*, int);
ErrorOr<void> append_escaped_for_json(const StringView&);
ErrorOr<void> append_escaped_for_json(StringView);
ErrorOr<void> append_bytes(ReadonlyBytes);
template<typename... Parameters>

View File

@ -11,12 +11,12 @@ namespace Kernel::KLexicalPath {
static StringView const s_single_dot = "."sv;
bool is_absolute(StringView const& path)
bool is_absolute(StringView path)
{
return !path.is_empty() && path[0] == '/';
}
bool is_canonical(StringView const& path)
bool is_canonical(StringView path)
{
// FIXME: This can probably be done more efficiently.
if (path.is_empty())
@ -32,7 +32,7 @@ bool is_canonical(StringView const& path)
return true;
}
StringView basename(StringView const& a_path)
StringView basename(StringView a_path)
{
if (a_path == "/"sv)
return a_path;
@ -49,7 +49,7 @@ StringView basename(StringView const& a_path)
return basename;
}
StringView dirname(StringView const& path)
StringView dirname(StringView path)
{
VERIFY(is_canonical(path));
auto slash_index = path.find_last('/');
@ -57,13 +57,13 @@ StringView dirname(StringView const& path)
return path.substring_view(0, *slash_index);
}
Vector<StringView> parts(StringView const& path)
Vector<StringView> parts(StringView path)
{
VERIFY(is_canonical(path));
return path.split_view('/');
}
ErrorOr<NonnullOwnPtr<KString>> try_join(StringView const& first, StringView const& second)
ErrorOr<NonnullOwnPtr<KString>> try_join(StringView first, StringView second)
{
VERIFY(is_canonical(first));
VERIFY(is_canonical(second));

View File

@ -11,12 +11,12 @@
namespace Kernel::KLexicalPath {
bool is_absolute(StringView const&);
bool is_canonical(StringView const&);
StringView basename(StringView const&);
StringView dirname(StringView const&);
Vector<StringView> parts(StringView const&);
bool is_absolute(StringView);
bool is_canonical(StringView);
StringView basename(StringView);
StringView dirname(StringView);
Vector<StringView> parts(StringView);
ErrorOr<NonnullOwnPtr<KString>> try_join(StringView const&, StringView const&);
ErrorOr<NonnullOwnPtr<KString>> try_join(StringView, StringView);
}

View File

@ -33,7 +33,7 @@ static u8 parse_hex_digit(char nibble)
return 10 + (nibble - 'a');
}
FlatPtr address_for_kernel_symbol(const StringView& name)
FlatPtr address_for_kernel_symbol(StringView name)
{
for (size_t i = 0; i < s_symbol_count; ++i) {
const auto& symbol = s_symbols[i];

View File

@ -20,7 +20,7 @@ enum class PrintToScreen {
Yes,
};
FlatPtr address_for_kernel_symbol(const StringView& name);
FlatPtr address_for_kernel_symbol(StringView name);
const KernelSymbol* symbolicate_kernel_address(FlatPtr);
void load_kernel_symbol_table();

View File

@ -63,7 +63,7 @@ RefPtr<NetworkAdapter> NetworkingManagement::from_ipv4_address(const IPv4Address
return m_loopback_adapter;
return {};
}
RefPtr<NetworkAdapter> NetworkingManagement::lookup_by_name(const StringView& name) const
RefPtr<NetworkAdapter> NetworkingManagement::lookup_by_name(StringView name) const
{
MutexLocker locker(m_lock);
RefPtr<NetworkAdapter> found_adapter;

View File

@ -34,7 +34,7 @@ public:
void for_each(Function<void(NetworkAdapter&)>);
RefPtr<NetworkAdapter> from_ipv4_address(const IPv4Address&) const;
RefPtr<NetworkAdapter> lookup_by_name(const StringView&) const;
RefPtr<NetworkAdapter> lookup_by_name(StringView) const;
NonnullRefPtr<NetworkAdapter> loopback_adapter() const;

View File

@ -21,7 +21,7 @@ PerformanceEventBuffer::PerformanceEventBuffer(NonnullOwnPtr<KBuffer> buffer)
{
}
NEVER_INLINE ErrorOr<void> PerformanceEventBuffer::append(int type, FlatPtr arg1, FlatPtr arg2, const StringView& arg3, Thread* current_thread)
NEVER_INLINE ErrorOr<void> PerformanceEventBuffer::append(int type, FlatPtr arg1, FlatPtr arg2, StringView arg3, Thread* current_thread)
{
FlatPtr ebp;
asm volatile("movl %%ebp, %%eax"
@ -56,13 +56,13 @@ static Vector<FlatPtr, PerformanceEvent::max_stack_frame_count> raw_backtrace(Fl
}
ErrorOr<void> PerformanceEventBuffer::append_with_ip_and_bp(ProcessID pid, ThreadID tid, const RegisterState& regs,
int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, const StringView& arg3)
int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, StringView arg3)
{
return append_with_ip_and_bp(pid, tid, regs.ip(), regs.bp(), type, lost_samples, arg1, arg2, arg3);
}
ErrorOr<void> PerformanceEventBuffer::append_with_ip_and_bp(ProcessID pid, ThreadID tid,
FlatPtr ip, FlatPtr bp, int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, const StringView& arg3)
FlatPtr ip, FlatPtr bp, int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, StringView arg3)
{
if (count() >= capacity())
return ENOBUFS;

View File

@ -101,11 +101,11 @@ class PerformanceEventBuffer {
public:
static OwnPtr<PerformanceEventBuffer> try_create_with_size(size_t buffer_size);
ErrorOr<void> append(int type, FlatPtr arg1, FlatPtr arg2, const StringView& arg3, Thread* current_thread = Thread::current());
ErrorOr<void> append(int type, FlatPtr arg1, FlatPtr arg2, StringView arg3, Thread* current_thread = Thread::current());
ErrorOr<void> append_with_ip_and_bp(ProcessID pid, ThreadID tid, FlatPtr eip, FlatPtr ebp,
int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, const StringView& arg3);
int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, StringView arg3);
ErrorOr<void> append_with_ip_and_bp(ProcessID pid, ThreadID tid, const RegisterState& regs,
int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, const StringView& arg3);
int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, StringView arg3);
void clear()
{

View File

@ -328,7 +328,7 @@ void VirtualConsole::beep()
dbgln("Beep!1");
}
void VirtualConsole::set_window_title(const StringView&)
void VirtualConsole::set_window_title(StringView)
{
// Do nothing.
}

View File

@ -97,7 +97,7 @@ private:
// ^TerminalClient
virtual void beep() override;
virtual void set_window_title(const StringView&) override;
virtual void set_window_title(StringView) override;
virtual void set_window_progress(int, int) override;
virtual void terminal_did_resize(u16 columns, u16 rows) override;
virtual void terminal_history_changed(int) override;
@ -123,7 +123,7 @@ private:
void clear();
void inject_string(const StringView&);
void inject_string(StringView);
Cell& cell_at(size_t column, size_t row);

View File

@ -126,7 +126,7 @@ struct UnicodeData {
NormalizationProps normalization_props;
};
static Vector<u32> parse_code_point_list(StringView const& list)
static Vector<u32> parse_code_point_list(StringView list)
{
Vector<u32> code_points;
@ -137,7 +137,7 @@ static Vector<u32> parse_code_point_list(StringView const& list)
return code_points;
}
static CodePointRange parse_code_point_range(StringView const& list)
static CodePointRange parse_code_point_range(StringView list)
{
CodePointRange code_point_range {};
@ -532,14 +532,14 @@ u32 simple_lowercase_mapping(u32 code_point);
Span<SpecialCasing const* const> special_case_mapping(u32 code_point);
bool code_point_has_general_category(u32 code_point, GeneralCategory general_category);
Optional<GeneralCategory> general_category_from_string(StringView const& general_category);
Optional<GeneralCategory> general_category_from_string(StringView general_category);
bool code_point_has_property(u32 code_point, Property property);
Optional<Property> property_from_string(StringView const& property);
Optional<Property> property_from_string(StringView property);
bool code_point_has_script(u32 code_point, Script script);
bool code_point_has_script_extension(u32 code_point, Script script);
Optional<Script> script_from_string(StringView const& script);
Optional<Script> script_from_string(StringView script);
}

View File

@ -660,32 +660,32 @@ namespace Unicode {
generator.append(R"~~~(
namespace Detail {
Optional<Locale> locale_from_string(StringView const& locale);
Optional<Locale> locale_from_string(StringView locale);
Optional<StringView> get_locale_language_mapping(StringView locale, StringView language);
Optional<Language> language_from_string(StringView const& language);
Optional<StringView> resolve_language_alias(StringView const& language);
Optional<Language> language_from_string(StringView language);
Optional<StringView> resolve_language_alias(StringView language);
Optional<StringView> get_locale_territory_mapping(StringView locale, StringView territory);
Optional<Territory> territory_from_string(StringView const& territory);
Optional<StringView> resolve_territory_alias(StringView const& territory);
Optional<Territory> territory_from_string(StringView territory);
Optional<StringView> resolve_territory_alias(StringView territory);
Optional<StringView> get_locale_script_tag_mapping(StringView locale, StringView script_tag);
Optional<ScriptTag> script_tag_from_string(StringView const& script_tag);
Optional<StringView> resolve_script_tag_alias(StringView const& script_tag);
Optional<ScriptTag> script_tag_from_string(StringView script_tag);
Optional<StringView> resolve_script_tag_alias(StringView script_tag);
Optional<StringView> get_locale_currency_mapping(StringView locale, StringView currency);
Optional<Currency> currency_from_string(StringView const& currency);
Optional<Currency> currency_from_string(StringView currency);
Optional<StringView> get_locale_key_mapping(StringView locale, StringView key);
Optional<Key> key_from_string(StringView const& key);
Optional<Key> key_from_string(StringView key);
Optional<ListPatterns> get_locale_list_pattern_mapping(StringView locale, StringView list_pattern_type, StringView list_pattern_style);
Optional<ListPatternType> list_pattern_type_from_string(StringView const& list_pattern_type);
Optional<ListPatternStyle> list_pattern_style_from_string(StringView const& list_pattern_style);
Optional<ListPatternType> list_pattern_type_from_string(StringView list_pattern_type);
Optional<ListPatternStyle> list_pattern_style_from_string(StringView list_pattern_style);
Optional<StringView> resolve_variant_alias(StringView const& variant);
Optional<StringView> resolve_subdivision_alias(StringView const& subdivision);
Optional<StringView> resolve_variant_alias(StringView variant);
Optional<StringView> resolve_subdivision_alias(StringView subdivision);
void resolve_complex_language_aliases(Unicode::LanguageID& language_id);

View File

@ -59,7 +59,7 @@ void generate_value_from_string(SourceGenerator& generator, StringView method_na
generator.set("size", String::number(hashes.size()));
generator.append(R"~~~(
Optional<@return_type@> @method_name@(StringView const& key)
Optional<@return_type@> @method_name@(StringView key)
{
constexpr Array<HashValuePair<@value_type@>, @size@> hash_pairs { {
)~~~");

View File

@ -96,7 +96,7 @@ PropertyID property_id_from_camel_case_string(StringView string)
return PropertyID::Invalid;
}
PropertyID property_id_from_string(const StringView& string)
PropertyID property_id_from_string(StringView string)
{
)~~~");

View File

@ -102,7 +102,7 @@ enum class PropertyID {
};
PropertyID property_id_from_camel_case_string(StringView);
PropertyID property_id_from_string(const StringView&);
PropertyID property_id_from_string(StringView);
const char* string_from_property_id(PropertyID);
bool is_inherited_property(PropertyID);
NonnullRefPtr<StyleValue> property_initial_value(PropertyID);

View File

@ -49,7 +49,7 @@ int main(int argc, char** argv)
namespace Web::CSS {
ValueID value_id_from_string(const StringView& string)
ValueID value_id_from_string(StringView string)
{
)~~~");

View File

@ -66,7 +66,7 @@ enum class ValueID {
generator.append(R"~~~(
};
ValueID value_id_from_string(const StringView&);
ValueID value_id_from_string(StringView);
const char* string_from_value_id(ValueID);
}

View File

@ -235,7 +235,7 @@ static NonnullOwnPtr<Interface> parse_interface(StringView filename, StringView
}
};
auto assert_string = [&](StringView const& expected) {
auto assert_string = [&](StringView expected) {
if (!lexer.consume_specific(expected))
report_parsing_error(String::formatted("expected '{}'", expected), filename, input, lexer.tell());
};
@ -1267,7 +1267,7 @@ enum class WrappingReference {
Yes,
};
static void generate_wrap_statement(SourceGenerator& generator, String const& value, IDL::Type const& type, StringView const& result_expression, WrappingReference wrapping_reference = WrappingReference::No, size_t recursion_depth = 0)
static void generate_wrap_statement(SourceGenerator& generator, String const& value, IDL::Type const& type, StringView result_expression, WrappingReference wrapping_reference = WrappingReference::No, size_t recursion_depth = 0)
{
auto scoped_generator = generator.fork();
scoped_generator.set("value", value);

View File

@ -77,7 +77,7 @@ static Vector<ComponentData> read_component_data(Core::ConfigFile const& config_
return components;
}
static Result<Vector<String>, int> run_whiptail(WhiptailMode mode, Vector<WhiptailOption> const& options, StringView const& title, StringView const& description)
static Result<Vector<String>, int> run_whiptail(WhiptailMode mode, Vector<WhiptailOption> const& options, StringView title, StringView description)
{
struct winsize w;
if (ioctl(0, TIOCGWINSZ, &w) < 0) {
@ -198,7 +198,7 @@ static Result<Vector<String>, int> run_whiptail(WhiptailMode mode, Vector<Whipta
return data.split('\n', false);
}
static bool run_system_command(String const& command, StringView const& command_name)
static bool run_system_command(String const& command, StringView command_name)
{
if (command.starts_with("cmake"))
warnln("\e[34mRunning CMake...\e[0m");

View File

@ -84,7 +84,7 @@ TESTJS_RUN_FILE_FUNCTION(String const& test_file, JS::Interpreter& interpreter)
auto start_time = Test::get_time_in_ms();
LexicalPath path(test_file);
auto& dirname = path.dirname();
auto dirname = path.dirname();
enum {
Early,
Fail,

View File

@ -63,7 +63,7 @@ using Token = Web::HTML::HTMLToken;
VERIFY(last_token); \
EXPECT_EQ(last_token->attribute_count(), (size_t)(count));
static Vector<Token> run_tokenizer(StringView const& input)
static Vector<Token> run_tokenizer(StringView input)
{
Vector<Token> tokens;
Tokenizer tokenizer { input, "UTF-8"sv };

View File

@ -28,7 +28,7 @@ class BookmarkEditor final : public GUI::Dialog {
public:
static Vector<JsonValue>
edit_bookmark(Window* parent_window, const StringView& title, const StringView& url)
edit_bookmark(Window* parent_window, StringView title, StringView url)
{
auto editor = BookmarkEditor::construct(parent_window, title, url);
editor->set_title("Edit Bookmark");
@ -41,7 +41,7 @@ public:
}
private:
BookmarkEditor(Window* parent_window, const StringView& title, const StringView& url)
BookmarkEditor(Window* parent_window, StringView title, StringView url)
: Dialog(parent_window)
{
auto& widget = set_main_widget<GUI::Widget>();

View File

@ -123,7 +123,7 @@ void ConsoleWidget::handle_console_messages(i32 start_index, const Vector<String
request_console_messages();
}
void ConsoleWidget::print_source_line(const StringView& source)
void ConsoleWidget::print_source_line(StringView source)
{
StringBuilder html;
html.append("<span class=\"repl-indicator\">");
@ -135,7 +135,7 @@ void ConsoleWidget::print_source_line(const StringView& source)
print_html(html.string_view());
}
void ConsoleWidget::print_html(StringView const& line)
void ConsoleWidget::print_html(StringView line)
{
StringBuilder builder;
builder.append(R"~~~(

View File

@ -21,8 +21,8 @@ public:
void notify_about_new_console_message(i32 message_index);
void handle_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages);
void print_source_line(const StringView&);
void print_html(const StringView&);
void print_source_line(StringView);
void print_html(StringView);
void reset();
Function<void(const String&)> on_js_input;

View File

@ -405,7 +405,7 @@ bool DirectoryView::open(String const& path)
return true;
}
void DirectoryView::set_status_message(StringView const& message)
void DirectoryView::set_status_message(StringView message)
{
if (on_status_message)
on_status_message(message);

View File

@ -66,10 +66,10 @@ public:
void launch(URL const&, LauncherHandler const&) const;
Function<void(StringView const& path, bool can_read_in_path, bool can_write_in_path)> on_path_change;
Function<void(StringView path, bool can_read_in_path, bool can_write_in_path)> on_path_change;
Function<void(GUI::AbstractView&)> on_selection_change;
Function<void(GUI::ModelIndex const&, GUI::ContextMenuEvent const&)> on_context_menu_request;
Function<void(StringView const&)> on_status_message;
Function<void(StringView)> on_status_message;
Function<void(int done, int total)> on_thumbnail_progress;
Function<void()> on_accepted_drop;
@ -156,7 +156,7 @@ private:
void handle_activation(GUI::ModelIndex const&);
void set_status_message(StringView const&);
void set_status_message(StringView);
void update_statusbar();
Mode m_mode { Mode::Normal };

View File

@ -115,7 +115,7 @@ void FileOperationProgressWidget::did_finish()
window()->close();
}
void FileOperationProgressWidget::did_error(StringView const& message)
void FileOperationProgressWidget::did_error(StringView message)
{
// FIXME: Communicate more with the user about errors.
close_pipe();
@ -157,7 +157,7 @@ String FileOperationProgressWidget::estimate_time(off_t bytes_done, off_t total_
return String::formatted("{} hours and {} minutes", hours_remaining, minutes_remaining);
}
void FileOperationProgressWidget::did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, [[maybe_unused]] off_t current_file_done, [[maybe_unused]] off_t current_file_size, StringView const& current_filename)
void FileOperationProgressWidget::did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, [[maybe_unused]] off_t current_file_done, [[maybe_unused]] off_t current_file_size, StringView current_filename)
{
auto& files_copied_label = *find_descendant_of_type_named<GUI::Label>("files_copied_label");
auto& current_file_label = *find_descendant_of_type_named<GUI::Label>("current_file_label");

View File

@ -22,8 +22,8 @@ private:
FileOperationProgressWidget(FileOperation, NonnullRefPtr<Core::File> helper_pipe);
void did_finish();
void did_error(StringView const& message);
void did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, off_t current_file_done, off_t current_file_size, StringView const& current_filename);
void did_error(StringView message);
void did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, off_t current_file_done, off_t current_file_size, StringView current_filename);
void close_pipe();

View File

@ -1020,7 +1020,7 @@ int run_in_windowed_mode(String initial_location, String entry_focused_on_init)
refresh_tree_view();
};
directory_view.on_status_message = [&](StringView const& message) {
directory_view.on_status_message = [&](StringView message) {
statusbar.set_text(message);
};

View File

@ -6,7 +6,7 @@
#include "History.h"
void History::push(const StringView& history_item)
void History::push(StringView history_item)
{
if (!m_items.is_empty() && m_items[m_current_history_item] == history_item)
return;

View File

@ -11,7 +11,7 @@
class History final {
public:
void push(const StringView& history_item);
void push(StringView history_item);
String current();
void go_back();

View File

@ -31,7 +31,7 @@ ManualModel::ManualModel()
m_page_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-unknown.png").release_value_but_fixme_should_propagate_errors());
}
Optional<GUI::ModelIndex> ManualModel::index_from_path(const StringView& path) const
Optional<GUI::ModelIndex> ManualModel::index_from_path(StringView path) const
{
for (int section = 0; section < row_count(); ++section) {
auto parent_index = index(section, 0);

View File

@ -21,7 +21,7 @@ public:
virtual ~ManualModel() override {};
Optional<GUI::ModelIndex> index_from_path(const StringView&) const;
Optional<GUI::ModelIndex> index_from_path(StringView) const;
String page_path(const GUI::ModelIndex&) const;
String page_and_section(const GUI::ModelIndex&) const;

View File

@ -14,7 +14,7 @@ class ManualPageNode : public ManualNode {
public:
virtual ~ManualPageNode() override { }
ManualPageNode(const ManualSectionNode& section, const StringView& page)
ManualPageNode(const ManualSectionNode& section, StringView page)
: m_section(section)
, m_page(page)
{

View File

@ -324,7 +324,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window)
help_menu.add_action(GUI::CommonActions::make_about_action("Hex Editor", GUI::Icon::default_icon("app-hex-editor"), &window));
}
void HexEditorWidget::set_path(StringView const& path)
void HexEditorWidget::set_path(StringView path)
{
if (path.is_empty()) {
m_path = {};

View File

@ -28,7 +28,7 @@ public:
private:
HexEditorWidget();
void set_path(StringView const&);
void set_path(StringView);
void update_title();
void set_search_results_visible(bool visible);

View File

@ -164,7 +164,7 @@ void KeyboardMapperWidget::save()
save_to_file(m_filename);
}
void KeyboardMapperWidget::save_to_file(const StringView& filename)
void KeyboardMapperWidget::save_to_file(StringView filename)
{
JsonObject map_json;

View File

@ -20,7 +20,7 @@ public:
void load_from_file(const String);
void load_from_system();
void save();
void save_to_file(const StringView&);
void save_to_file(StringView);
protected:
virtual void keydown_event(GUI::KeyEvent&) override;

Some files were not shown because too many files have changed in this diff Show More