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/LibPDF | |
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/LibPDF')
24 files changed, 88 insertions, 88 deletions
diff --git a/Userland/Libraries/LibPDF/Document.cpp b/Userland/Libraries/LibPDF/Document.cpp index 38a70d1989..f6260d5020 100644 --- a/Userland/Libraries/LibPDF/Document.cpp +++ b/Userland/Libraries/LibPDF/Document.cpp @@ -10,9 +10,9 @@ namespace PDF { -String OutlineItem::to_string(int indent) const +DeprecatedString OutlineItem::to_string(int indent) const { - auto indent_str = String::repeated(" "sv, indent + 1); + auto indent_str = DeprecatedString::repeated(" "sv, indent + 1); StringBuilder child_builder; child_builder.append('['); @@ -29,7 +29,7 @@ String OutlineItem::to_string(int indent) const builder.appendff("{}italic={}\n", indent_str, italic); builder.appendff("{}bold={}\n", indent_str, bold); builder.appendff("{}children={}\n", indent_str, child_builder.to_string()); - builder.appendff("{}}}", String::repeated(" "sv, indent)); + builder.appendff("{}}}", DeprecatedString::repeated(" "sv, indent)); return builder.to_string(); } diff --git a/Userland/Libraries/LibPDF/Document.h b/Userland/Libraries/LibPDF/Document.h index 83cf7453a5..8dca3cc3e9 100644 --- a/Userland/Libraries/LibPDF/Document.h +++ b/Userland/Libraries/LibPDF/Document.h @@ -57,7 +57,7 @@ struct Destination { struct OutlineItem final : public RefCounted<OutlineItem> { RefPtr<OutlineItem> parent; NonnullRefPtrVector<OutlineItem> children; - String title; + DeprecatedString title; i32 count { 0 }; Destination dest; Gfx::Color color { Color::NamedColor::Black }; // 'C' in the PDF spec @@ -66,7 +66,7 @@ struct OutlineItem final : public RefCounted<OutlineItem> { OutlineItem() = default; - String to_string(int indent) const; + DeprecatedString to_string(int indent) const; }; struct OutlineDict final : public RefCounted<OutlineDict> { diff --git a/Userland/Libraries/LibPDF/DocumentParser.cpp b/Userland/Libraries/LibPDF/DocumentParser.cpp index 13161ffd54..7212645665 100644 --- a/Userland/Libraries/LibPDF/DocumentParser.cpp +++ b/Userland/Libraries/LibPDF/DocumentParser.cpp @@ -79,14 +79,14 @@ PDFErrorOr<void> DocumentParser::parse_header() char major_ver = m_reader.read(); if (major_ver != '1' && major_ver != '2') - return error(String::formatted("Unknown major version \"{}\"", major_ver)); + return error(DeprecatedString::formatted("Unknown major version \"{}\"", major_ver)); if (m_reader.read() != '.') return error("Malformed PDF version"); char minor_ver = m_reader.read(); if (minor_ver < '0' || minor_ver > '7') - return error(String::formatted("Unknown minor version \"{}\"", minor_ver)); + return error(DeprecatedString::formatted("Unknown minor version \"{}\"", minor_ver)); m_reader.consume_eol(); @@ -435,12 +435,12 @@ PDFErrorOr<NonnullRefPtr<XRefTable>> DocumentParser::parse_xref_table() auto object_count = object_count_value.get<int>(); for (int i = 0; i < object_count; i++) { - auto offset_string = String(m_reader.bytes().slice(m_reader.offset(), 10)); + auto offset_string = DeprecatedString(m_reader.bytes().slice(m_reader.offset(), 10)); m_reader.move_by(10); if (!m_reader.consume(' ')) return error("Malformed xref entry"); - auto generation_string = String(m_reader.bytes().slice(m_reader.offset(), 5)); + auto generation_string = DeprecatedString(m_reader.bytes().slice(m_reader.offset(), 5)); m_reader.move_by(5); if (!m_reader.consume(' ')) return error("Malformed xref entry"); @@ -701,7 +701,7 @@ PDFErrorOr<RefPtr<DictObject>> DocumentParser::conditionally_parse_page_tree_nod auto dict_value = TRY(parse_object_with_index(object_index)); auto dict_object = dict_value.get<NonnullRefPtr<Object>>(); if (!dict_object->is<DictObject>()) - return error(String::formatted("Invalid page tree with xref index {}", object_index)); + return error(DeprecatedString::formatted("Invalid page tree with xref index {}", object_index)); auto dict = dict_object->cast<DictObject>(); if (!dict->contains_any_of(CommonNames::Type, CommonNames::Parent, CommonNames::Kids, CommonNames::Count)) diff --git a/Userland/Libraries/LibPDF/Encoding.h b/Userland/Libraries/LibPDF/Encoding.h index 007abc810e..44b56cb4de 100644 --- a/Userland/Libraries/LibPDF/Encoding.h +++ b/Userland/Libraries/LibPDF/Encoding.h @@ -626,7 +626,7 @@ namespace PDF { struct CharDescriptor { - String name; + DeprecatedString name; u32 code_point; }; @@ -643,13 +643,13 @@ public: static NonnullRefPtr<Encoding> zapf_encoding(); HashMap<u16, CharDescriptor> const& descriptors() const { return m_descriptors; } - HashMap<String, u16> const& name_mapping() const { return m_name_mapping; } + HashMap<DeprecatedString, u16> const& name_mapping() const { return m_name_mapping; } CharDescriptor const& get_char_code_descriptor(u16 char_code) const; protected: HashMap<u16, CharDescriptor> m_descriptors; - HashMap<String, u16> m_name_mapping; + HashMap<DeprecatedString, u16> m_name_mapping; }; } diff --git a/Userland/Libraries/LibPDF/Encryption.cpp b/Userland/Libraries/LibPDF/Encryption.cpp index 6b4be34c99..f84047314c 100644 --- a/Userland/Libraries/LibPDF/Encryption.cpp +++ b/Userland/Libraries/LibPDF/Encryption.cpp @@ -70,7 +70,7 @@ PDFErrorOr<NonnullRefPtr<StandardSecurityHandler>> StandardSecurityHandler::crea return adopt_ref(*new StandardSecurityHandler(document, revision, o, u, p, encrypt_metadata, length)); } -StandardSecurityHandler::StandardSecurityHandler(Document* document, size_t revision, String const& o_entry, String const& u_entry, u32 flags, bool encrypt_metadata, size_t length) +StandardSecurityHandler::StandardSecurityHandler(Document* document, size_t revision, DeprecatedString const& o_entry, DeprecatedString const& u_entry, u32 flags, bool encrypt_metadata, size_t length) : m_document(document) , m_revision(revision) , m_o_entry(o_entry) @@ -317,7 +317,7 @@ void StandardSecurityHandler::encrypt(NonnullRefPtr<Object> object, Reference re auto string = object->cast<StringObject>(); bytes = string->string().bytes(); assign = [&string](ByteBuffer const& buffer) { - string->set_string(String(buffer.bytes())); + string->set_string(DeprecatedString(buffer.bytes())); }; } else { VERIFY_NOT_REACHED(); diff --git a/Userland/Libraries/LibPDF/Encryption.h b/Userland/Libraries/LibPDF/Encryption.h index e01848b66f..d740202afa 100644 --- a/Userland/Libraries/LibPDF/Encryption.h +++ b/Userland/Libraries/LibPDF/Encryption.h @@ -28,7 +28,7 @@ class StandardSecurityHandler : public SecurityHandler { public: static PDFErrorOr<NonnullRefPtr<StandardSecurityHandler>> create(Document*, NonnullRefPtr<DictObject> encryption_dict); - StandardSecurityHandler(Document*, size_t revision, String const& o_entry, String const& u_entry, u32 flags, bool encrypt_metadata, size_t length); + StandardSecurityHandler(Document*, size_t revision, DeprecatedString const& o_entry, DeprecatedString const& u_entry, u32 flags, bool encrypt_metadata, size_t length); ~StandardSecurityHandler() override = default; @@ -49,8 +49,8 @@ private: Document* m_document; size_t m_revision; Optional<ByteBuffer> m_encryption_key; - String m_o_entry; - String m_u_entry; + DeprecatedString m_o_entry; + DeprecatedString m_u_entry; u32 m_flags; bool m_encrypt_metadata; size_t m_length; diff --git a/Userland/Libraries/LibPDF/Error.h b/Userland/Libraries/LibPDF/Error.h index 62dd207609..380ab7c620 100644 --- a/Userland/Libraries/LibPDF/Error.h +++ b/Userland/Libraries/LibPDF/Error.h @@ -6,7 +6,7 @@ #pragma once -#include <AK/String.h> +#include <AK/DeprecatedString.h> namespace PDF { @@ -20,32 +20,32 @@ public: Error(AK::Error error) : m_type(Type::Internal) - , m_message(String::formatted("Internal error while processing PDF file: {}", error.string_literal())) + , m_message(DeprecatedString::formatted("Internal error while processing PDF file: {}", error.string_literal())) { } - Error(Type type, String const& message) + Error(Type type, DeprecatedString const& message) : m_type(type) { switch (type) { case Type::Parse: - m_message = String::formatted("Failed to parse PDF file: {}", message); + m_message = DeprecatedString::formatted("Failed to parse PDF file: {}", message); break; case Type::Internal: - m_message = String::formatted("Internal error while processing PDF file: {}", message); + m_message = DeprecatedString::formatted("Internal error while processing PDF file: {}", message); break; case Type::MalformedPDF: - m_message = String::formatted("Malformed PDF file: {}", message); + m_message = DeprecatedString::formatted("Malformed PDF file: {}", message); break; } } Type type() const { return m_type; } - String const& message() const { return m_message; } + DeprecatedString const& message() const { return m_message; } private: Type m_type; - String m_message; + DeprecatedString m_message; }; template<typename T> diff --git a/Userland/Libraries/LibPDF/Fonts/PDFFont.cpp b/Userland/Libraries/LibPDF/Fonts/PDFFont.cpp index 226929b217..a2db01050f 100644 --- a/Userland/Libraries/LibPDF/Fonts/PDFFont.cpp +++ b/Userland/Libraries/LibPDF/Fonts/PDFFont.cpp @@ -87,12 +87,12 @@ PDFErrorOr<NonnullRefPtr<PDFFont>> PDFFont::create(Document* document, NonnullRe TODO(); } -Tuple<String, String> PDFFont::replacement_for_standard_latin_font(StringView name) +Tuple<DeprecatedString, DeprecatedString> PDFFont::replacement_for_standard_latin_font(StringView name) { bool is_bold = name.contains("bold"sv); bool is_italic = name.contains("italic"sv); - String font_variant; + DeprecatedString font_variant; if (is_bold && is_italic) { font_variant = "BoldItalic"; diff --git a/Userland/Libraries/LibPDF/Fonts/PDFFont.h b/Userland/Libraries/LibPDF/Fonts/PDFFont.h index c6dc8f7509..555c81a929 100644 --- a/Userland/Libraries/LibPDF/Fonts/PDFFont.h +++ b/Userland/Libraries/LibPDF/Fonts/PDFFont.h @@ -47,7 +47,7 @@ public: virtual Type type() const = 0; protected: - static Tuple<String, String> replacement_for_standard_latin_font(StringView); + static Tuple<DeprecatedString, DeprecatedString> replacement_for_standard_latin_font(StringView); bool m_is_standard_font { false }; }; diff --git a/Userland/Libraries/LibPDF/Fonts/PS1FontProgram.cpp b/Userland/Libraries/LibPDF/Fonts/PS1FontProgram.cpp index ef328d9a2c..cddf05b1bf 100644 --- a/Userland/Libraries/LibPDF/Fonts/PS1FontProgram.cpp +++ b/Userland/Libraries/LibPDF/Fonts/PS1FontProgram.cpp @@ -361,7 +361,7 @@ PDFErrorOr<PS1FontProgram::Glyph> PS1FontProgram::parse_glyph(ReadonlyBytes cons } default: - return error(String::formatted("Unhandled command: 12 {}", data[i])); + return error(DeprecatedString::formatted("Unhandled command: 12 {}", data[i])); } break; } @@ -447,7 +447,7 @@ PDFErrorOr<PS1FontProgram::Glyph> PS1FontProgram::parse_glyph(ReadonlyBytes cons } default: - return error(String::formatted("Unhandled command: {}", v)); + return error(DeprecatedString::formatted("Unhandled command: {}", v)); } } } @@ -560,7 +560,7 @@ PDFErrorOr<Vector<float>> PS1FontProgram::parse_number_array(Reader& reader, siz return array; } -PDFErrorOr<String> PS1FontProgram::parse_word(Reader& reader) +PDFErrorOr<DeprecatedString> PS1FontProgram::parse_word(Reader& reader) { reader.consume_whitespace(); @@ -579,7 +579,7 @@ PDFErrorOr<String> PS1FontProgram::parse_word(Reader& reader) PDFErrorOr<float> PS1FontProgram::parse_float(Reader& reader) { auto word = TRY(parse_word(reader)); - return strtof(String(word).characters(), nullptr); + return strtof(DeprecatedString(word).characters(), nullptr); } PDFErrorOr<int> PS1FontProgram::parse_int(Reader& reader) @@ -609,7 +609,7 @@ PDFErrorOr<ByteBuffer> PS1FontProgram::decrypt(ReadonlyBytes const& encrypted, u return decrypted; } -bool PS1FontProgram::seek_name(Reader& reader, String const& name) +bool PS1FontProgram::seek_name(Reader& reader, DeprecatedString const& name) { auto start = reader.offset(); @@ -631,7 +631,7 @@ bool PS1FontProgram::seek_name(Reader& reader, String const& name) } Error PS1FontProgram::error( - String const& message + DeprecatedString const& message #ifdef PDF_DEBUG , SourceLocation loc diff --git a/Userland/Libraries/LibPDF/Fonts/PS1FontProgram.h b/Userland/Libraries/LibPDF/Fonts/PS1FontProgram.h index b576bdc31c..acbd554e35 100644 --- a/Userland/Libraries/LibPDF/Fonts/PS1FontProgram.h +++ b/Userland/Libraries/LibPDF/Fonts/PS1FontProgram.h @@ -54,15 +54,15 @@ private: PDFErrorOr<void> parse_encrypted_portion(ByteBuffer const&); PDFErrorOr<Vector<ByteBuffer>> parse_subroutines(Reader&); PDFErrorOr<Vector<float>> parse_number_array(Reader&, size_t length); - PDFErrorOr<String> parse_word(Reader&); + PDFErrorOr<DeprecatedString> parse_word(Reader&); PDFErrorOr<float> parse_float(Reader&); PDFErrorOr<int> parse_int(Reader&); PDFErrorOr<ByteBuffer> decrypt(ReadonlyBytes const&, u16 key, size_t skip); - bool seek_name(Reader&, String const&); + bool seek_name(Reader&, DeprecatedString const&); static Error error( - String const& message + DeprecatedString const& message #ifdef PDF_DEBUG , SourceLocation loc = SourceLocation::current() diff --git a/Userland/Libraries/LibPDF/Fonts/Type0Font.h b/Userland/Libraries/LibPDF/Fonts/Type0Font.h index 08561c60fd..f58492c275 100644 --- a/Userland/Libraries/LibPDF/Fonts/Type0Font.h +++ b/Userland/Libraries/LibPDF/Fonts/Type0Font.h @@ -11,8 +11,8 @@ namespace PDF { struct CIDSystemInfo { - String registry; - String ordering; + DeprecatedString registry; + DeprecatedString ordering; u8 supplement; }; diff --git a/Userland/Libraries/LibPDF/Object.h b/Userland/Libraries/LibPDF/Object.h index edda73608f..ae70cefebd 100644 --- a/Userland/Libraries/LibPDF/Object.h +++ b/Userland/Libraries/LibPDF/Object.h @@ -75,7 +75,7 @@ public: } virtual char const* type_name() const = 0; - virtual String to_string(int indent) const = 0; + virtual DeprecatedString to_string(int indent) const = 0; protected: #define ENUMERATE_TYPE(_, name) \ diff --git a/Userland/Libraries/LibPDF/ObjectDerivatives.cpp b/Userland/Libraries/LibPDF/ObjectDerivatives.cpp index 987692f33e..e6c2a26f6e 100644 --- a/Userland/Libraries/LibPDF/ObjectDerivatives.cpp +++ b/Userland/Libraries/LibPDF/ObjectDerivatives.cpp @@ -36,21 +36,21 @@ static void append_indent(StringBuilder& builder, int indent) builder.append(" "sv); } -String StringObject::to_string(int) const +DeprecatedString StringObject::to_string(int) const { if (is_binary()) - return String::formatted("<{}>", encode_hex(string().bytes()).to_uppercase()); - return String::formatted("({})", string()); + return DeprecatedString::formatted("<{}>", encode_hex(string().bytes()).to_uppercase()); + return DeprecatedString::formatted("({})", string()); } -String NameObject::to_string(int) const +DeprecatedString NameObject::to_string(int) const { StringBuilder builder; builder.appendff("/{}", this->name()); return builder.to_string(); } -String ArrayObject::to_string(int indent) const +DeprecatedString ArrayObject::to_string(int indent) const { StringBuilder builder; builder.append("[\n"sv); @@ -70,7 +70,7 @@ String ArrayObject::to_string(int indent) const return builder.to_string(); } -String DictObject::to_string(int indent) const +DeprecatedString DictObject::to_string(int indent) const { StringBuilder builder; builder.append("<<\n"sv); @@ -91,7 +91,7 @@ String DictObject::to_string(int indent) const return builder.to_string(); } -String StreamObject::to_string(int indent) const +DeprecatedString StreamObject::to_string(int indent) const { StringBuilder builder; builder.append("stream\n"sv); @@ -117,7 +117,7 @@ String StreamObject::to_string(int indent) const return builder.to_string(); } -String IndirectValue::to_string(int indent) const +DeprecatedString IndirectValue::to_string(int indent) const { StringBuilder builder; builder.appendff("{} {} obj\n", index(), generation_index()); diff --git a/Userland/Libraries/LibPDF/ObjectDerivatives.h b/Userland/Libraries/LibPDF/ObjectDerivatives.h index cdb8dd7ef7..d98fed63c3 100644 --- a/Userland/Libraries/LibPDF/ObjectDerivatives.h +++ b/Userland/Libraries/LibPDF/ObjectDerivatives.h @@ -19,7 +19,7 @@ namespace PDF { class StringObject final : public Object { public: - StringObject(String string, bool is_binary) + StringObject(DeprecatedString string, bool is_binary) : m_string(move(string)) , m_is_binary(is_binary) { @@ -27,18 +27,18 @@ public: ~StringObject() override = default; - [[nodiscard]] ALWAYS_INLINE String const& string() const { return m_string; } + [[nodiscard]] ALWAYS_INLINE DeprecatedString const& string() const { return m_string; } [[nodiscard]] ALWAYS_INLINE bool is_binary() const { return m_is_binary; } - void set_string(String string) { m_string = move(string); } + void set_string(DeprecatedString string) { m_string = move(string); } char const* type_name() const override { return "string"; } - String to_string(int indent) const override; + DeprecatedString to_string(int indent) const override; protected: bool is_string() const override { return true; } private: - String m_string; + DeprecatedString m_string; bool m_is_binary; }; @@ -54,7 +54,7 @@ public: [[nodiscard]] ALWAYS_INLINE FlyString const& name() const { return m_name; } char const* type_name() const override { return "name"; } - String to_string(int indent) const override; + DeprecatedString to_string(int indent) const override; protected: bool is_name() const override { return true; } @@ -90,7 +90,7 @@ public: { return "array"; } - String to_string(int indent) const override; + DeprecatedString to_string(int indent) const override; protected: bool is_array() const override { return true; } @@ -136,7 +136,7 @@ public: { return "dict"; } - String to_string(int indent) const override; + DeprecatedString to_string(int indent) const override; protected: bool is_dict() const override { return true; } @@ -160,7 +160,7 @@ public: [[nodiscard]] ByteBuffer& buffer() { return m_buffer; }; char const* type_name() const override { return "stream"; } - String to_string(int indent) const override; + DeprecatedString to_string(int indent) const override; private: bool is_stream() const override { return true; } @@ -184,7 +184,7 @@ public: [[nodiscard]] ALWAYS_INLINE Value const& value() const { return m_value; } char const* type_name() const override { return "indirect_object"; } - String to_string(int indent) const override; + DeprecatedString to_string(int indent) const override; protected: bool is_indirect_value() const override { return true; } diff --git a/Userland/Libraries/LibPDF/Operator.h b/Userland/Libraries/LibPDF/Operator.h index eae89c7dc0..4ab1062398 100644 --- a/Userland/Libraries/LibPDF/Operator.h +++ b/Userland/Libraries/LibPDF/Operator.h @@ -6,8 +6,8 @@ #pragma once +#include <AK/DeprecatedString.h> #include <AK/Format.h> -#include <AK/String.h> #include <AK/StringBuilder.h> #include <AK/Vector.h> #include <LibPDF/Value.h> diff --git a/Userland/Libraries/LibPDF/Parser.cpp b/Userland/Libraries/LibPDF/Parser.cpp index 6cd8136e40..245162b695 100644 --- a/Userland/Libraries/LibPDF/Parser.cpp +++ b/Userland/Libraries/LibPDF/Parser.cpp @@ -37,7 +37,7 @@ void Parser::set_document(WeakPtr<Document> const& document) m_document = document; } -String Parser::parse_comment() +DeprecatedString Parser::parse_comment() { if (!m_reader.matches('%')) return {}; @@ -47,7 +47,7 @@ String Parser::parse_comment() m_reader.move_until([&](auto) { return m_reader.matches_eol(); }); - String str = StringView(m_reader.bytes().slice(comment_start_offset, m_reader.offset() - comment_start_offset)); + DeprecatedString str = StringView(m_reader.bytes().slice(comment_start_offset, m_reader.offset() - comment_start_offset)); m_reader.consume_eol(); m_reader.consume_whitespace(); return str; @@ -98,7 +98,7 @@ PDFErrorOr<Value> Parser::parse_value(CanBeIndirectValue can_be_indirect_value) if (m_reader.matches('[')) return TRY(parse_array()); - return error(String::formatted("Unexpected char \"{}\"", m_reader.peek())); + return error(DeprecatedString::formatted("Unexpected char \"{}\"", m_reader.peek())); } PDFErrorOr<Value> Parser::parse_possible_indirect_value_or_ref() @@ -193,7 +193,7 @@ PDFErrorOr<Value> Parser::parse_number() m_reader.consume_whitespace(); - auto string = String(m_reader.bytes().slice(start_offset, m_reader.offset() - start_offset)); + auto string = DeprecatedString(m_reader.bytes().slice(start_offset, m_reader.offset() - start_offset)); if (is_float) return Value(strtof(string.characters(), nullptr)); @@ -240,7 +240,7 @@ NonnullRefPtr<StringObject> Parser::parse_string() { ScopeGuard guard([&] { m_reader.consume_whitespace(); }); - String string; + DeprecatedString string; bool is_binary_string; if (m_reader.matches('(')) { @@ -272,7 +272,7 @@ NonnullRefPtr<StringObject> Parser::parse_string() return string_object; } -String Parser::parse_literal_string() +DeprecatedString Parser::parse_literal_string() { VERIFY(m_reader.consume('(')); StringBuilder builder; @@ -350,7 +350,7 @@ String Parser::parse_literal_string() return builder.to_string(); } -String Parser::parse_hex_string() +DeprecatedString Parser::parse_hex_string() { VERIFY(m_reader.consume('<')); @@ -558,7 +558,7 @@ PDFErrorOr<Vector<Operator>> Parser::parse_operators() } Error Parser::error( - String const& message + DeprecatedString const& message #ifdef PDF_DEBUG , SourceLocation loc diff --git a/Userland/Libraries/LibPDF/Parser.h b/Userland/Libraries/LibPDF/Parser.h index 9e5cb4da20..bfe46d65c3 100644 --- a/Userland/Libraries/LibPDF/Parser.h +++ b/Userland/Libraries/LibPDF/Parser.h @@ -34,7 +34,7 @@ public: void set_document(WeakPtr<Document> const&); - String parse_comment(); + DeprecatedString parse_comment(); void move_by(size_t count) { m_reader.move_by(count); } void move_to(size_t offset) { m_reader.move_to(offset); } @@ -51,8 +51,8 @@ public: PDFErrorOr<Value> parse_number(); PDFErrorOr<NonnullRefPtr<NameObject>> parse_name(); NonnullRefPtr<StringObject> parse_string(); - String parse_literal_string(); - String parse_hex_string(); + DeprecatedString parse_literal_string(); + DeprecatedString parse_hex_string(); PDFErrorOr<NonnullRefPtr<ArrayObject>> parse_array(); PDFErrorOr<NonnullRefPtr<DictObject>> parse_dict(); PDFErrorOr<NonnullRefPtr<StreamObject>> parse_stream(NonnullRefPtr<DictObject> dict); @@ -63,7 +63,7 @@ protected: void pop_reference() { m_current_reference_stack.take_last(); } Error error( - String const& message + DeprecatedString const& message #ifdef PDF_DEBUG , SourceLocation loc = SourceLocation::current() diff --git a/Userland/Libraries/LibPDF/Reader.h b/Userland/Libraries/LibPDF/Reader.h index 361e62af16..112752e271 100644 --- a/Userland/Libraries/LibPDF/Reader.h +++ b/Userland/Libraries/LibPDF/Reader.h @@ -7,10 +7,10 @@ #pragma once #include <AK/Debug.h> +#include <AK/DeprecatedString.h> #include <AK/Function.h> #include <AK/ScopeGuard.h> #include <AK/Span.h> -#include <AK/String.h> #include <AK/Vector.h> namespace PDF { @@ -81,7 +81,7 @@ public: bool matches(char const* chars) const { - String string(chars); + DeprecatedString string(chars); if (remaining() < string.length()) return false; @@ -149,7 +149,7 @@ public: for (auto i = from; i <= to; i++) { char value = static_cast<char>(bytes().at(i)); - auto line = String::formatted(" {}: '{}' (value={:3d}) ", i, value, static_cast<u8>(value)); + auto line = DeprecatedString::formatted(" {}: '{}' (value={:3d}) ", i, value, static_cast<u8>(value)); if (i == offset()) { dbgln("{} <<< current location, forwards={}", line, m_forwards); } else { diff --git a/Userland/Libraries/LibPDF/Renderer.cpp b/Userland/Libraries/LibPDF/Renderer.cpp index 8eb8edab1f..36b9a54ff6 100644 --- a/Userland/Libraries/LibPDF/Renderer.cpp +++ b/Userland/Libraries/LibPDF/Renderer.cpp @@ -729,7 +729,7 @@ PDFErrorOr<void> Renderer::set_graphics_state_from_dict(NonnullRefPtr<DictObject return {}; } -void Renderer::show_text(String const& string) +void Renderer::show_text(DeprecatedString const& string) { auto& text_rendering_matrix = calculate_text_rendering_matrix(); diff --git a/Userland/Libraries/LibPDF/Renderer.h b/Userland/Libraries/LibPDF/Renderer.h index 6f9a271a55..be4341bc00 100644 --- a/Userland/Libraries/LibPDF/Renderer.h +++ b/Userland/Libraries/LibPDF/Renderer.h @@ -108,7 +108,7 @@ private: void begin_path_paint(); void end_path_paint(); PDFErrorOr<void> set_graphics_state_from_dict(NonnullRefPtr<DictObject>); - void show_text(String const&); + void show_text(DeprecatedString const&); PDFErrorOr<NonnullRefPtr<ColorSpace>> get_color_space(Value const&, NonnullRefPtr<DictObject>); ALWAYS_INLINE GraphicsState const& state() const { return m_graphics_state_stack.last(); } diff --git a/Userland/Libraries/LibPDF/Value.cpp b/Userland/Libraries/LibPDF/Value.cpp index 7af1c1d7ea..a95da9774b 100644 --- a/Userland/Libraries/LibPDF/Value.cpp +++ b/Userland/Libraries/LibPDF/Value.cpp @@ -9,27 +9,27 @@ namespace PDF { -String Value::to_string(int indent) const +DeprecatedString Value::to_string(int indent) const { return visit( - [&](Empty const&) -> String { + [&](Empty const&) -> DeprecatedString { // Return type deduction means that we can't use implicit conversions. return "<empty>"; }, - [&](std::nullptr_t const&) -> String { + [&](std::nullptr_t const&) -> DeprecatedString { return "null"; }, - [&](bool const& b) -> String { + [&](bool const& b) -> DeprecatedString { return b ? "true" : "false"; }, [&](int const& i) { - return String::number(i); + return DeprecatedString::number(i); }, [&](float const& f) { - return String::number(f); + return DeprecatedString::number(f); }, [&](Reference const& ref) { - return String::formatted("{} {} R", ref.as_ref_index(), ref.as_ref_generation_index()); + return DeprecatedString::formatted("{} {} R", ref.as_ref_index(), ref.as_ref_generation_index()); }, [&](NonnullRefPtr<Object> const& object) { return object->to_string(indent); diff --git a/Userland/Libraries/LibPDF/Value.h b/Userland/Libraries/LibPDF/Value.h index aca082ebe4..4c7ebe21fd 100644 --- a/Userland/Libraries/LibPDF/Value.h +++ b/Userland/Libraries/LibPDF/Value.h @@ -6,9 +6,9 @@ #pragma once +#include <AK/DeprecatedString.h> #include <AK/Format.h> #include <AK/RefPtr.h> -#include <AK/String.h> #include <AK/Variant.h> #include <LibPDF/Forward.h> #include <LibPDF/Object.h> @@ -36,7 +36,7 @@ public: set<NonnullRefPtr<Object>>(*refptr); } - [[nodiscard]] String to_string(int indent = 0) const; + [[nodiscard]] DeprecatedString to_string(int indent = 0) const; [[nodiscard]] ALWAYS_INLINE bool has_number() const { return has<int>() || has<float>(); } diff --git a/Userland/Libraries/LibPDF/XRefTable.h b/Userland/Libraries/LibPDF/XRefTable.h index 20b4cef5c7..9a2ffd4c7b 100644 --- a/Userland/Libraries/LibPDF/XRefTable.h +++ b/Userland/Libraries/LibPDF/XRefTable.h @@ -6,9 +6,9 @@ #pragma once +#include <AK/DeprecatedString.h> #include <AK/Format.h> #include <AK/RefCounted.h> -#include <AK/String.h> #include <AK/Vector.h> #include <LibPDF/Error.h> @@ -124,7 +124,7 @@ struct Formatter<PDF::XRefEntry> : Formatter<StringView> { ErrorOr<void> format(FormatBuilder& builder, PDF::XRefEntry const& entry) { return Formatter<StringView>::format(builder, - String::formatted("XRefEntry {{ offset={} generation={} used={} }}", + DeprecatedString::formatted("XRefEntry {{ offset={} generation={} used={} }}", entry.byte_offset, entry.generation_number, entry.in_use)); |