1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:07:34 +00:00

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 :^)
This commit is contained in:
Linus Groh 2022-12-04 18:02:33 +00:00 committed by Andreas Kling
parent f74251606d
commit 6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions

View file

@ -7,12 +7,12 @@
#pragma once
#include <AK/Debug.h>
#include <AK/DeprecatedString.h>
#include <AK/Function.h>
#include <AK/GenericLexer.h>
#include <AK/HashMap.h>
#include <AK/OwnPtr.h>
#include <AK/SourceLocation.h>
#include <AK/String.h>
#include <AK/TemporaryChange.h>
#include <LibXML/DOM/Document.h>
#include <LibXML/DOM/DocumentTypeDeclaration.h>
@ -23,19 +23,19 @@ namespace XML {
struct ParseError {
size_t offset;
String error;
DeprecatedString error;
};
struct Listener {
virtual ~Listener() { }
virtual void set_source(String) { }
virtual void set_source(DeprecatedString) { }
virtual void document_start() { }
virtual void document_end() { }
virtual void element_start(Name const&, HashMap<Name, String> const&) { }
virtual void element_start(Name const&, HashMap<Name, DeprecatedString> const&) { }
virtual void element_end(Name const&) { }
virtual void text(String const&) { }
virtual void comment(String const&) { }
virtual void text(DeprecatedString const&) { }
virtual void comment(DeprecatedString const&) { }
virtual void error(ParseError const&) { }
};
@ -45,7 +45,7 @@ public:
bool preserve_cdata { true };
bool preserve_comments { false };
bool treat_errors_as_fatal { true };
Function<ErrorOr<String>(SystemID const&, Optional<PublicID> const&)> resolve_external_resource {};
Function<ErrorOr<DeprecatedString>(SystemID const&, Optional<PublicID> const&)> resolve_external_resource {};
};
Parser(StringView source, Options options)
@ -73,8 +73,8 @@ private:
ErrorOr<void, ParseError> parse_internal();
void append_node(NonnullOwnPtr<Node>);
void append_text(String);
void append_comment(String);
void append_text(DeprecatedString);
void append_comment(DeprecatedString);
void enter_node(Node&);
void leave_node();
@ -82,8 +82,8 @@ private:
AttributeValue,
Content,
};
ErrorOr<String, ParseError> resolve_reference(EntityReference const&, ReferencePlacement);
ErrorOr<String, ParseError> resolve_parameter_entity_reference(EntityReference const&);
ErrorOr<DeprecatedString, ParseError> resolve_reference(EntityReference const&, ReferencePlacement);
ErrorOr<DeprecatedString, ParseError> resolve_parameter_entity_reference(EntityReference const&);
enum class Required {
No,
@ -109,12 +109,12 @@ private:
ErrorOr<Name, ParseError> parse_end_tag();
ErrorOr<void, ParseError> parse_content();
ErrorOr<Attribute, ParseError> parse_attribute();
ErrorOr<String, ParseError> parse_attribute_value();
ErrorOr<Variant<EntityReference, String>, ParseError> parse_reference();
ErrorOr<DeprecatedString, ParseError> parse_attribute_value();
ErrorOr<Variant<EntityReference, DeprecatedString>, ParseError> parse_reference();
ErrorOr<StringView, ParseError> parse_char_data();
ErrorOr<Vector<MarkupDeclaration>, ParseError> parse_internal_subset();
ErrorOr<Optional<MarkupDeclaration>, ParseError> parse_markup_declaration();
ErrorOr<Optional<String>, ParseError> parse_declaration_separator();
ErrorOr<Optional<DeprecatedString>, ParseError> parse_declaration_separator();
ErrorOr<Vector<MarkupDeclaration>, ParseError> parse_external_subset_declaration();
ErrorOr<ElementDeclaration, ParseError> parse_element_declaration();
ErrorOr<AttributeListDeclaration, ParseError> parse_attribute_list_declaration();
@ -129,12 +129,12 @@ private:
ErrorOr<PublicID, ParseError> parse_public_id();
ErrorOr<SystemID, ParseError> parse_system_id();
ErrorOr<ExternalID, ParseError> parse_external_id();
ErrorOr<String, ParseError> parse_entity_value();
ErrorOr<DeprecatedString, ParseError> parse_entity_value();
ErrorOr<Name, ParseError> parse_notation_data_declaration();
ErrorOr<StringView, ParseError> parse_public_id_literal();
ErrorOr<StringView, ParseError> parse_system_id_literal();
ErrorOr<StringView, ParseError> parse_cdata_section();
ErrorOr<String, ParseError> parse_attribute_value_inner(StringView disallow);
ErrorOr<DeprecatedString, ParseError> parse_attribute_value_inner(StringView disallow);
ErrorOr<Vector<MarkupDeclaration>, ParseError> parse_external_subset();
ErrorOr<void, ParseError> parse_text_declaration();
@ -186,7 +186,7 @@ private:
rule_name = rule_name.substring_view(6);
m_parse_errors.append({
error.offset,
String::formatted("{}: {}", rule_name, error.error),
DeprecatedString::formatted("{}: {}", rule_name, error.error),
});
}
return error;
@ -201,11 +201,11 @@ private:
Node* m_entered_node { nullptr };
Version m_version { Version::Version11 };
bool m_in_compatibility_mode { false };
String m_encoding;
DeprecatedString m_encoding;
bool m_standalone { false };
HashMap<Name, String> m_processing_instructions;
HashMap<Name, DeprecatedString> m_processing_instructions;
struct AcceptedRule {
Optional<String> rule {};
Optional<DeprecatedString> rule {};
bool accept { false };
} m_current_rule {};