diff options
author | Linus Groh <mail@linusgroh.de> | 2022-12-04 18:02:33 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-06 08:54:33 +0100 |
commit | 6e19ab2bbce0b113b628e6f8e9b5c0640053933e (patch) | |
tree | 372d21b2f5dcff112f5d0089559c6af5798680d4 /Userland/Libraries/LibIDL | |
parent | f74251606d74b504a1379ebb893fdb5529054ea5 (diff) | |
download | serenity-6e19ab2bbce0b113b628e6f8e9b5c0640053933e.zip |
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
Diffstat (limited to 'Userland/Libraries/LibIDL')
-rw-r--r-- | Userland/Libraries/LibIDL/IDLParser.cpp | 86 | ||||
-rw-r--r-- | Userland/Libraries/LibIDL/IDLParser.h | 28 | ||||
-rw-r--r-- | Userland/Libraries/LibIDL/Types.h | 96 |
3 files changed, 105 insertions, 105 deletions
diff --git a/Userland/Libraries/LibIDL/IDLParser.cpp b/Userland/Libraries/LibIDL/IDLParser.cpp index 48497b0e0e..7a71c01bf2 100644 --- a/Userland/Libraries/LibIDL/IDLParser.cpp +++ b/Userland/Libraries/LibIDL/IDLParser.cpp @@ -48,7 +48,7 @@ exit(EXIT_FAILURE); } -static String convert_enumeration_value_to_cpp_enum_member(String const& value, HashTable<String>& names_already_seen) +static DeprecatedString convert_enumeration_value_to_cpp_enum_member(DeprecatedString const& value, HashTable<DeprecatedString>& names_already_seen) { StringBuilder builder; GenericLexer lexer { value }; @@ -80,7 +80,7 @@ namespace IDL { void Parser::assert_specific(char ch) { if (!lexer.consume_specific(ch)) - report_parsing_error(String::formatted("expected '{}'", ch), filename, input, lexer.tell()); + report_parsing_error(DeprecatedString::formatted("expected '{}'", ch), filename, input, lexer.tell()); } void Parser::consume_whitespace() @@ -100,12 +100,12 @@ void Parser::consume_whitespace() void Parser::assert_string(StringView expected) { if (!lexer.consume_specific(expected)) - report_parsing_error(String::formatted("expected '{}'", expected), filename, input, lexer.tell()); + report_parsing_error(DeprecatedString::formatted("expected '{}'", expected), filename, input, lexer.tell()); } -HashMap<String, String> Parser::parse_extended_attributes() +HashMap<DeprecatedString, DeprecatedString> Parser::parse_extended_attributes() { - HashMap<String, String> extended_attributes; + HashMap<DeprecatedString, DeprecatedString> extended_attributes; for (;;) { consume_whitespace(); if (lexer.consume_specific(']')) @@ -133,24 +133,24 @@ HashMap<String, String> Parser::parse_extended_attributes() return extended_attributes; } -static HashTable<String> import_stack; +static HashTable<DeprecatedString> import_stack; Optional<Interface&> Parser::resolve_import(auto path) { auto include_path = LexicalPath::join(import_base_path, path).string(); if (!Core::File::exists(include_path)) - report_parsing_error(String::formatted("{}: No such file or directory", include_path), filename, input, lexer.tell()); + report_parsing_error(DeprecatedString::formatted("{}: No such file or directory", include_path), filename, input, lexer.tell()); auto real_path = Core::File::real_path_for(include_path); if (top_level_resolved_imports().contains(real_path)) return *top_level_resolved_imports().find(real_path)->value; if (import_stack.contains(real_path)) - report_parsing_error(String::formatted("Circular import detected: {}", include_path), filename, input, lexer.tell()); + report_parsing_error(DeprecatedString::formatted("Circular import detected: {}", include_path), filename, input, lexer.tell()); import_stack.set(real_path); auto file_or_error = Core::File::open(real_path, Core::OpenMode::ReadOnly); if (file_or_error.is_error()) - report_parsing_error(String::formatted("Failed to open {}: {}", real_path, file_or_error.error()), filename, input, lexer.tell()); + report_parsing_error(DeprecatedString::formatted("Failed to open {}: {}", real_path, file_or_error.error()), filename, input, lexer.tell()); auto data = file_or_error.value()->read_all(); auto& result = Parser(this, real_path, data, import_base_path).parse(); @@ -223,7 +223,7 @@ NonnullRefPtr<Type> Parser::parse_type() return adopt_ref(*new Type(builder.to_string(), nullable)); } -void Parser::parse_attribute(HashMap<String, String>& extended_attributes, Interface& interface) +void Parser::parse_attribute(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface& interface) { bool inherit = lexer.consume_specific("inherit"); if (inherit) @@ -244,8 +244,8 @@ void Parser::parse_attribute(HashMap<String, String>& extended_attributes, Inter assert_specific(';'); auto name_as_string = name.to_string(); - auto getter_callback_name = String::formatted("{}_getter", name_as_string.to_snakecase()); - auto setter_callback_name = String::formatted("{}_setter", name_as_string.to_snakecase()); + auto getter_callback_name = DeprecatedString::formatted("{}_getter", name_as_string.to_snakecase()); + auto setter_callback_name = DeprecatedString::formatted("{}_setter", name_as_string.to_snakecase()); Attribute attribute { inherit, @@ -289,7 +289,7 @@ Vector<Parameter> Parser::parse_parameters() for (;;) { if (lexer.next_is(')')) break; - HashMap<String, String> extended_attributes; + HashMap<DeprecatedString, DeprecatedString> extended_attributes; if (lexer.consume_specific('[')) extended_attributes = parse_extended_attributes(); bool optional = lexer.consume_specific("optional"); @@ -325,7 +325,7 @@ Vector<Parameter> Parser::parse_parameters() return parameters; } -Function Parser::parse_function(HashMap<String, String>& extended_attributes, Interface& interface, IsSpecialOperation is_special_operation) +Function Parser::parse_function(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface& interface, IsSpecialOperation is_special_operation) { bool static_ = false; if (lexer.consume_specific("static")) { @@ -369,7 +369,7 @@ void Parser::parse_constructor(Interface& interface) interface.constructors.append(Constructor { interface.name, move(parameters) }); } -void Parser::parse_stringifier(HashMap<String, String>& extended_attributes, Interface& interface) +void Parser::parse_stringifier(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface& interface) { assert_string("stringifier"sv); consume_whitespace(); @@ -405,14 +405,14 @@ void Parser::parse_iterable(Interface& interface) assert_specific(';'); } -void Parser::parse_getter(HashMap<String, String>& extended_attributes, Interface& interface) +void Parser::parse_getter(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface& interface) { assert_string("getter"sv); consume_whitespace(); auto function = parse_function(extended_attributes, interface, IsSpecialOperation::Yes); if (function.parameters.size() != 1) - report_parsing_error(String::formatted("Named/indexed property getters must have only 1 parameter, got {} parameters.", function.parameters.size()), filename, input, lexer.tell()); + report_parsing_error(DeprecatedString::formatted("Named/indexed property getters must have only 1 parameter, got {} parameters.", function.parameters.size()), filename, input, lexer.tell()); auto& identifier = function.parameters.first(); @@ -435,18 +435,18 @@ void Parser::parse_getter(HashMap<String, String>& extended_attributes, Interfac interface.indexed_property_getter = move(function); } else { - report_parsing_error(String::formatted("Named/indexed property getter's identifier's type must be either 'DOMString' or 'unsigned long', got '{}'.", identifier.type->name()), filename, input, lexer.tell()); + report_parsing_error(DeprecatedString::formatted("Named/indexed property getter's identifier's type must be either 'DOMString' or 'unsigned long', got '{}'.", identifier.type->name()), filename, input, lexer.tell()); } } -void Parser::parse_setter(HashMap<String, String>& extended_attributes, Interface& interface) +void Parser::parse_setter(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface& interface) { assert_string("setter"sv); consume_whitespace(); auto function = parse_function(extended_attributes, interface, IsSpecialOperation::Yes); if (function.parameters.size() != 2) - report_parsing_error(String::formatted("Named/indexed property setters must have only 2 parameters, got {} parameter(s).", function.parameters.size()), filename, input, lexer.tell()); + report_parsing_error(DeprecatedString::formatted("Named/indexed property setters must have only 2 parameters, got {} parameter(s).", function.parameters.size()), filename, input, lexer.tell()); auto& identifier = function.parameters.first(); @@ -475,18 +475,18 @@ void Parser::parse_setter(HashMap<String, String>& extended_attributes, Interfac interface.indexed_property_setter = move(function); } else { - report_parsing_error(String::formatted("Named/indexed property setter's identifier's type must be either 'DOMString' or 'unsigned long', got '{}'.", identifier.type->name()), filename, input, lexer.tell()); + report_parsing_error(DeprecatedString::formatted("Named/indexed property setter's identifier's type must be either 'DOMString' or 'unsigned long', got '{}'.", identifier.type->name()), filename, input, lexer.tell()); } } -void Parser::parse_deleter(HashMap<String, String>& extended_attributes, Interface& interface) +void Parser::parse_deleter(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface& interface) { assert_string("deleter"sv); consume_whitespace(); auto function = parse_function(extended_attributes, interface, IsSpecialOperation::Yes); if (function.parameters.size() != 1) - report_parsing_error(String::formatted("Named property deleter must have only 1 parameter, got {} parameters.", function.parameters.size()), filename, input, lexer.tell()); + report_parsing_error(DeprecatedString::formatted("Named property deleter must have only 1 parameter, got {} parameters.", function.parameters.size()), filename, input, lexer.tell()); auto& identifier = function.parameters.first(); @@ -507,7 +507,7 @@ void Parser::parse_deleter(HashMap<String, String>& extended_attributes, Interfa interface.named_property_deleter = move(function); } else { - report_parsing_error(String::formatted("Named property deleter's identifier's type must be 'DOMString', got '{}'.", identifier.type->name()), filename, input, lexer.tell()); + report_parsing_error(DeprecatedString::formatted("Named property deleter's identifier's type must be 'DOMString', got '{}'.", identifier.type->name()), filename, input, lexer.tell()); } } @@ -524,7 +524,7 @@ void Parser::parse_interface(Interface& interface) assert_specific('{'); for (;;) { - HashMap<String, String> extended_attributes; + HashMap<DeprecatedString, DeprecatedString> extended_attributes; consume_whitespace(); @@ -583,9 +583,9 @@ void Parser::parse_interface(Interface& interface) parse_function(extended_attributes, interface); } - interface.constructor_class = String::formatted("{}Constructor", interface.name); - interface.prototype_class = String::formatted("{}Prototype", interface.name); - interface.prototype_base_class = String::formatted("{}Prototype", interface.parent_name.is_empty() ? "Object" : interface.parent_name); + interface.constructor_class = DeprecatedString::formatted("{}Constructor", interface.name); + interface.prototype_class = DeprecatedString::formatted("{}Prototype", interface.name); + interface.prototype_base_class = DeprecatedString::formatted("{}Prototype", interface.parent_name.is_empty() ? "Object" : interface.parent_name); consume_whitespace(); } @@ -617,7 +617,7 @@ void Parser::parse_enumeration(Interface& interface) consume_whitespace(); if (enumeration.values.contains(string)) - report_parsing_error(String::formatted("Enumeration {} contains duplicate member '{}'", name, string), filename, input, lexer.tell()); + report_parsing_error(DeprecatedString::formatted("Enumeration {} contains duplicate member '{}'", name, string), filename, input, lexer.tell()); else enumeration.values.set(string); @@ -631,7 +631,7 @@ void Parser::parse_enumeration(Interface& interface) assert_specific('}'); assert_specific(';'); - HashTable<String> names_already_seen; + HashTable<DeprecatedString> names_already_seen; for (auto& entry : enumeration.values) enumeration.translated_cpp_names.set(entry, convert_enumeration_value_to_cpp_enum_member(entry, names_already_seen)); @@ -644,7 +644,7 @@ void Parser::parse_typedef(Interface& interface) assert_string("typedef"sv); consume_whitespace(); - HashMap<String, String> extended_attributes; + HashMap<DeprecatedString, DeprecatedString> extended_attributes; if (lexer.consume_specific('[')) extended_attributes = parse_extended_attributes(); @@ -685,7 +685,7 @@ void Parser::parse_dictionary(Interface& interface) } bool required = false; - HashMap<String, String> extended_attributes; + HashMap<DeprecatedString, DeprecatedString> extended_attributes; if (lexer.consume_specific("required")) { required = true; @@ -716,7 +716,7 @@ void Parser::parse_dictionary(Interface& interface) move(type), name, move(extended_attributes), - Optional<String>(move(default_value)), + Optional<DeprecatedString>(move(default_value)), }; dictionary.members.append(move(member)); } @@ -751,7 +751,7 @@ void Parser::parse_interface_mixin(Interface& interface) interface.mixins.set(move(name), &mixin_interface); } -void Parser::parse_callback_function(HashMap<String, String>& extended_attributes, Interface& interface) +void Parser::parse_callback_function(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface& interface) { assert_string("callback"sv); consume_whitespace(); @@ -779,7 +779,7 @@ void Parser::parse_non_interface_entities(bool allow_interface, Interface& inter consume_whitespace(); while (!lexer.is_eof()) { - HashMap<String, String> extended_attributes; + HashMap<DeprecatedString, DeprecatedString> extended_attributes; if (lexer.consume_specific('[')) extended_attributes = parse_extended_attributes(); if (lexer.next_is("dictionary")) { @@ -817,7 +817,7 @@ void Parser::parse_non_interface_entities(bool allow_interface, Interface& inter static void resolve_union_typedefs(Interface& interface, UnionType& union_); -static void resolve_typedef(Interface& interface, NonnullRefPtr<Type>& type, HashMap<String, String>* extended_attributes = {}) +static void resolve_typedef(Interface& interface, NonnullRefPtr<Type>& type, HashMap<DeprecatedString, DeprecatedString>* extended_attributes = {}) { if (is<ParameterizedType>(*type)) { auto& parameterized_type = type->as_parameterized(); @@ -890,7 +890,7 @@ Interface& Parser::parse() top_level_resolved_imports().set(this_module, &interface); Vector<Interface&> imports; - HashTable<String> required_imported_paths; + HashTable<DeprecatedString> required_imported_paths; while (lexer.consume_specific("#import")) { consume_whitespace(); assert_specific('<'); @@ -929,7 +929,7 @@ Interface& Parser::parse() for (auto& mixin : import.mixins) { if (auto it = interface.mixins.find(mixin.key); it != interface.mixins.end() && it->value != mixin.value) - report_parsing_error(String::formatted("Mixin '{}' was already defined in {}", mixin.key, mixin.value->module_own_path), filename, input, lexer.tell()); + report_parsing_error(DeprecatedString::formatted("Mixin '{}' was already defined in {}", mixin.key, mixin.value->module_own_path), filename, input, lexer.tell()); interface.mixins.set(mixin.key, mixin.value); } @@ -942,7 +942,7 @@ Interface& Parser::parse() for (auto& entry : it->value) { auto mixin_it = interface.mixins.find(entry); if (mixin_it == interface.mixins.end()) - report_parsing_error(String::formatted("Mixin '{}' was never defined", entry), filename, input, lexer.tell()); + report_parsing_error(DeprecatedString::formatted("Mixin '{}' was never defined", entry), filename, input, lexer.tell()); auto& mixin = mixin_it->value; interface.attributes.extend(mixin->attributes); @@ -950,7 +950,7 @@ Interface& Parser::parse() interface.functions.extend(mixin->functions); interface.static_functions.extend(mixin->static_functions); if (interface.has_stringifier && mixin->has_stringifier) - report_parsing_error(String::formatted("Both interface '{}' and mixin '{}' have defined stringifier attributes", interface.name, mixin->name), filename, input, lexer.tell()); + report_parsing_error(DeprecatedString::formatted("Both interface '{}' and mixin '{}' have defined stringifier attributes", interface.name, mixin->name), filename, input, lexer.tell()); if (mixin->has_stringifier) { interface.stringifier_attribute = mixin->stringifier_attribute; @@ -1033,7 +1033,7 @@ Interface& Parser::parse() return interface; } -Parser::Parser(String filename, StringView contents, String import_base_path) +Parser::Parser(DeprecatedString filename, StringView contents, DeprecatedString import_base_path) : import_base_path(move(import_base_path)) , filename(move(filename)) , input(contents) @@ -1041,7 +1041,7 @@ Parser::Parser(String filename, StringView contents, String import_base_path) { } -Parser::Parser(Parser* parent, String filename, StringView contents, String import_base_path) +Parser::Parser(Parser* parent, DeprecatedString filename, StringView contents, DeprecatedString import_base_path) : import_base_path(move(import_base_path)) , filename(move(filename)) , input(contents) @@ -1058,7 +1058,7 @@ Parser* Parser::top_level_parser() return current; } -HashMap<String, Interface*>& Parser::top_level_resolved_imports() +HashMap<DeprecatedString, Interface*>& Parser::top_level_resolved_imports() { return top_level_parser()->resolved_imports; } diff --git a/Userland/Libraries/LibIDL/IDLParser.h b/Userland/Libraries/LibIDL/IDLParser.h index 4c72030dcf..1233af275b 100644 --- a/Userland/Libraries/LibIDL/IDLParser.h +++ b/Userland/Libraries/LibIDL/IDLParser.h @@ -17,7 +17,7 @@ namespace IDL { class Parser { public: - Parser(String filename, StringView contents, String import_base_path); + Parser(DeprecatedString filename, StringView contents, DeprecatedString import_base_path); Interface& parse(); private: @@ -28,42 +28,42 @@ private: Yes, }; - Parser(Parser* parent, String filename, StringView contents, String import_base_path); + Parser(Parser* parent, DeprecatedString filename, StringView contents, DeprecatedString import_base_path); void assert_specific(char ch); void assert_string(StringView expected); void consume_whitespace(); Optional<Interface&> resolve_import(auto path); - HashMap<String, String> parse_extended_attributes(); - void parse_attribute(HashMap<String, String>& extended_attributes, Interface&); + HashMap<DeprecatedString, DeprecatedString> parse_extended_attributes(); + void parse_attribute(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface&); void parse_interface(Interface&); void parse_non_interface_entities(bool allow_interface, Interface&); void parse_enumeration(Interface&); void parse_typedef(Interface&); void parse_interface_mixin(Interface&); void parse_dictionary(Interface&); - void parse_callback_function(HashMap<String, String>& extended_attributes, Interface&); + void parse_callback_function(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface&); void parse_constructor(Interface&); - void parse_getter(HashMap<String, String>& extended_attributes, Interface&); - void parse_setter(HashMap<String, String>& extended_attributes, Interface&); - void parse_deleter(HashMap<String, String>& extended_attributes, Interface&); - void parse_stringifier(HashMap<String, String>& extended_attributes, Interface&); + void parse_getter(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface&); + void parse_setter(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface&); + void parse_deleter(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface&); + void parse_stringifier(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface&); void parse_iterable(Interface&); - Function parse_function(HashMap<String, String>& extended_attributes, Interface&, IsSpecialOperation is_special_operation = IsSpecialOperation::No); + Function parse_function(HashMap<DeprecatedString, DeprecatedString>& extended_attributes, Interface&, IsSpecialOperation is_special_operation = IsSpecialOperation::No); Vector<Parameter> parse_parameters(); NonnullRefPtr<Type> parse_type(); void parse_constant(Interface&); - String import_base_path; - String filename; + DeprecatedString import_base_path; + DeprecatedString filename; StringView input; GenericLexer lexer; HashTable<NonnullOwnPtr<Interface>>& top_level_interfaces(); HashTable<NonnullOwnPtr<Interface>> interfaces; - HashMap<String, Interface*>& top_level_resolved_imports(); - HashMap<String, Interface*> resolved_imports; + HashMap<DeprecatedString, Interface*>& top_level_resolved_imports(); + HashMap<DeprecatedString, Interface*> resolved_imports; Parser* top_level_parser(); Parser* parent = nullptr; }; diff --git a/Userland/Libraries/LibIDL/Types.h b/Userland/Libraries/LibIDL/Types.h index ba2a258eef..9f52afa39f 100644 --- a/Userland/Libraries/LibIDL/Types.h +++ b/Userland/Libraries/LibIDL/Types.h @@ -10,11 +10,11 @@ #pragma once +#include <AK/DeprecatedString.h> #include <AK/HashMap.h> #include <AK/NonnullRefPtr.h> #include <AK/NonnullRefPtrVector.h> #include <AK/SourceGenerator.h> -#include <AK/String.h> #include <AK/StringBuilder.h> #include <AK/Tuple.h> #include <AK/TypeCasts.h> @@ -38,7 +38,7 @@ enum class SequenceStorageType { }; struct CppType { - String name; + DeprecatedString name; SequenceStorageType sequence_storage_type; }; @@ -53,14 +53,14 @@ public: Union, }; - Type(String name, bool nullable) + Type(DeprecatedString name, bool nullable) : m_kind(Kind::Plain) , m_name(move(name)) , m_nullable(nullable) { } - Type(Kind kind, String name, bool nullable) + Type(Kind kind, DeprecatedString name, bool nullable) : m_kind(kind) , m_name(move(name)) , m_nullable(nullable) @@ -81,7 +81,7 @@ public: UnionType const& as_union() const; UnionType& as_union(); - String const& name() const { return m_name; } + DeprecatedString const& name() const { return m_name; } bool is_nullable() const { return m_nullable; } void set_nullable(bool value) { m_nullable = value; } @@ -138,24 +138,24 @@ public: private: Kind m_kind; - String m_name; + DeprecatedString m_name; bool m_nullable { false }; }; struct Parameter { NonnullRefPtr<Type> type; - String name; + DeprecatedString name; bool optional { false }; - Optional<String> optional_default_value; - HashMap<String, String> extended_attributes; + Optional<DeprecatedString> optional_default_value; + HashMap<DeprecatedString, DeprecatedString> extended_attributes; bool variadic { false }; }; struct Function { NonnullRefPtr<Type> return_type; - String name; + DeprecatedString name; Vector<Parameter> parameters; - HashMap<String, String> extended_attributes; + HashMap<DeprecatedString, DeprecatedString> extended_attributes; size_t overload_index { 0 }; bool is_overloaded { false }; @@ -163,7 +163,7 @@ struct Function { }; struct Constructor { - String name; + DeprecatedString name; Vector<Parameter> parameters; size_t shortest_length() const { return get_function_shortest_length(*this); } @@ -171,44 +171,44 @@ struct Constructor { struct Constant { NonnullRefPtr<Type> type; - String name; - String value; + DeprecatedString name; + DeprecatedString value; }; struct Attribute { bool inherit { false }; bool readonly { false }; NonnullRefPtr<Type> type; - String name; - HashMap<String, String> extended_attributes; + DeprecatedString name; + HashMap<DeprecatedString, DeprecatedString> extended_attributes; // Added for convenience after parsing - String getter_callback_name; - String setter_callback_name; + DeprecatedString getter_callback_name; + DeprecatedString setter_callback_name; }; struct DictionaryMember { bool required { false }; NonnullRefPtr<Type> type; - String name; - HashMap<String, String> extended_attributes; - Optional<String> default_value; + DeprecatedString name; + HashMap<DeprecatedString, DeprecatedString> extended_attributes; + Optional<DeprecatedString> default_value; }; struct Dictionary { - String parent_name; + DeprecatedString parent_name; Vector<DictionaryMember> members; }; struct Typedef { - HashMap<String, String> extended_attributes; + HashMap<DeprecatedString, DeprecatedString> extended_attributes; NonnullRefPtr<Type> type; }; struct Enumeration { - HashTable<String> values; - HashMap<String, String> translated_cpp_names; - String first_member; + HashTable<DeprecatedString> values; + HashMap<DeprecatedString, DeprecatedString> translated_cpp_names; + DeprecatedString first_member; bool is_original_definition { true }; }; @@ -222,7 +222,7 @@ class Interface; class ParameterizedType : public Type { public: - ParameterizedType(String name, bool nullable, NonnullRefPtrVector<Type> parameters) + ParameterizedType(DeprecatedString name, bool nullable, NonnullRefPtrVector<Type> parameters) : Type(Kind::Parameterized, move(name), nullable) , m_parameters(move(parameters)) { @@ -230,7 +230,7 @@ public: virtual ~ParameterizedType() override = default; - void generate_sequence_from_iterable(SourceGenerator& generator, String const& cpp_name, String const& iterable_cpp_name, String const& iterator_method_cpp_name, IDL::Interface const&, size_t recursion_depth) const; + void generate_sequence_from_iterable(SourceGenerator& generator, DeprecatedString const& cpp_name, DeprecatedString const& iterable_cpp_name, DeprecatedString const& iterator_method_cpp_name, IDL::Interface const&, size_t recursion_depth) const; NonnullRefPtrVector<Type> const& parameters() const { return m_parameters; } NonnullRefPtrVector<Type>& parameters() { return m_parameters; } @@ -254,12 +254,12 @@ class Interface { public: explicit Interface() = default; - String name; - String parent_name; + DeprecatedString name; + DeprecatedString parent_name; bool is_mixin { false }; - HashMap<String, String> extended_attributes; + HashMap<DeprecatedString, DeprecatedString> extended_attributes; Vector<Attribute> attributes; Vector<Constant> constants; @@ -267,7 +267,7 @@ public: Vector<Function> functions; Vector<Function> static_functions; bool has_stringifier { false }; - Optional<String> stringifier_attribute; + Optional<DeprecatedString> stringifier_attribute; bool has_unscopable_member { false }; Optional<NonnullRefPtr<Type>> value_iterator_type; @@ -281,25 +281,25 @@ public: Optional<Function> named_property_deleter; - HashMap<String, Dictionary> dictionaries; - HashMap<String, Enumeration> enumerations; - HashMap<String, Typedef> typedefs; - HashMap<String, Interface*> mixins; - HashMap<String, CallbackFunction> callback_functions; + HashMap<DeprecatedString, Dictionary> dictionaries; + HashMap<DeprecatedString, Enumeration> enumerations; + HashMap<DeprecatedString, Typedef> typedefs; + HashMap<DeprecatedString, Interface*> mixins; + HashMap<DeprecatedString, CallbackFunction> callback_functions; // Added for convenience after parsing - String fully_qualified_name; - String constructor_class; - String prototype_class; - String prototype_base_class; - HashMap<String, HashTable<String>> included_mixins; - - String module_own_path; - HashTable<String> required_imported_paths; + DeprecatedString fully_qualified_name; + DeprecatedString constructor_class; + DeprecatedString prototype_class; + DeprecatedString prototype_base_class; + HashMap<DeprecatedString, HashTable<DeprecatedString>> included_mixins; + + DeprecatedString module_own_path; + HashTable<DeprecatedString> required_imported_paths; Vector<Interface&> imported_modules; - HashMap<String, Vector<Function&>> overload_sets; - HashMap<String, Vector<Function&>> static_overload_sets; + HashMap<DeprecatedString, Vector<Function&>> overload_sets; + HashMap<DeprecatedString, Vector<Function&>> static_overload_sets; // https://webidl.spec.whatwg.org/#dfn-support-indexed-properties bool supports_indexed_properties() const { return indexed_property_getter.has_value(); } @@ -318,7 +318,7 @@ public: class UnionType : public Type { public: - UnionType(String name, bool nullable, NonnullRefPtrVector<Type> member_types) + UnionType(DeprecatedString name, bool nullable, NonnullRefPtrVector<Type> member_types) : Type(Kind::Union, move(name), nullable) , m_member_types(move(member_types)) { |