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

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -164,7 +164,7 @@ PDFErrorOr<NonnullRefPtr<DeviceNColorSpace>> DeviceNColorSpace::create(Document*
// "The names parameter is an array of name objects specifying the individual color components.
// The length of the array determines the number of components in the DeviceN color space"
auto names_array = TRY(document->resolve_to<ArrayObject>(parameters[0]));
Vector<DeprecatedString> names;
Vector<ByteString> names;
for (size_t i = 0; i < names_array->size(); ++i)
names.append(names_array->get_name_at(i)->name());

View file

@ -131,7 +131,7 @@ public:
private:
DeviceNColorSpace(NonnullRefPtr<ColorSpace>, NonnullRefPtr<Function>);
Vector<DeprecatedString> m_names;
Vector<ByteString> m_names;
NonnullRefPtr<ColorSpace> m_alternate_space;
NonnullRefPtr<Function> m_tint_transform;
Vector<float> mutable m_tint_input_values;
@ -247,7 +247,7 @@ public:
private:
SeparationColorSpace(NonnullRefPtr<ColorSpace>, NonnullRefPtr<Function>);
DeprecatedString m_name;
ByteString m_name;
NonnullRefPtr<ColorSpace> m_alternate_space;
NonnullRefPtr<Function> m_tint_transform;
Vector<Value> mutable m_tint_output_values;

View file

@ -11,14 +11,14 @@
namespace PDF {
DeprecatedString OutlineItem::to_deprecated_string(int indent) const
ByteString OutlineItem::to_byte_string(int indent) const
{
auto indent_str = DeprecatedString::repeated(" "sv, indent + 1);
auto indent_str = ByteString::repeated(" "sv, indent + 1);
StringBuilder child_builder;
child_builder.append('[');
for (auto& child : children)
child_builder.appendff("{}\n", child->to_deprecated_string(indent + 1));
child_builder.appendff("{}\n", child->to_byte_string(indent + 1));
child_builder.appendff("{}]", indent_str);
StringBuilder builder;
@ -29,62 +29,62 @@ DeprecatedString OutlineItem::to_deprecated_string(int indent) const
builder.appendff("{}color={}\n", indent_str, color);
builder.appendff("{}italic={}\n", indent_str, italic);
builder.appendff("{}bold={}\n", indent_str, bold);
builder.appendff("{}children={}\n", indent_str, child_builder.to_deprecated_string());
builder.appendff("{}}}", DeprecatedString::repeated(" "sv, indent));
builder.appendff("{}children={}\n", indent_str, child_builder.to_byte_string());
builder.appendff("{}}}", ByteString::repeated(" "sv, indent));
return builder.to_deprecated_string();
return builder.to_byte_string();
}
PDFErrorOr<Optional<DeprecatedString>> InfoDict::title() const
PDFErrorOr<Optional<ByteString>> InfoDict::title() const
{
return get_text(CommonNames::Title);
}
PDFErrorOr<Optional<DeprecatedString>> InfoDict::author() const
PDFErrorOr<Optional<ByteString>> InfoDict::author() const
{
return get_text(CommonNames::Author);
}
PDFErrorOr<Optional<DeprecatedString>> InfoDict::subject() const
PDFErrorOr<Optional<ByteString>> InfoDict::subject() const
{
return get_text(CommonNames::Subject);
}
PDFErrorOr<Optional<DeprecatedString>> InfoDict::keywords() const
PDFErrorOr<Optional<ByteString>> InfoDict::keywords() const
{
return get_text(CommonNames::Keywords);
}
PDFErrorOr<Optional<DeprecatedString>> InfoDict::creator() const
PDFErrorOr<Optional<ByteString>> InfoDict::creator() const
{
return get_text(CommonNames::Creator);
}
PDFErrorOr<Optional<DeprecatedString>> InfoDict::producer() const
PDFErrorOr<Optional<ByteString>> InfoDict::producer() const
{
return get_text(CommonNames::Producer);
}
PDFErrorOr<Optional<DeprecatedString>> InfoDict::creation_date() const
PDFErrorOr<Optional<ByteString>> InfoDict::creation_date() const
{
return get(CommonNames::CreationDate);
}
PDFErrorOr<Optional<DeprecatedString>> InfoDict::modification_date() const
PDFErrorOr<Optional<ByteString>> InfoDict::modification_date() const
{
return get(CommonNames::ModDate);
}
PDFErrorOr<Optional<DeprecatedString>> InfoDict::get_text(DeprecatedFlyString const& name) const
PDFErrorOr<Optional<ByteString>> InfoDict::get_text(DeprecatedFlyString const& name) const
{
return TRY(get(name)).map(Document::text_string_to_utf8);
}
DeprecatedString Document::text_string_to_utf8(DeprecatedString const& text_string)
ByteString Document::text_string_to_utf8(ByteString const& text_string)
{
if (text_string.bytes().starts_with(Array<u8, 2> { 0xfe, 0xff })) {
// The string is encoded in UTF16-BE
return TextCodec::decoder_for("utf-16be"sv)->to_utf8(text_string).release_value_but_fixme_should_propagate_errors().to_deprecated_string();
return TextCodec::decoder_for("utf-16be"sv)->to_utf8(text_string).release_value_but_fixme_should_propagate_errors().to_byte_string();
}
if (text_string.bytes().starts_with(Array<u8, 3> { 239, 187, 191 })) {
@ -92,7 +92,7 @@ DeprecatedString Document::text_string_to_utf8(DeprecatedString const& text_stri
return text_string.substring(3);
}
return TextCodec::decoder_for("PDFDocEncoding"sv)->to_utf8(text_string).release_value_but_fixme_should_propagate_errors().to_deprecated_string();
return TextCodec::decoder_for("PDFDocEncoding"sv)->to_utf8(text_string).release_value_but_fixme_should_propagate_errors().to_byte_string();
}
PDFErrorOr<NonnullRefPtr<Document>> Document::create(ReadonlyBytes bytes)
@ -197,7 +197,7 @@ static PDFErrorOr<void> dump_tree(Document& document, size_t index, HashTable<in
auto const& value = TRY(document.get_or_load_value(index));
outln("{} 0 obj", index);
outln("{}", value.to_deprecated_string(0));
outln("{}", value.to_byte_string(0));
outln("endobj");
Vector<int> referenced_indices;
@ -392,7 +392,7 @@ PDFErrorOr<NonnullRefPtr<Object>> Document::find_in_name_tree_nodes(NonnullRefPt
return find_in_name_tree(sibling, name);
}
}
return Error { Error::Type::MalformedPDF, DeprecatedString::formatted("Didn't find node in name tree containing name {}", name) };
return Error { Error::Type::MalformedPDF, ByteString::formatted("Didn't find node in name tree containing name {}", name) };
}
PDFErrorOr<NonnullRefPtr<Object>> Document::find_in_key_value_array(NonnullRefPtr<ArrayObject> key_value_array, DeprecatedFlyString name)
@ -405,7 +405,7 @@ PDFErrorOr<NonnullRefPtr<Object>> Document::find_in_key_value_array(NonnullRefPt
return key_value_array->get_object_at(this, 2 * i + 1);
}
}
return Error { Error::Type::MalformedPDF, DeprecatedString::formatted("Didn't find expected name {} in key/value array", name) };
return Error { Error::Type::MalformedPDF, ByteString::formatted("Didn't find expected name {} in key/value array", name) };
}
PDFErrorOr<void> Document::build_outline()

View file

@ -40,7 +40,7 @@ struct OutlineItem final : public RefCounted<OutlineItem>
, public Weakable<OutlineItem> {
WeakPtr<OutlineItem> parent;
Vector<NonnullRefPtr<OutlineItem>> children;
DeprecatedString title; // Already converted to UTF-8.
ByteString title; // Already converted to UTF-8.
i32 count { 0 };
Destination dest;
Gfx::Color color { Color::NamedColor::Black }; // 'C' in the PDF spec
@ -49,7 +49,7 @@ struct OutlineItem final : public RefCounted<OutlineItem>
OutlineItem() = default;
DeprecatedString to_deprecated_string(int indent) const;
ByteString to_byte_string(int indent) const;
};
struct OutlineDict final : public RefCounted<OutlineDict> {
@ -69,30 +69,30 @@ public:
// These all return strings that are already converted to UTF-8.
PDFErrorOr<Optional<DeprecatedString>> title() const;
PDFErrorOr<Optional<DeprecatedString>> author() const;
PDFErrorOr<Optional<DeprecatedString>> subject() const;
PDFErrorOr<Optional<DeprecatedString>> keywords() const;
PDFErrorOr<Optional<ByteString>> title() const;
PDFErrorOr<Optional<ByteString>> author() const;
PDFErrorOr<Optional<ByteString>> subject() const;
PDFErrorOr<Optional<ByteString>> keywords() const;
// Name of the program that created the original, non-PDF file.
PDFErrorOr<Optional<DeprecatedString>> creator() const;
PDFErrorOr<Optional<ByteString>> creator() const;
// Name of the program that converted the file to PDF.
PDFErrorOr<Optional<DeprecatedString>> producer() const;
PDFErrorOr<Optional<ByteString>> producer() const;
// FIXME: Provide some helper for parsing the date strings returned by these two methods.
PDFErrorOr<Optional<DeprecatedString>> creation_date() const;
PDFErrorOr<Optional<DeprecatedString>> modification_date() const;
PDFErrorOr<Optional<ByteString>> creation_date() const;
PDFErrorOr<Optional<ByteString>> modification_date() const;
private:
PDFErrorOr<Optional<DeprecatedString>> get(DeprecatedFlyString const& name) const
PDFErrorOr<Optional<ByteString>> get(DeprecatedFlyString const& name) const
{
if (!m_info_dict->contains(name))
return OptionalNone {};
return TRY(m_info_dict->get_string(m_document, name))->string();
}
PDFErrorOr<Optional<DeprecatedString>> get_text(DeprecatedFlyString const& name) const;
PDFErrorOr<Optional<ByteString>> get_text(DeprecatedFlyString const& name) const;
WeakPtr<Document> m_document;
NonnullRefPtr<DictObject> m_info_dict;
@ -103,7 +103,7 @@ class Document final
, public Weakable<Document> {
public:
// Converts a text string (PDF 1.7 spec, 3.8.1. "String Types") to UTF-8.
static DeprecatedString text_string_to_utf8(DeprecatedString const&);
static ByteString text_string_to_utf8(ByteString const&);
static PDFErrorOr<NonnullRefPtr<Document>> create(ReadonlyBytes bytes);
@ -254,7 +254,7 @@ template<>
struct Formatter<PDF::OutlineItem> : Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, PDF::OutlineItem const& item)
{
return builder.put_string(item.to_deprecated_string(0));
return builder.put_string(item.to_byte_string(0));
}
};
@ -265,11 +265,11 @@ struct Formatter<PDF::OutlineDict> : Formatter<FormatString> {
StringBuilder child_builder;
child_builder.append('[');
for (auto& child : dict.children)
child_builder.appendff("{}\n", child->to_deprecated_string(2));
child_builder.appendff("{}\n", child->to_byte_string(2));
child_builder.append(" ]"sv);
return Formatter<FormatString>::format(builder,
"OutlineDict {{\n count={}\n children={}\n}}"sv, dict.count, child_builder.to_deprecated_string());
"OutlineDict {{\n count={}\n children={}\n}}"sv, dict.count, child_builder.to_byte_string());
}
};

View file

@ -482,12 +482,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 = DeprecatedString(m_reader.bytes().slice(m_reader.offset(), 10));
auto offset_string = ByteString(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 = DeprecatedString(m_reader.bytes().slice(m_reader.offset(), 5));
auto generation_string = ByteString(m_reader.bytes().slice(m_reader.offset(), 5));
m_reader.move_by(5);
if (!m_reader.consume(' '))
return error("Malformed xref entry");
@ -747,7 +747,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(DeprecatedString::formatted("Invalid page tree with xref index {}", object_index));
return error(ByteString::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))
@ -787,7 +787,7 @@ struct Formatter<PDF::DocumentParser::LinearizationDictionary> : Formatter<Strin
builder.appendff(" offset_of_main_xref_table={}\n", dict.offset_of_main_xref_table);
builder.appendff(" first_page={}\n", dict.first_page);
builder.append('}');
return Formatter<StringView>::format(format_builder, builder.to_deprecated_string());
return Formatter<StringView>::format(format_builder, builder.to_byte_string());
}
};
@ -811,7 +811,7 @@ struct Formatter<PDF::DocumentParser::PageOffsetHintTable> : Formatter<StringVie
builder.appendff(" bits_required_for_fraction_numerator={}\n", table.bits_required_for_fraction_numerator);
builder.appendff(" shared_object_reference_fraction_denominator={}\n", table.shared_object_reference_fraction_denominator);
builder.append('}');
return Formatter<StringView>::format(format_builder, builder.to_deprecated_string());
return Formatter<StringView>::format(format_builder, builder.to_byte_string());
}
};
@ -835,7 +835,7 @@ struct Formatter<PDF::DocumentParser::PageOffsetHintTableEntry> : Formatter<Stri
builder.appendff(" page_content_stream_offset_number={}\n", entry.page_content_stream_offset_number);
builder.appendff(" page_content_stream_length_number={}\n", entry.page_content_stream_length_number);
builder.append('}');
return Formatter<StringView>::format(format_builder, builder.to_deprecated_string());
return Formatter<StringView>::format(format_builder, builder.to_byte_string());
}
};

View file

@ -164,7 +164,7 @@ NonnullRefPtr<Encoding> Encoding::zapf_encoding()
return encoding;
}
u16 Encoding::get_char_code(DeprecatedString const& name) const
u16 Encoding::get_char_code(ByteString const& name) const
{
auto code_iterator = m_name_mapping.find(name);
if (code_iterator != m_name_mapping.end())

View file

@ -638,16 +638,16 @@ public:
static NonnullRefPtr<Encoding> symbol_encoding();
static NonnullRefPtr<Encoding> zapf_encoding();
HashMap<DeprecatedString, CharCodeType> const& name_mapping() const { return m_name_mapping; }
HashMap<ByteString, CharCodeType> const& name_mapping() const { return m_name_mapping; }
u16 get_char_code(DeprecatedString const&) const;
u16 get_char_code(ByteString const&) const;
DeprecatedFlyString get_name(u8 char_code) const;
void set(CharCodeType char_code, DeprecatedFlyString const& glyph_name);
protected:
HashMap<CharCodeType, DeprecatedFlyString> m_descriptors;
HashMap<DeprecatedString, CharCodeType> m_name_mapping;
HashMap<ByteString, CharCodeType> m_name_mapping;
bool m_windows { false };
};

View file

@ -67,7 +67,7 @@ struct CryptFilter {
int length_in_bits { 0 };
};
static PDFErrorOr<CryptFilter> parse_v4_or_newer_crypt(Document* document, NonnullRefPtr<DictObject> encryption_dict, DeprecatedString filter)
static PDFErrorOr<CryptFilter> parse_v4_or_newer_crypt(Document* document, NonnullRefPtr<DictObject> encryption_dict, ByteString filter)
{
// See 3.5 Encryption, Table 3.18 "Entries common to all encryption dictionaries" for StmF and StrF,
// and 3.5.4 Crypt Filters in the 1.7 spec, in particular Table 3.22 "Entries common to all crypt filter dictionaries".
@ -139,11 +139,11 @@ PDFErrorOr<NonnullRefPtr<StandardSecurityHandler>> StandardSecurityHandler::crea
if (v >= 4) {
// "Default value: Identity"
DeprecatedString stream_filter = "Identity";
ByteString stream_filter = "Identity";
if (encryption_dict->contains(CommonNames::StmF))
stream_filter = TRY(encryption_dict->get_name(document, CommonNames::StmF))->name();
DeprecatedString string_filter = "Identity";
ByteString string_filter = "Identity";
if (encryption_dict->contains(CommonNames::StrF))
string_filter = TRY(encryption_dict->get_name(document, CommonNames::StrF))->name();
@ -166,7 +166,7 @@ PDFErrorOr<NonnullRefPtr<StandardSecurityHandler>> StandardSecurityHandler::crea
if (encryption_dict->contains(CommonNames::EncryptMetadata))
encryption_dict->get_value(CommonNames::EncryptMetadata).get<bool>();
DeprecatedString oe, ue, perms;
ByteString oe, ue, perms;
if (v >= 5) {
oe = TRY(encryption_dict->get_string(document, CommonNames::OE))->string();
ue = TRY(encryption_dict->get_string(document, CommonNames::UE))->string();
@ -193,7 +193,7 @@ PDFErrorOr<NonnullRefPtr<StandardSecurityHandler>> StandardSecurityHandler::crea
return adopt_ref(*new StandardSecurityHandler(document, revision, o, oe, u, ue, perms, p, encrypt_metadata, length, method));
}
StandardSecurityHandler::StandardSecurityHandler(Document* document, size_t revision, DeprecatedString const& o_entry, DeprecatedString const& oe_entry, DeprecatedString const& u_entry, DeprecatedString const& ue_entry, DeprecatedString const& perms_entry, u32 flags, bool encrypt_metadata, size_t length, CryptFilterMethod method)
StandardSecurityHandler::StandardSecurityHandler(Document* document, size_t revision, ByteString const& o_entry, ByteString const& oe_entry, ByteString const& u_entry, ByteString const& ue_entry, ByteString const& perms_entry, u32 flags, bool encrypt_metadata, size_t length, CryptFilterMethod method)
: m_document(document)
, m_revision(revision)
, m_o_entry(o_entry)
@ -686,7 +686,7 @@ void StandardSecurityHandler::crypt(NonnullRefPtr<Object> object, Reference refe
auto string = object->cast<StringObject>();
bytes = string->string().bytes();
assign = [&object](ByteBuffer buffer) {
object->cast<StringObject>()->set_string(DeprecatedString(buffer.bytes()));
object->cast<StringObject>()->set_string(ByteString(buffer.bytes()));
};
} else {
VERIFY_NOT_REACHED();

View file

@ -39,7 +39,7 @@ class StandardSecurityHandler : public SecurityHandler {
public:
static PDFErrorOr<NonnullRefPtr<StandardSecurityHandler>> create(Document*, NonnullRefPtr<DictObject> encryption_dict);
StandardSecurityHandler(Document*, size_t revision, DeprecatedString const& o_entry, DeprecatedString const& oe_entry, DeprecatedString const& u_entry, DeprecatedString const& ue_entry, DeprecatedString const& perms, u32 flags, bool encrypt_metadata, size_t length, CryptFilterMethod method);
StandardSecurityHandler(Document*, size_t revision, ByteString const& o_entry, ByteString const& oe_entry, ByteString const& u_entry, ByteString const& ue_entry, ByteString const& perms, u32 flags, bool encrypt_metadata, size_t length, CryptFilterMethod method);
~StandardSecurityHandler() override = default;
@ -73,11 +73,11 @@ private:
Document* m_document;
size_t m_revision;
Optional<ByteBuffer> m_encryption_key;
DeprecatedString m_o_entry;
DeprecatedString m_oe_entry;
DeprecatedString m_u_entry;
DeprecatedString m_ue_entry;
DeprecatedString m_perms_entry;
ByteString m_o_entry;
ByteString m_oe_entry;
ByteString m_u_entry;
ByteString m_ue_entry;
ByteString m_perms_entry;
u32 m_flags;
bool m_encrypt_metadata;
size_t m_length;

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/String.h>
#include <AK/Vector.h>
@ -23,12 +23,12 @@ public:
Error(AK::Error error)
: m_type(Type::Internal)
, m_message(DeprecatedString::formatted("Internal error while processing PDF file: {}", error.string_literal()))
, m_message(ByteString::formatted("Internal error while processing PDF file: {}", error.string_literal()))
{
}
Error(Type type, DeprecatedString const& message)
: Error(type, String::from_deprecated_string(message).release_value_but_fixme_should_propagate_errors())
Error(Type type, ByteString const& message)
: Error(type, String::from_byte_string(message).release_value_but_fixme_should_propagate_errors())
{
}
@ -37,22 +37,22 @@ public:
{
switch (type) {
case Type::Parse:
m_message = DeprecatedString::formatted("Failed to parse PDF file: {}", message);
m_message = ByteString::formatted("Failed to parse PDF file: {}", message);
break;
case Type::Internal:
m_message = DeprecatedString::formatted("Internal error while processing PDF file: {}", message);
m_message = ByteString::formatted("Internal error while processing PDF file: {}", message);
break;
case Type::MalformedPDF:
m_message = DeprecatedString::formatted("Malformed PDF file: {}", message);
m_message = ByteString::formatted("Malformed PDF file: {}", message);
break;
case Type::RenderingUnsupported:
m_message = DeprecatedString::formatted("Rendering of feature not supported: {}", message);
m_message = ByteString::formatted("Rendering of feature not supported: {}", message);
break;
}
}
Type type() const { return m_type; }
DeprecatedString const& message() const { return m_message; }
ByteString const& message() const { return m_message; }
#define DEFINE_STATIC_ERROR_FUNCTIONS(name, type) \
static Error name##_error(StringView message) \
@ -73,7 +73,7 @@ public:
private:
Type m_type;
DeprecatedString m_message;
ByteString m_message;
static Error maybe_with_string(Type type, ErrorOr<String> maybe_string)
{

View file

@ -812,7 +812,7 @@ PDFErrorOr<Vector<u8>> CFF::parse_encoding(Reader&& reader, HashMap<Card8, SID>&
TRY(encoding_codes.try_append(code));
}
} else
return error(DeprecatedString::formatted("Invalid encoding format: {}", format));
return error(ByteString::formatted("Invalid encoding format: {}", format));
if (format_raw & 0x80) {
// CFF spec, "Table 14 Supplemental Encoding Data"
@ -975,6 +975,6 @@ PDFErrorOr<CFF::DictOperand> CFF::load_dict_operand(u8 b0, Reader& reader)
return load_float_dict_operand(reader);
if (b0 >= 28)
return load_int_dict_operand(b0, reader);
return Error { Error::Type::MalformedPDF, DeprecatedString::formatted("Unknown CFF dict element prefix: {}", b0) };
return Error { Error::Type::MalformedPDF, ByteString::formatted("Unknown CFF dict element prefix: {}", b0) };
}
}

View file

@ -23,7 +23,7 @@ public:
virtual ~PDFFont() = default;
virtual void set_font_size(float font_size) = 0;
virtual PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, DeprecatedString const&, Renderer const&) = 0;
virtual PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&, Renderer const&) = 0;
protected:
virtual PDFErrorOr<void> initialize(Document* document, NonnullRefPtr<DictObject> const& dict, float font_size);

View file

@ -167,7 +167,7 @@ PDFErrorOr<Vector<float>> PS1FontProgram::parse_number_array(Reader& reader, siz
return array;
}
PDFErrorOr<DeprecatedString> PS1FontProgram::parse_word(Reader& reader)
PDFErrorOr<ByteString> PS1FontProgram::parse_word(Reader& reader)
{
reader.consume_whitespace();
@ -186,7 +186,7 @@ PDFErrorOr<DeprecatedString> PS1FontProgram::parse_word(Reader& reader)
PDFErrorOr<float> PS1FontProgram::parse_float(Reader& reader)
{
auto word = TRY(parse_word(reader));
return strtof(DeprecatedString(word).characters(), nullptr);
return strtof(ByteString(word).characters(), nullptr);
}
PDFErrorOr<int> PS1FontProgram::parse_int(Reader& reader)
@ -216,7 +216,7 @@ PDFErrorOr<ByteBuffer> PS1FontProgram::decrypt(ReadonlyBytes const& encrypted, u
return decrypted;
}
bool PS1FontProgram::seek_name(Reader& reader, DeprecatedString const& name)
bool PS1FontProgram::seek_name(Reader& reader, ByteString const& name)
{
auto start = reader.offset();

View file

@ -26,12 +26,12 @@ private:
PDFErrorOr<void> parse_encrypted_portion(ByteBuffer const&);
PDFErrorOr<Vector<ByteBuffer>> parse_subroutines(Reader&) const;
static PDFErrorOr<Vector<float>> parse_number_array(Reader&, size_t length);
static PDFErrorOr<DeprecatedString> parse_word(Reader&);
static PDFErrorOr<ByteString> parse_word(Reader&);
static PDFErrorOr<float> parse_float(Reader&);
static PDFErrorOr<int> parse_int(Reader&);
static PDFErrorOr<ByteBuffer> decrypt(ReadonlyBytes const&, u16 key, size_t skip);
static bool seek_name(Reader&, DeprecatedString const&);
static bool seek_name(Reader&, ByteString const&);
u16 m_encryption_key { 4330 };
int m_lenIV { 4 };

View file

@ -46,7 +46,7 @@ PDFErrorOr<void> SimpleFont::initialize(Document* document, NonnullRefPtr<DictOb
return {};
}
PDFErrorOr<Gfx::FloatPoint> SimpleFont::draw_string(Gfx::Painter& painter, Gfx::FloatPoint glyph_position, DeprecatedString const& string, Renderer const& renderer)
PDFErrorOr<Gfx::FloatPoint> SimpleFont::draw_string(Gfx::Painter& painter, Gfx::FloatPoint glyph_position, ByteString const& string, Renderer const& renderer)
{
auto const& text_rendering_matrix = renderer.calculate_text_rendering_matrix();
auto font_size = text_rendering_matrix.x_scale() * renderer.text_state().font_size;

View file

@ -13,7 +13,7 @@ namespace PDF {
class SimpleFont : public PDFFont {
public:
PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, DeprecatedString const&, Renderer const&) override;
PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&, Renderer const&) override;
protected:
PDFErrorOr<void> initialize(Document* document, NonnullRefPtr<DictObject> const& dict, float font_size) override;

View file

@ -13,15 +13,15 @@ namespace PDF {
class CIDFontType {
public:
virtual ~CIDFontType() = default;
virtual PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, DeprecatedString const&) = 0;
virtual PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&) = 0;
};
class CIDFontType0 : public CIDFontType {
public:
PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, DeprecatedString const&) override;
PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&) override;
};
PDFErrorOr<Gfx::FloatPoint> CIDFontType0::draw_string(Gfx::Painter&, Gfx::FloatPoint, DeprecatedString const&)
PDFErrorOr<Gfx::FloatPoint> CIDFontType0::draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&)
{
// ISO 32000 (PDF 2.0) 9.7.4.2 Glyph selection in CIDFonts
// "When the CIDFont contains an embedded font program that is represented in the Compact Font Format (CFF),
@ -39,7 +39,7 @@ class CIDFontType2 : public CIDFontType {
public:
static PDFErrorOr<NonnullOwnPtr<CIDFontType2>> create(Document*, NonnullRefPtr<DictObject> const& descendant, float font_size);
PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, DeprecatedString const&) override;
PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&) override;
};
PDFErrorOr<NonnullOwnPtr<CIDFontType2>> CIDFontType2::create(Document* document, NonnullRefPtr<DictObject> const& descendant, float font_size)
@ -70,7 +70,7 @@ PDFErrorOr<NonnullOwnPtr<CIDFontType2>> CIDFontType2::create(Document* document,
return TRY(adopt_nonnull_own_or_enomem(new (nothrow) CIDFontType2()));
}
PDFErrorOr<Gfx::FloatPoint> CIDFontType2::draw_string(Gfx::Painter&, Gfx::FloatPoint, DeprecatedString const&)
PDFErrorOr<Gfx::FloatPoint> CIDFontType2::draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&)
{
// ISO 32000 (PDF 2.0) 9.7.4.2 Glyph selection in CIDFonts
// "For Type 2, the CIDFont program is actually a TrueType font program, which has no native notion of CIDs.
@ -175,7 +175,7 @@ void Type0Font::set_font_size(float)
{
}
PDFErrorOr<Gfx::FloatPoint> Type0Font::draw_string(Gfx::Painter& painter, Gfx::FloatPoint glyph_position, DeprecatedString const& string, Renderer const&)
PDFErrorOr<Gfx::FloatPoint> Type0Font::draw_string(Gfx::Painter& painter, Gfx::FloatPoint glyph_position, ByteString const& string, Renderer const&)
{
// Type0 fonts map bytes to character IDs ("CIDs"), and then CIDs to glyphs.

View file

@ -15,8 +15,8 @@ namespace PDF {
class CIDFontType;
struct CIDSystemInfo {
DeprecatedString registry;
DeprecatedString ordering;
ByteString registry;
ByteString ordering;
u8 supplement;
};
@ -26,7 +26,7 @@ public:
~Type0Font();
void set_font_size(float font_size) override;
PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, DeprecatedString const&, Renderer const&) override;
PDFErrorOr<Gfx::FloatPoint> draw_string(Gfx::Painter&, Gfx::FloatPoint, ByteString const&, Renderer const&) override;
DeprecatedFlyString base_font_name() const { return m_base_font_name; }

View file

@ -387,7 +387,7 @@ PDFErrorOr<Type1FontProgram::Glyph> Type1FontProgram::parse_glyph(ReadonlyBytes
case CallGsubr:
if (!is_type2)
return error(DeprecatedString::formatted("CFF Gsubr only valid in type2 data"));
return error(ByteString::formatted("CFF Gsubr only valid in type2 data"));
[[fallthrough]];
case CallSubr: {
Vector<ByteBuffer> const& subroutines = v == CallSubr ? local_subroutines : global_subroutines;
@ -725,7 +725,7 @@ PDFErrorOr<Type1FontProgram::Glyph> Type1FontProgram::parse_glyph(ReadonlyBytes
}
Error Type1FontProgram::error(
DeprecatedString const& message
ByteString const& message
#ifdef PDF_DEBUG
,
SourceLocation loc

View file

@ -86,7 +86,7 @@ protected:
static PDFErrorOr<Glyph> parse_glyph(ReadonlyBytes const&, Vector<ByteBuffer> const& local_subroutines, Vector<ByteBuffer> const& global_subroutines, GlyphParserState&, bool is_type2);
static Error error(
DeprecatedString const& message
ByteString const& message
#ifdef PDF_DEBUG
,
SourceLocation loc = SourceLocation::current()

View file

@ -75,7 +75,7 @@ public:
}
virtual char const* type_name() const = 0;
virtual DeprecatedString to_deprecated_string(int indent) const = 0;
virtual ByteString to_byte_string(int indent) const = 0;
protected:
#define ENUMERATE_TYPE(_, name) \
@ -98,7 +98,7 @@ template<PDF::IsObject T>
struct Formatter<T> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, T const& object)
{
return Formatter<StringView>::format(builder, object.to_deprecated_string(0));
return Formatter<StringView>::format(builder, object.to_byte_string(0));
}
};

View file

@ -53,18 +53,18 @@ static void append_indent(StringBuilder& builder, int indent)
builder.append(" "sv);
}
DeprecatedString StringObject::to_deprecated_string(int) const
ByteString StringObject::to_byte_string(int) const
{
if (is_binary())
return DeprecatedString::formatted("<{}>", encode_hex(string().bytes()).to_uppercase());
return DeprecatedString::formatted("({})", string());
return ByteString::formatted("<{}>", encode_hex(string().bytes()).to_uppercase());
return ByteString::formatted("({})", string());
}
DeprecatedString NameObject::to_deprecated_string(int) const
ByteString NameObject::to_byte_string(int) const
{
StringBuilder builder;
builder.appendff("/{}", this->name());
return builder.to_deprecated_string();
return builder.to_byte_string();
}
Vector<float> ArrayObject::float_elements() const
@ -77,7 +77,7 @@ Vector<float> ArrayObject::float_elements() const
return values;
}
DeprecatedString ArrayObject::to_deprecated_string(int indent) const
ByteString ArrayObject::to_byte_string(int indent) const
{
StringBuilder builder;
builder.append("[\n"sv);
@ -88,16 +88,16 @@ DeprecatedString ArrayObject::to_deprecated_string(int indent) const
builder.append("\n"sv);
first = false;
append_indent(builder, indent + 1);
builder.appendff("{}", element.to_deprecated_string(indent));
builder.appendff("{}", element.to_byte_string(indent));
}
builder.append('\n');
append_indent(builder, indent);
builder.append(']');
return builder.to_deprecated_string();
return builder.to_byte_string();
}
DeprecatedString DictObject::to_deprecated_string(int indent) const
ByteString DictObject::to_byte_string(int indent) const
{
StringBuilder builder;
append_indent(builder, indent);
@ -110,19 +110,19 @@ DeprecatedString DictObject::to_deprecated_string(int indent) const
first = false;
append_indent(builder, indent + 1);
builder.appendff("/{} ", key);
builder.appendff("{}", value.to_deprecated_string(indent + 1));
builder.appendff("{}", value.to_byte_string(indent + 1));
}
builder.append('\n');
append_indent(builder, indent);
builder.append(">>"sv);
return builder.to_deprecated_string();
return builder.to_byte_string();
}
DeprecatedString StreamObject::to_deprecated_string(int indent) const
ByteString StreamObject::to_byte_string(int indent) const
{
StringBuilder builder;
builder.appendff("{}\n", dict()->to_deprecated_string(indent));
builder.appendff("{}\n", dict()->to_byte_string(indent));
builder.append("stream\n"sv);
size_t ascii_count = 0;
@ -156,19 +156,19 @@ DeprecatedString StreamObject::to_deprecated_string(int indent) const
}
builder.append("endstream"sv);
return builder.to_deprecated_string();
return builder.to_byte_string();
}
DeprecatedString IndirectValue::to_deprecated_string(int indent) const
ByteString IndirectValue::to_byte_string(int indent) const
{
StringBuilder builder;
builder.appendff("{} {} obj\n", index(), generation_index());
append_indent(builder, indent + 1);
builder.append(value().to_deprecated_string(indent + 1));
builder.append(value().to_byte_string(indent + 1));
builder.append('\n');
append_indent(builder, indent);
builder.append("endobj"sv);
return builder.to_deprecated_string();
return builder.to_byte_string();
}
}

View file

@ -19,7 +19,7 @@ namespace PDF {
class StringObject final : public Object {
public:
StringObject(DeprecatedString string, bool is_binary)
StringObject(ByteString string, bool is_binary)
: m_string(move(string))
, m_is_binary(is_binary)
{
@ -27,18 +27,18 @@ public:
~StringObject() override = default;
[[nodiscard]] ALWAYS_INLINE DeprecatedString const& string() const { return m_string; }
[[nodiscard]] ALWAYS_INLINE ByteString const& string() const { return m_string; }
[[nodiscard]] ALWAYS_INLINE bool is_binary() const { return m_is_binary; }
void set_string(DeprecatedString string) { m_string = move(string); }
void set_string(ByteString string) { m_string = move(string); }
char const* type_name() const override { return "string"; }
DeprecatedString to_deprecated_string(int indent) const override;
ByteString to_byte_string(int indent) const override;
protected:
bool is_string() const override { return true; }
private:
DeprecatedString m_string;
ByteString m_string;
bool m_is_binary;
};
@ -54,7 +54,7 @@ public:
[[nodiscard]] ALWAYS_INLINE DeprecatedFlyString const& name() const { return m_name; }
char const* type_name() const override { return "name"; }
DeprecatedString to_deprecated_string(int indent) const override;
ByteString to_byte_string(int indent) const override;
protected:
bool is_name() const override { return true; }
@ -95,7 +95,7 @@ public:
{
return "array";
}
DeprecatedString to_deprecated_string(int indent) const override;
ByteString to_byte_string(int indent) const override;
protected:
bool is_array() const override { return true; }
@ -142,7 +142,7 @@ public:
{
return "dict";
}
DeprecatedString to_deprecated_string(int indent) const override;
ByteString to_byte_string(int indent) const override;
protected:
bool is_dict() const override { return true; }
@ -166,7 +166,7 @@ public:
[[nodiscard]] ByteBuffer& buffer() { return m_buffer; }
char const* type_name() const override { return "stream"; }
DeprecatedString to_deprecated_string(int indent) const override;
ByteString to_byte_string(int indent) const override;
private:
bool is_stream() const override { return true; }
@ -190,7 +190,7 @@ public:
[[nodiscard]] ALWAYS_INLINE Value const& value() const { return m_value; }
char const* type_name() const override { return "indirect_object"; }
DeprecatedString to_deprecated_string(int indent) const override;
ByteString to_byte_string(int indent) const override;
protected:
bool is_indirect_value() const override { return true; }

View file

@ -179,7 +179,7 @@ struct Formatter<PDF::Operator> : Formatter<StringView> {
builder.append(" ]"sv);
}
return Formatter<StringView>::format(format_builder, builder.to_deprecated_string());
return Formatter<StringView>::format(format_builder, builder.to_byte_string());
}
};

View file

@ -55,8 +55,8 @@ struct Formatter<PDF::Page> : Formatter<FormatString> {
{
return Formatter<FormatString>::format(builder,
"Page {{\n resources={}\n contents={}\n media_box={}\n crop_box={}\n user_unit={}\n rotate={}\n}}"sv,
page.resources->to_deprecated_string(1),
page.contents->to_deprecated_string(1),
page.resources->to_byte_string(1),
page.contents->to_byte_string(1),
page.media_box,
page.crop_box,
page.user_unit,

View file

@ -36,7 +36,7 @@ void Parser::set_document(WeakPtr<Document> const& document)
m_document = document;
}
DeprecatedString Parser::parse_comment()
ByteString Parser::parse_comment()
{
StringBuilder comment;
while (true) {
@ -52,7 +52,7 @@ DeprecatedString Parser::parse_comment()
m_reader.consume_eol();
m_reader.consume_whitespace();
}
return comment.to_deprecated_string();
return comment.to_byte_string();
}
PDFErrorOr<Value> Parser::parse_value(CanBeIndirectValue can_be_indirect_value)
@ -198,7 +198,7 @@ PDFErrorOr<Value> Parser::parse_number()
m_reader.consume_whitespace();
auto string = DeprecatedString(m_reader.bytes().slice(start_offset, m_reader.offset() - start_offset));
auto string = ByteString(m_reader.bytes().slice(start_offset, m_reader.offset() - start_offset));
if (is_float)
return Value(strtof(string.characters(), nullptr));
@ -238,14 +238,14 @@ PDFErrorOr<NonnullRefPtr<NameObject>> Parser::parse_name()
m_reader.consume_whitespace();
return make_object<NameObject>(builder.to_deprecated_string());
return make_object<NameObject>(builder.to_byte_string());
}
PDFErrorOr<NonnullRefPtr<StringObject>> Parser::parse_string()
{
ScopeGuard guard([&] { m_reader.consume_whitespace(); });
DeprecatedString string;
ByteString string;
bool is_binary_string;
if (m_reader.matches('(')) {
@ -264,7 +264,7 @@ PDFErrorOr<NonnullRefPtr<StringObject>> Parser::parse_string()
return string_object;
}
PDFErrorOr<DeprecatedString> Parser::parse_literal_string()
PDFErrorOr<ByteString> Parser::parse_literal_string()
{
VERIFY(m_reader.consume('('));
StringBuilder builder;
@ -342,10 +342,10 @@ PDFErrorOr<DeprecatedString> Parser::parse_literal_string()
}
}
return builder.to_deprecated_string();
return builder.to_byte_string();
}
PDFErrorOr<DeprecatedString> Parser::parse_hex_string()
PDFErrorOr<ByteString> Parser::parse_hex_string()
{
VERIFY(m_reader.consume('<'));
@ -354,7 +354,7 @@ PDFErrorOr<DeprecatedString> Parser::parse_hex_string()
while (true) {
if (m_reader.matches('>')) {
m_reader.consume();
return builder.to_deprecated_string();
return builder.to_byte_string();
} else {
int hex_value = 0;
@ -367,7 +367,7 @@ PDFErrorOr<DeprecatedString> Parser::parse_hex_string()
m_reader.consume();
hex_value *= 16;
builder.append(static_cast<char>(hex_value));
return builder.to_deprecated_string();
return builder.to_byte_string();
}
if (!isxdigit(ch))
@ -602,7 +602,7 @@ PDFErrorOr<Vector<Operator>> Parser::parse_operators()
}
Error Parser::error(
DeprecatedString const& message
ByteString const& message
#ifdef PDF_DEBUG
,
SourceLocation loc

View file

@ -33,7 +33,7 @@ public:
void set_document(WeakPtr<Document> const&);
DeprecatedString parse_comment();
ByteString parse_comment();
void move_by(size_t count) { m_reader.move_by(count); }
void move_to(size_t offset) { m_reader.move_to(offset); }
@ -50,8 +50,8 @@ public:
PDFErrorOr<Value> parse_number();
PDFErrorOr<NonnullRefPtr<NameObject>> parse_name();
PDFErrorOr<NonnullRefPtr<StringObject>> parse_string();
PDFErrorOr<DeprecatedString> parse_literal_string();
PDFErrorOr<DeprecatedString> parse_hex_string();
PDFErrorOr<ByteString> parse_literal_string();
PDFErrorOr<ByteString> parse_hex_string();
PDFErrorOr<NonnullRefPtr<ArrayObject>> parse_array();
PDFErrorOr<HashMap<DeprecatedFlyString, Value>> parse_dict_contents_until(char const*);
PDFErrorOr<NonnullRefPtr<DictObject>> parse_dict();
@ -73,7 +73,7 @@ public:
protected:
Error error(
DeprecatedString const& message
ByteString const& message
#ifdef PDF_DEBUG
,
SourceLocation loc = SourceLocation::current()

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/ByteString.h>
#include <AK/Debug.h>
#include <AK/DeprecatedString.h>
#include <AK/Function.h>
#include <AK/ScopeGuard.h>
#include <AK/Span.h>
@ -64,7 +64,7 @@ public:
PDFErrorOr<T> try_read()
{
if (sizeof(T) + m_offset > m_bytes.size()) {
auto message = DeprecatedString::formatted("Cannot read {} bytes at offset {} of ReadonlyBytes of size {}", sizeof(T), m_offset, m_bytes.size());
auto message = ByteString::formatted("Cannot read {} bytes at offset {} of ReadonlyBytes of size {}", sizeof(T), m_offset, m_bytes.size());
return Error { Error::Type::Parse, message };
}
return read<T>();
@ -92,7 +92,7 @@ public:
bool matches(char const* chars) const
{
DeprecatedString string(chars);
ByteString string(chars);
if (remaining() < string.length())
return false;
@ -163,7 +163,7 @@ public:
for (auto i = from; i <= to; i++) {
char value = static_cast<char>(bytes().at(i));
auto line = DeprecatedString::formatted(" {}: '{}' (value={:3d}) ", i, value, static_cast<u8>(value));
auto line = ByteString::formatted(" {}: '{}' (value={:3d}) ", i, value, static_cast<u8>(value));
if (i == offset()) {
dbgln("{} <<< current location, forwards={}", line, m_forwards);
} else {

View file

@ -829,7 +829,7 @@ PDFErrorOr<void> Renderer::set_graphics_state_from_dict(NonnullRefPtr<DictObject
return {};
}
PDFErrorOr<void> Renderer::show_text(DeprecatedString const& string)
PDFErrorOr<void> Renderer::show_text(ByteString const& string)
{
if (!text_state().font)
return Error::rendering_unsupported_error("Can't draw text because an invalid font was in use");

View file

@ -76,7 +76,7 @@ struct GraphicsState {
RefPtr<ColorSpace> paint_color_space { DeviceGrayColorSpace::the() };
ColorOrStyle stroke_style { Color::Black };
ColorOrStyle paint_style { Color::Black };
DeprecatedString color_rendering_intent { "RelativeColorimetric"sv };
ByteString color_rendering_intent { "RelativeColorimetric"sv };
float flatness_tolerance { 0.0f };
float line_width { 1.0f };
LineCapStyle line_cap_style { LineCapStyle::ButtCap };
@ -132,7 +132,7 @@ private:
void begin_path_paint();
void end_path_paint();
PDFErrorOr<void> set_graphics_state_from_dict(NonnullRefPtr<DictObject>);
PDFErrorOr<void> show_text(DeprecatedString const&);
PDFErrorOr<void> show_text(ByteString const&);
PDFErrorOr<NonnullRefPtr<Gfx::Bitmap>> load_image(NonnullRefPtr<StreamObject>);
PDFErrorOr<void> show_image(NonnullRefPtr<StreamObject>);
void show_empty_image(int width, int height);
@ -235,7 +235,7 @@ struct Formatter<PDF::LineDashPattern> : Formatter<StringView> {
}
builder.appendff("] {}", pattern.phase);
return format_builder.put_string(builder.to_deprecated_string());
return format_builder.put_string(builder.to_byte_string());
}
};
@ -279,7 +279,7 @@ struct Formatter<PDF::TextState> : Formatter<StringView> {
builder.appendff(" rise={}\n", state.rise);
builder.appendff(" knockout={}\n", state.knockout);
builder.append(" }"sv);
return format_builder.put_string(builder.to_deprecated_string());
return format_builder.put_string(builder.to_byte_string());
}
};
@ -309,7 +309,7 @@ struct Formatter<PDF::GraphicsState> : Formatter<StringView> {
builder.appendff(" line_dash_pattern={}\n", state.line_dash_pattern);
builder.appendff(" text_state={}\n", state.text_state);
builder.append('}');
return format_builder.put_string(builder.to_deprecated_string());
return format_builder.put_string(builder.to_byte_string());
}
};

View file

@ -9,30 +9,30 @@
namespace PDF {
DeprecatedString Value::to_deprecated_string(int indent) const
ByteString Value::to_byte_string(int indent) const
{
return visit(
[&](Empty const&) -> DeprecatedString {
[&](Empty const&) -> ByteString {
// Return type deduction means that we can't use implicit conversions.
return "<empty>";
},
[&](nullptr_t const&) -> DeprecatedString {
[&](nullptr_t const&) -> ByteString {
return "null";
},
[&](bool const& b) -> DeprecatedString {
[&](bool const& b) -> ByteString {
return b ? "true" : "false";
},
[&](int const& i) {
return DeprecatedString::number(i);
return ByteString::number(i);
},
[&](float const& f) {
return DeprecatedString::number(f);
return ByteString::number(f);
},
[&](Reference const& ref) {
return DeprecatedString::formatted("{} {} R", ref.as_ref_index(), ref.as_ref_generation_index());
return ByteString::formatted("{} {} R", ref.as_ref_index(), ref.as_ref_generation_index());
},
[&](NonnullRefPtr<Object> const& object) {
return object->to_deprecated_string(indent);
return object->to_byte_string(indent);
});
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Format.h>
#include <AK/RefPtr.h>
#include <AK/Variant.h>
@ -36,7 +36,7 @@ public:
set<NonnullRefPtr<Object>>(*refptr);
}
[[nodiscard]] DeprecatedString to_deprecated_string(int indent = 0) const;
[[nodiscard]] ByteString to_byte_string(int indent = 0) const;
[[nodiscard]] ALWAYS_INLINE bool has_number() const { return has<int>() || has<float>(); }
@ -95,7 +95,7 @@ template<>
struct Formatter<PDF::Value> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, PDF::Value const& value)
{
return Formatter<StringView>::format(builder, value.to_deprecated_string());
return Formatter<StringView>::format(builder, value.to_byte_string());
}
};

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Format.h>
#include <AK/RefCounted.h>
#include <AK/Vector.h>
@ -126,7 +126,7 @@ struct Formatter<PDF::XRefEntry> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, PDF::XRefEntry const& entry)
{
return Formatter<StringView>::format(builder,
DeprecatedString::formatted("XRefEntry {{ offset={} generation={} used={} }}",
ByteString::formatted("XRefEntry {{ offset={} generation={} used={} }}",
entry.byte_offset,
entry.generation_number,
entry.in_use));
@ -142,7 +142,7 @@ struct Formatter<PDF::XRefTable> : Formatter<StringView> {
for (auto& entry : table.m_entries)
builder.appendff("\n {}", entry);
builder.append("\n}"sv);
return Formatter<StringView>::format(format_builder, builder.to_deprecated_string());
return Formatter<StringView>::format(format_builder, builder.to_byte_string());
}
};