1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:57:45 +00:00

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
392 changed files with 978 additions and 978 deletions

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);