summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibPDF
diff options
context:
space:
mode:
authorMatthew Olsson <matthewcolsson@gmail.com>2021-06-01 11:16:11 -0700
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-06-12 22:45:01 +0430
commit612b1837033dca3ad872c54de315f393146b06d9 (patch)
treee51d872ba06f4960e05cb487cd94821bc86982bc /Userland/Libraries/LibPDF
parent0a4d8ef98d8e402b1f42c5c895c899ee83eb9a75 (diff)
downloadserenity-612b1837033dca3ad872c54de315f393146b06d9.zip
LibPDF: Convert to east-const to comply with the recent style changes
Diffstat (limited to 'Userland/Libraries/LibPDF')
-rw-r--r--Userland/Libraries/LibPDF/ColorSpace.cpp8
-rw-r--r--Userland/Libraries/LibPDF/ColorSpace.h10
-rw-r--r--Userland/Libraries/LibPDF/Command.h6
-rw-r--r--Userland/Libraries/LibPDF/Document.cpp12
-rw-r--r--Userland/Libraries/LibPDF/Document.h26
-rw-r--r--Userland/Libraries/LibPDF/Filter.cpp22
-rw-r--r--Userland/Libraries/LibPDF/Filter.h22
-rw-r--r--Userland/Libraries/LibPDF/Object.cpp4
-rw-r--r--Userland/Libraries/LibPDF/Object.h32
-rw-r--r--Userland/Libraries/LibPDF/Parser.cpp16
-rw-r--r--Userland/Libraries/LibPDF/Parser.h14
-rw-r--r--Userland/Libraries/LibPDF/Reader.h4
-rw-r--r--Userland/Libraries/LibPDF/Renderer.cpp14
-rw-r--r--Userland/Libraries/LibPDF/Renderer.h36
-rw-r--r--Userland/Libraries/LibPDF/Value.cpp2
-rw-r--r--Userland/Libraries/LibPDF/Value.h6
-rw-r--r--Userland/Libraries/LibPDF/XRefTable.h6
17 files changed, 120 insertions, 120 deletions
diff --git a/Userland/Libraries/LibPDF/ColorSpace.cpp b/Userland/Libraries/LibPDF/ColorSpace.cpp
index fba6b6c453..1336eb6aa7 100644
--- a/Userland/Libraries/LibPDF/ColorSpace.cpp
+++ b/Userland/Libraries/LibPDF/ColorSpace.cpp
@@ -15,7 +15,7 @@ RefPtr<DeviceGrayColorSpace> DeviceGrayColorSpace::the()
return instance;
}
-Color DeviceGrayColorSpace::color(const Vector<Value>& arguments) const
+Color DeviceGrayColorSpace::color(Vector<Value> const& arguments) const
{
VERIFY(arguments.size() == 1);
auto gray = static_cast<u8>(arguments[0].to_float() * 255.0f);
@@ -28,7 +28,7 @@ RefPtr<DeviceRGBColorSpace> DeviceRGBColorSpace::the()
return instance;
}
-Color DeviceRGBColorSpace::color(const Vector<Value>& arguments) const
+Color DeviceRGBColorSpace::color(Vector<Value> const& arguments) const
{
VERIFY(arguments.size() == 3);
auto r = static_cast<u8>(arguments[0].to_float() * 255.0f);
@@ -43,7 +43,7 @@ RefPtr<DeviceCMYKColorSpace> DeviceCMYKColorSpace::the()
return instance;
}
-Color DeviceCMYKColorSpace::color(const Vector<Value>& arguments) const
+Color DeviceCMYKColorSpace::color(Vector<Value> const& arguments) const
{
VERIFY(arguments.size() == 4);
auto c = arguments[0].to_float();
@@ -196,7 +196,7 @@ constexpr Array<float, 3> convert_to_srgb(Array<float, 3> xyz)
return matrix_multiply(conversion_matrix, xyz);
}
-Color CalRGBColorSpace::color(const Vector<Value>& arguments) const
+Color CalRGBColorSpace::color(Vector<Value> const& arguments) const
{
VERIFY(arguments.size() == 3);
auto a = clamp(arguments[0].to_float(), 0.0f, 1.0f);
diff --git a/Userland/Libraries/LibPDF/ColorSpace.h b/Userland/Libraries/LibPDF/ColorSpace.h
index 90fa479775..2a680ff5ff 100644
--- a/Userland/Libraries/LibPDF/ColorSpace.h
+++ b/Userland/Libraries/LibPDF/ColorSpace.h
@@ -30,7 +30,7 @@ class ColorSpace : public RefCounted<ColorSpace> {
public:
virtual ~ColorSpace() = default;
- virtual Color color(const Vector<Value>& arguments) const = 0;
+ virtual Color color(Vector<Value> const& arguments) const = 0;
};
class DeviceGrayColorSpace final : public ColorSpace {
@@ -39,7 +39,7 @@ public:
virtual ~DeviceGrayColorSpace() override = default;
- virtual Color color(const Vector<Value>& arguments) const override;
+ virtual Color color(Vector<Value> const& arguments) const override;
private:
DeviceGrayColorSpace() = default;
@@ -51,7 +51,7 @@ public:
virtual ~DeviceRGBColorSpace() override = default;
- virtual Color color(const Vector<Value>& arguments) const override;
+ virtual Color color(Vector<Value> const& arguments) const override;
private:
DeviceRGBColorSpace() = default;
@@ -63,7 +63,7 @@ public:
virtual ~DeviceCMYKColorSpace() override = default;
- virtual Color color(const Vector<Value>& arguments) const override;
+ virtual Color color(Vector<Value> const& arguments) const override;
private:
DeviceCMYKColorSpace() = default;
@@ -74,7 +74,7 @@ public:
static RefPtr<CalRGBColorSpace> create(RefPtr<Document>, Vector<Value>&& parameters);
virtual ~CalRGBColorSpace() override = default;
- virtual Color color(const Vector<Value>& arguments) const override;
+ virtual Color color(Vector<Value> const& arguments) const override;
private:
CalRGBColorSpace() = default;
diff --git a/Userland/Libraries/LibPDF/Command.h b/Userland/Libraries/LibPDF/Command.h
index 539cba6d8b..c751ded5d0 100644
--- a/Userland/Libraries/LibPDF/Command.h
+++ b/Userland/Libraries/LibPDF/Command.h
@@ -96,7 +96,7 @@ enum class CommandType {
class Command {
public:
- static CommandType command_type_from_symbol(const StringView& symbol_string)
+ static CommandType command_type_from_symbol(StringView const& symbol_string)
{
#define V(name, snake_name, symbol) \
if (symbol_string == #symbol) \
@@ -152,7 +152,7 @@ public:
}
[[nodiscard]] ALWAYS_INLINE CommandType command_type() const { return m_command_type; }
- [[nodiscard]] ALWAYS_INLINE const Vector<Value>& arguments() const { return m_arguments; }
+ [[nodiscard]] ALWAYS_INLINE Vector<Value> const& arguments() const { return m_arguments; }
private:
CommandType m_command_type;
@@ -165,7 +165,7 @@ namespace AK {
template<>
struct Formatter<PDF::Command> : Formatter<StringView> {
- void format(FormatBuilder& format_builder, const PDF::Command& command)
+ void format(FormatBuilder& format_builder, PDF::Command const& command)
{
StringBuilder builder;
builder.appendff("{} ({})",
diff --git a/Userland/Libraries/LibPDF/Document.cpp b/Userland/Libraries/LibPDF/Document.cpp
index c545e781dd..473b5f5a20 100644
--- a/Userland/Libraries/LibPDF/Document.cpp
+++ b/Userland/Libraries/LibPDF/Document.cpp
@@ -34,7 +34,7 @@ String OutlineItem::to_string(int indent) const
return builder.to_string();
}
-RefPtr<Document> Document::create(const ReadonlyBytes& bytes)
+RefPtr<Document> Document::create(ReadonlyBytes const& bytes)
{
auto parser = adopt_ref(*new Parser({}, bytes));
auto document = adopt_ref(*new Document(parser));
@@ -49,7 +49,7 @@ RefPtr<Document> Document::create(const ReadonlyBytes& bytes)
return document;
}
-Document::Document(const NonnullRefPtr<Parser>& parser)
+Document::Document(NonnullRefPtr<Parser> const& parser)
: m_parser(parser)
{
m_parser->set_document(this);
@@ -131,7 +131,7 @@ Page Document::get_page(u32 index)
return page;
}
-Value Document::resolve(const Value& value)
+Value Document::resolve(Value const& value)
{
if (value.is_ref()) {
// FIXME: Surely indirect PDF objects can't contain another indirect PDF object,
@@ -159,7 +159,7 @@ bool Document::build_page_tree()
return add_page_tree_node_to_page_tree(page_tree);
}
-bool Document::add_page_tree_node_to_page_tree(NonnullRefPtr<DictObject> page_tree)
+bool Document::add_page_tree_node_to_page_tree(NonnullRefPtr<DictObject> const& page_tree)
{
if (!page_tree->contains(CommonNames::Kids) || !page_tree->contains(CommonNames::Count))
return false;
@@ -216,7 +216,7 @@ void Document::build_outline()
m_outline->count = outline_dict->get_value(CommonNames::Count).as_int();
}
-NonnullRefPtr<OutlineItem> Document::build_outline_item(NonnullRefPtr<DictObject> outline_item_dict)
+NonnullRefPtr<OutlineItem> Document::build_outline_item(NonnullRefPtr<DictObject> const& outline_item_dict)
{
auto outline_item = adopt_ref(*new OutlineItem {});
@@ -284,7 +284,7 @@ NonnullRefPtr<OutlineItem> Document::build_outline_item(NonnullRefPtr<DictObject
return outline_item;
}
-NonnullRefPtrVector<OutlineItem> Document::build_outline_item_chain(const Value& first_ref, const Value& last_ref)
+NonnullRefPtrVector<OutlineItem> Document::build_outline_item_chain(Value const& first_ref, Value const& last_ref)
{
VERIFY(first_ref.is_ref());
VERIFY(last_ref.is_ref());
diff --git a/Userland/Libraries/LibPDF/Document.h b/Userland/Libraries/LibPDF/Document.h
index 3cf5806634..6c885cfcf2 100644
--- a/Userland/Libraries/LibPDF/Document.h
+++ b/Userland/Libraries/LibPDF/Document.h
@@ -72,9 +72,9 @@ struct OutlineDict final : public RefCounted<OutlineDict> {
class Document final : public RefCounted<Document> {
public:
- static RefPtr<Document> create(const ReadonlyBytes& bytes);
+ static RefPtr<Document> create(ReadonlyBytes const& bytes);
- ALWAYS_INLINE const RefPtr<OutlineDict>& outline() const { return m_outline; }
+ ALWAYS_INLINE RefPtr<OutlineDict> const& outline() const { return m_outline; }
[[nodiscard]] Value get_or_load_value(u32 index);
@@ -92,12 +92,12 @@ public:
// Strips away the layer of indirection by turning indirect value
// refs into the value they reference, and indirect values into
// the value being wrapped.
- Value resolve(const Value& value);
+ Value resolve(Value const& value);
// Like resolve, but unwraps the Value into the given type. Accepts
// any object type, and the three primitive Value types.
template<IsValueType T>
- UnwrappedValueType<T> resolve_to(const Value& value)
+ UnwrappedValueType<T> resolve_to(Value const& value)
{
auto resolved = resolve(value);
@@ -114,7 +114,7 @@ public:
}
private:
- explicit Document(const NonnullRefPtr<Parser>& parser);
+ explicit Document(NonnullRefPtr<Parser> const& parser);
// FIXME: Currently, to improve performance, we don't load any pages at Document
// construction, rather we just load the page structure and populate
@@ -123,11 +123,11 @@ private:
// improve lookup time. This would reduce the initial overhead by not loading
// every page tree node of, say, a 1000+ page PDF file.
bool build_page_tree();
- bool add_page_tree_node_to_page_tree(NonnullRefPtr<DictObject> page_tree);
+ bool add_page_tree_node_to_page_tree(NonnullRefPtr<DictObject> const& page_tree);
void build_outline();
- NonnullRefPtr<OutlineItem> build_outline_item(NonnullRefPtr<DictObject> outline_item_dict);
- NonnullRefPtrVector<OutlineItem> build_outline_item_chain(const Value& first_ref, const Value& last_ref);
+ NonnullRefPtr<OutlineItem> build_outline_item(NonnullRefPtr<DictObject> const& outline_item_dict);
+ NonnullRefPtrVector<OutlineItem> build_outline_item_chain(Value const& first_ref, Value const& last_ref);
NonnullRefPtr<Parser> m_parser;
RefPtr<DictObject> m_catalog;
@@ -143,7 +143,7 @@ namespace AK {
template<>
struct Formatter<PDF::Rectangle> : Formatter<StringView> {
- void format(FormatBuilder& builder, const PDF::Rectangle& rectangle)
+ void format(FormatBuilder& builder, PDF::Rectangle const& rectangle)
{
Formatter<StringView>::format(builder,
String::formatted("Rectangle {{ ll=({}, {}), ur=({}, {}) }}",
@@ -156,7 +156,7 @@ struct Formatter<PDF::Rectangle> : Formatter<StringView> {
template<>
struct Formatter<PDF::Page> : Formatter<StringView> {
- void format(FormatBuilder& builder, const PDF::Page& page)
+ void format(FormatBuilder& builder, PDF::Page const& page)
{
constexpr auto fmt_string = "Page {{\n resources={}\n contents={}\n media_box={}\n crop_box={}\n user_unit={}\n rotate={}\n}}";
auto str = String::formatted(fmt_string,
@@ -172,7 +172,7 @@ struct Formatter<PDF::Page> : Formatter<StringView> {
template<>
struct Formatter<PDF::Destination> : Formatter<StringView> {
- void format(FormatBuilder& builder, const PDF::Destination& destination)
+ void format(FormatBuilder& builder, PDF::Destination const& destination)
{
String type_str;
switch (destination.type) {
@@ -213,7 +213,7 @@ struct Formatter<PDF::Destination> : Formatter<StringView> {
template<>
struct Formatter<PDF::OutlineItem> : Formatter<StringView> {
- void format(FormatBuilder& builder, const PDF::OutlineItem& item)
+ void format(FormatBuilder& builder, PDF::OutlineItem const& item)
{
Formatter<StringView>::format(builder, item.to_string(0));
}
@@ -221,7 +221,7 @@ struct Formatter<PDF::OutlineItem> : Formatter<StringView> {
template<>
struct Formatter<PDF::OutlineDict> : Formatter<StringView> {
- void format(FormatBuilder& builder, const PDF::OutlineDict& dict)
+ void format(FormatBuilder& builder, PDF::OutlineDict const& dict)
{
StringBuilder child_builder;
child_builder.append('[');
diff --git a/Userland/Libraries/LibPDF/Filter.cpp b/Userland/Libraries/LibPDF/Filter.cpp
index 6891cb95ce..bdb8b10b82 100644
--- a/Userland/Libraries/LibPDF/Filter.cpp
+++ b/Userland/Libraries/LibPDF/Filter.cpp
@@ -11,7 +11,7 @@
namespace PDF {
-Optional<ByteBuffer> Filter::decode(const ReadonlyBytes& bytes, const FlyString& encoding_type)
+Optional<ByteBuffer> Filter::decode(ReadonlyBytes const& bytes, FlyString const& encoding_type)
{
if (encoding_type == CommonNames::ASCIIHexDecode)
return decode_ascii_hex(bytes);
@@ -37,7 +37,7 @@ Optional<ByteBuffer> Filter::decode(const ReadonlyBytes& bytes, const FlyString&
return {};
}
-Optional<ByteBuffer> Filter::decode_ascii_hex(const ReadonlyBytes& bytes)
+Optional<ByteBuffer> Filter::decode_ascii_hex(ReadonlyBytes const& bytes)
{
if (bytes.size() % 2 == 0)
return decode_hex(bytes);
@@ -64,7 +64,7 @@ Optional<ByteBuffer> Filter::decode_ascii_hex(const ReadonlyBytes& bytes)
return output;
};
-Optional<ByteBuffer> Filter::decode_ascii85(const ReadonlyBytes& bytes)
+Optional<ByteBuffer> Filter::decode_ascii85(ReadonlyBytes const& bytes)
{
Vector<u8> buff;
buff.ensure_capacity(bytes.size());
@@ -119,13 +119,13 @@ Optional<ByteBuffer> Filter::decode_ascii85(const ReadonlyBytes& bytes)
return ByteBuffer::copy(buff.span());
};
-Optional<ByteBuffer> Filter::decode_lzw(const ReadonlyBytes&)
+Optional<ByteBuffer> Filter::decode_lzw(ReadonlyBytes const&)
{
dbgln("LZW decoding is not supported");
VERIFY_NOT_REACHED();
};
-Optional<ByteBuffer> Filter::decode_flate(const ReadonlyBytes& bytes)
+Optional<ByteBuffer> Filter::decode_flate(ReadonlyBytes const& bytes)
{
// FIXME: The spec says Flate decoding is "based on" zlib, does that mean they
// aren't exactly the same?
@@ -135,37 +135,37 @@ Optional<ByteBuffer> Filter::decode_flate(const ReadonlyBytes& bytes)
return buff.value();
};
-Optional<ByteBuffer> Filter::decode_run_length(const ReadonlyBytes&)
+Optional<ByteBuffer> Filter::decode_run_length(ReadonlyBytes const&)
{
// FIXME: Support RunLength decoding
TODO();
};
-Optional<ByteBuffer> Filter::decode_ccitt(const ReadonlyBytes&)
+Optional<ByteBuffer> Filter::decode_ccitt(ReadonlyBytes const&)
{
// FIXME: Support CCITT decoding
TODO();
};
-Optional<ByteBuffer> Filter::decode_jbig2(const ReadonlyBytes&)
+Optional<ByteBuffer> Filter::decode_jbig2(ReadonlyBytes const&)
{
// FIXME: Support JBIG2 decoding
TODO();
};
-Optional<ByteBuffer> Filter::decode_dct(const ReadonlyBytes&)
+Optional<ByteBuffer> Filter::decode_dct(ReadonlyBytes const&)
{
// FIXME: Support dct decoding
TODO();
};
-Optional<ByteBuffer> Filter::decode_jpx(const ReadonlyBytes&)
+Optional<ByteBuffer> Filter::decode_jpx(ReadonlyBytes const&)
{
// FIXME: Support JPX decoding
TODO();
};
-Optional<ByteBuffer> Filter::decode_crypt(const ReadonlyBytes&)
+Optional<ByteBuffer> Filter::decode_crypt(ReadonlyBytes const&)
{
// FIXME: Support Crypt decoding
TODO();
diff --git a/Userland/Libraries/LibPDF/Filter.h b/Userland/Libraries/LibPDF/Filter.h
index 876656c38a..490005c3a2 100644
--- a/Userland/Libraries/LibPDF/Filter.h
+++ b/Userland/Libraries/LibPDF/Filter.h
@@ -13,19 +13,19 @@ namespace PDF {
class Filter {
public:
- static Optional<ByteBuffer> decode(const ReadonlyBytes& bytes, const FlyString& encoding_type);
+ static Optional<ByteBuffer> decode(ReadonlyBytes const& bytes, FlyString const& encoding_type);
private:
- static Optional<ByteBuffer> decode_ascii_hex(const ReadonlyBytes& bytes);
- static Optional<ByteBuffer> decode_ascii85(const ReadonlyBytes& bytes);
- static Optional<ByteBuffer> decode_lzw(const ReadonlyBytes& bytes);
- static Optional<ByteBuffer> decode_flate(const ReadonlyBytes& bytes);
- static Optional<ByteBuffer> decode_run_length(const ReadonlyBytes& bytes);
- static Optional<ByteBuffer> decode_ccitt(const ReadonlyBytes& bytes);
- static Optional<ByteBuffer> decode_jbig2(const ReadonlyBytes& bytes);
- static Optional<ByteBuffer> decode_dct(const ReadonlyBytes& bytes);
- static Optional<ByteBuffer> decode_jpx(const ReadonlyBytes& bytes);
- static Optional<ByteBuffer> decode_crypt(const ReadonlyBytes& bytes);
+ static Optional<ByteBuffer> decode_ascii_hex(ReadonlyBytes const& bytes);
+ static Optional<ByteBuffer> decode_ascii85(ReadonlyBytes const& bytes);
+ static Optional<ByteBuffer> decode_lzw(ReadonlyBytes const& bytes);
+ static Optional<ByteBuffer> decode_flate(ReadonlyBytes const& bytes);
+ static Optional<ByteBuffer> decode_run_length(ReadonlyBytes const& bytes);
+ static Optional<ByteBuffer> decode_ccitt(ReadonlyBytes const& bytes);
+ static Optional<ByteBuffer> decode_jbig2(ReadonlyBytes const& bytes);
+ static Optional<ByteBuffer> decode_dct(ReadonlyBytes const& bytes);
+ static Optional<ByteBuffer> decode_jpx(ReadonlyBytes const& bytes);
+ static Optional<ByteBuffer> decode_crypt(ReadonlyBytes const& bytes);
};
}
diff --git a/Userland/Libraries/LibPDF/Object.cpp b/Userland/Libraries/LibPDF/Object.cpp
index 1b7921a092..c94f868a27 100644
--- a/Userland/Libraries/LibPDF/Object.cpp
+++ b/Userland/Libraries/LibPDF/Object.cpp
@@ -15,7 +15,7 @@ NonnullRefPtr<Object> ArrayObject::get_object_at(Document* document, size_t inde
return document->resolve_to<Object>(m_elements[index]);
}
-NonnullRefPtr<Object> DictObject::get_object(Document* document, const FlyString& key) const
+NonnullRefPtr<Object> DictObject::get_object(Document* document, FlyString const& key) const
{
return document->resolve_to<Object>(get_value(key));
}
@@ -26,7 +26,7 @@ NonnullRefPtr<Object> DictObject::get_object(Document* document, const FlyString
return document->resolve_to<class_name>(m_elements[index]); \
} \
\
- NonnullRefPtr<class_name> DictObject::get_##snake_name(Document* document, const FlyString& key) const \
+ NonnullRefPtr<class_name> DictObject::get_##snake_name(Document* document, FlyString const& key) const \
{ \
return document->resolve_to<class_name>(get(key).value()); \
}
diff --git a/Userland/Libraries/LibPDF/Object.h b/Userland/Libraries/LibPDF/Object.h
index c13a0e4d8d..47d0794de6 100644
--- a/Userland/Libraries/LibPDF/Object.h
+++ b/Userland/Libraries/LibPDF/Object.h
@@ -46,7 +46,7 @@ public:
~StringObject() override = default;
- [[nodiscard]] ALWAYS_INLINE const String& string() const { return m_string; }
+ [[nodiscard]] ALWAYS_INLINE String const& string() const { return m_string; }
[[nodiscard]] ALWAYS_INLINE bool is_binary() const { return m_is_binary; }
ALWAYS_INLINE bool is_string() const override { return true; }
@@ -67,7 +67,7 @@ public:
~NameObject() override = default;
- [[nodiscard]] ALWAYS_INLINE const FlyString& name() const { return m_name; }
+ [[nodiscard]] ALWAYS_INLINE FlyString const& name() const { return m_name; }
ALWAYS_INLINE bool is_name() const override { return true; }
ALWAYS_INLINE const char* type_name() const override { return "name"; }
@@ -92,8 +92,8 @@ public:
ALWAYS_INLINE auto begin() const { return m_elements.begin(); }
ALWAYS_INLINE auto end() const { return m_elements.end(); }
- ALWAYS_INLINE const Value& operator[](size_t index) const { return at(index); }
- ALWAYS_INLINE const Value& at(size_t index) const { return m_elements[index]; }
+ ALWAYS_INLINE Value const& operator[](size_t index) const { return at(index); }
+ ALWAYS_INLINE Value const& at(size_t index) const { return m_elements[index]; }
NonnullRefPtr<Object> get_object_at(Document*, size_t index) const;
@@ -122,24 +122,24 @@ public:
~DictObject() override = default;
- [[nodiscard]] ALWAYS_INLINE const HashMap<FlyString, Value>& map() const { return m_map; }
+ [[nodiscard]] ALWAYS_INLINE HashMap<FlyString, Value> const& map() const { return m_map; }
template<typename... Args>
bool contains(Args&&... keys) const { return (m_map.contains(keys) && ...); }
- ALWAYS_INLINE Optional<Value> get(const FlyString& key) const { return m_map.get(key); }
+ ALWAYS_INLINE Optional<Value> get(FlyString const& key) const { return m_map.get(key); }
- Value get_value(const FlyString& key) const
+ Value get_value(FlyString const& key) const
{
auto value = get(key);
VERIFY(value.has_value());
return value.value();
}
- NonnullRefPtr<Object> get_object(Document*, const FlyString& key) const;
+ NonnullRefPtr<Object> get_object(Document*, FlyString const& key) const;
#define DEFINE_GETTER(class_name, snake_name) \
- NonnullRefPtr<class_name> get_##snake_name(Document*, const FlyString& key) const;
+ NonnullRefPtr<class_name> get_##snake_name(Document*, FlyString const& key) const;
ENUMERATE_OBJECT_TYPES(DEFINE_GETTER)
#undef DEFINE_GETTER
@@ -156,7 +156,7 @@ private:
class StreamObject : public Object {
public:
- explicit StreamObject(const NonnullRefPtr<DictObject>& dict)
+ explicit StreamObject(NonnullRefPtr<DictObject> const& dict)
: m_dict(dict)
{
}
@@ -176,7 +176,7 @@ private:
class PlainTextStreamObject final : public StreamObject {
public:
- PlainTextStreamObject(const NonnullRefPtr<DictObject>& dict, const ReadonlyBytes& bytes)
+ PlainTextStreamObject(NonnullRefPtr<DictObject> const& dict, ReadonlyBytes const& bytes)
: StreamObject(dict)
, m_bytes(bytes)
{
@@ -192,7 +192,7 @@ private:
class EncodedStreamObject final : public StreamObject {
public:
- EncodedStreamObject(const NonnullRefPtr<DictObject>& dict, ByteBuffer&& buffer)
+ EncodedStreamObject(NonnullRefPtr<DictObject> const& dict, ByteBuffer&& buffer)
: StreamObject(dict)
, m_buffer(buffer)
{
@@ -208,7 +208,7 @@ private:
class IndirectValue final : public Object {
public:
- IndirectValue(u32 index, u32 generation_index, const Value& value)
+ IndirectValue(u32 index, u32 generation_index, Value const& value)
: m_index(index)
, m_value(value)
{
@@ -218,7 +218,7 @@ public:
~IndirectValue() override = default;
[[nodiscard]] ALWAYS_INLINE u32 index() const { return m_index; }
- [[nodiscard]] ALWAYS_INLINE const Value& value() const { return m_value; }
+ [[nodiscard]] ALWAYS_INLINE Value const& value() const { return m_value; }
ALWAYS_INLINE bool is_indirect_value() const override { return true; }
ALWAYS_INLINE const char* type_name() const override { return "indirect_object"; }
@@ -257,7 +257,7 @@ namespace AK {
template<PDF::IsObject T>
struct Formatter<T> : Formatter<StringView> {
- void format(FormatBuilder& builder, const T& object)
+ void format(FormatBuilder& builder, T const& object)
{
Formatter<StringView>::format(builder, object.to_string(0));
}
@@ -265,7 +265,7 @@ struct Formatter<T> : Formatter<StringView> {
template<PDF::IsObject T>
struct Formatter<NonnullRefPtr<T>> : Formatter<T> {
- void format(FormatBuilder& builder, const NonnullRefPtr<T>& object)
+ void format(FormatBuilder& builder, NonnullRefPtr<T> const& object)
{
Formatter<T>::format(builder, *object);
}
diff --git a/Userland/Libraries/LibPDF/Parser.cpp b/Userland/Libraries/LibPDF/Parser.cpp
index 17f678172b..c3a66bb96b 100644
--- a/Userland/Libraries/LibPDF/Parser.cpp
+++ b/Userland/Libraries/LibPDF/Parser.cpp
@@ -24,18 +24,18 @@ static NonnullRefPtr<T> make_object(Args... args) requires(IsBaseOf<Object, T>)
return adopt_ref(*new T(forward<Args>(args)...));
}
-Vector<Command> Parser::parse_graphics_commands(const ReadonlyBytes& bytes)
+Vector<Command> Parser::parse_graphics_commands(ReadonlyBytes const& bytes)
{
auto parser = adopt_ref(*new Parser(bytes));
return parser->parse_graphics_commands();
}
-Parser::Parser(Badge<Document>, const ReadonlyBytes& bytes)
+Parser::Parser(Badge<Document>, ReadonlyBytes const& bytes)
: m_reader(bytes)
{
}
-Parser::Parser(const ReadonlyBytes& bytes)
+Parser::Parser(ReadonlyBytes const& bytes)
: m_reader(bytes)
{
}
@@ -390,7 +390,7 @@ RefPtr<DictObject> Parser::parse_file_trailer()
return dict;
}
-Optional<Parser::PageOffsetHintTable> Parser::parse_page_offset_hint_table(const ReadonlyBytes& hint_stream_bytes)
+Optional<Parser::PageOffsetHintTable> Parser::parse_page_offset_hint_table(ReadonlyBytes const& hint_stream_bytes)
{
if (hint_stream_bytes.size() < sizeof(PageOffsetHintTable))
return {};
@@ -438,7 +438,7 @@ Optional<Parser::PageOffsetHintTable> Parser::parse_page_offset_hint_table(const
return hint_table;
}
-Optional<Vector<Parser::PageOffsetHintTableEntry>> Parser::parse_all_page_offset_hint_table_entries(const PageOffsetHintTable& hint_table, const ReadonlyBytes& hint_stream_bytes)
+Optional<Vector<Parser::PageOffsetHintTableEntry>> Parser::parse_all_page_offset_hint_table_entries(PageOffsetHintTable const& hint_table, ReadonlyBytes const& hint_stream_bytes)
{
InputMemoryStream input_stream(hint_stream_bytes);
input_stream.seek(sizeof(PageOffsetHintTable));
@@ -1167,7 +1167,7 @@ namespace AK {
template<>
struct Formatter<PDF::Parser::LinearizationDictionary> : Formatter<StringView> {
- void format(FormatBuilder& format_builder, const PDF::Parser::LinearizationDictionary& dict)
+ void format(FormatBuilder& format_builder, PDF::Parser::LinearizationDictionary const& dict)
{
StringBuilder builder;
builder.append("{\n");
@@ -1188,7 +1188,7 @@ struct Formatter<PDF::Parser::LinearizationDictionary> : Formatter<StringView> {
template<>
struct Formatter<PDF::Parser::PageOffsetHintTable> : Formatter<StringView> {
- void format(FormatBuilder& format_builder, const PDF::Parser::PageOffsetHintTable& table)
+ void format(FormatBuilder& format_builder, PDF::Parser::PageOffsetHintTable const& table)
{
StringBuilder builder;
builder.append("{\n");
@@ -1212,7 +1212,7 @@ struct Formatter<PDF::Parser::PageOffsetHintTable> : Formatter<StringView> {
template<>
struct Formatter<PDF::Parser::PageOffsetHintTableEntry> : Formatter<StringView> {
- void format(FormatBuilder& format_builder, const PDF::Parser::PageOffsetHintTableEntry& entry)
+ void format(FormatBuilder& format_builder, PDF::Parser::PageOffsetHintTableEntry const& entry)
{
StringBuilder builder;
builder.append("{\n");
diff --git a/Userland/Libraries/LibPDF/Parser.h b/Userland/Libraries/LibPDF/Parser.h
index e1a0912463..6dbe3b2f5f 100644
--- a/Userland/Libraries/LibPDF/Parser.h
+++ b/Userland/Libraries/LibPDF/Parser.h
@@ -18,12 +18,12 @@ class Document;
class Parser final : public RefCounted<Parser> {
public:
- static Vector<Command> parse_graphics_commands(const ReadonlyBytes&);
+ static Vector<Command> parse_graphics_commands(ReadonlyBytes const&);
- Parser(Badge<Document>, const ReadonlyBytes&);
+ Parser(Badge<Document>, ReadonlyBytes const&);
- [[nodiscard]] ALWAYS_INLINE const RefPtr<DictObject>& trailer() const { return m_trailer; }
- void set_document(const RefPtr<Document>& document) { m_document = document; }
+ [[nodiscard]] ALWAYS_INLINE RefPtr<DictObject> const& trailer() const { return m_trailer; }
+ void set_document(RefPtr<Document> const& document) { m_document = document; }
// Parses the header and initializes the xref table and trailer
bool initialize();
@@ -80,15 +80,15 @@ private:
friend struct AK::Formatter<PageOffsetHintTable>;
friend struct AK::Formatter<PageOffsetHintTableEntry>;
- explicit Parser(const ReadonlyBytes&);
+ explicit Parser(ReadonlyBytes const&);
bool parse_header();
bool initialize_linearization_dict();
bool initialize_linearized_xref_table();
bool initialize_non_linearized_xref_table();
bool initialize_hint_tables();
- Optional<PageOffsetHintTable> parse_page_offset_hint_table(const ReadonlyBytes& hint_stream_bytes);
- Optional<Vector<PageOffsetHintTableEntry>> parse_all_page_offset_hint_table_entries(const PageOffsetHintTable&, const ReadonlyBytes& hint_stream_bytes);
+ Optional<PageOffsetHintTable> parse_page_offset_hint_table(ReadonlyBytes const& hint_stream_bytes);
+ Optional<Vector<PageOffsetHintTableEntry>> parse_all_page_offset_hint_table_entries(PageOffsetHintTable const&, ReadonlyBytes const& hint_stream_bytes);
RefPtr<XRefTable> parse_xref_table();
RefPtr<DictObject> parse_file_trailer();
diff --git a/Userland/Libraries/LibPDF/Reader.h b/Userland/Libraries/LibPDF/Reader.h
index 9459340792..e3d7b50c65 100644
--- a/Userland/Libraries/LibPDF/Reader.h
+++ b/Userland/Libraries/LibPDF/Reader.h
@@ -14,12 +14,12 @@ namespace PDF {
class Reader {
public:
- explicit Reader(const ReadonlyBytes& bytes)
+ explicit Reader(ReadonlyBytes const& bytes)
: m_bytes(bytes)
{
}
- ALWAYS_INLINE const ReadonlyBytes& bytes() const { return m_bytes; }
+ ALWAYS_INLINE ReadonlyBytes const& bytes() const { return m_bytes; }
ALWAYS_INLINE size_t offset() const { return m_offset; }
bool done() const
diff --git a/Userland/Libraries/LibPDF/Renderer.cpp b/Userland/Libraries/LibPDF/Renderer.cpp
index fe17b1d72a..cacb122f38 100644
--- a/Userland/Libraries/LibPDF/Renderer.cpp
+++ b/Userland/Libraries/LibPDF/Renderer.cpp
@@ -9,7 +9,7 @@
#include <LibPDF/Renderer.h>
#define RENDERER_HANDLER(name) \
- void Renderer::handle_##name([[maybe_unused]] const Vector<Value>& args)
+ void Renderer::handle_##name([[maybe_unused]] Vector<Value> const& args)
#define RENDERER_TODO(name) \
RENDERER_HANDLER(name) \
@@ -20,12 +20,12 @@
namespace PDF {
-void Renderer::render(Document& document, const Page& page, RefPtr<Gfx::Bitmap> bitmap)
+void Renderer::render(Document& document, Page const& page, RefPtr<Gfx::Bitmap> bitmap)
{
Renderer(document, page, bitmap).render();
}
-Renderer::Renderer(RefPtr<Document> document, const Page& page, RefPtr<Gfx::Bitmap> bitmap)
+Renderer::Renderer(RefPtr<Document> document, Page const& page, RefPtr<Gfx::Bitmap> bitmap)
: m_document(document)
, m_bitmap(bitmap)
, m_page(page)
@@ -83,7 +83,7 @@ void Renderer::render()
handle_command(command);
}
-void Renderer::handle_command(const Command& command)
+void Renderer::handle_command(Command const& command)
{
switch (command.command_type()) {
#define V(name, snake_name, symbol) \
@@ -528,7 +528,7 @@ void Renderer::set_graphics_state_from_dict(NonnullRefPtr<DictObject> dict)
handle_set_flatness_tolerance({ dict->get_value(CommonNames::FL) });
}
-void Renderer::show_text(const String& string, float shift)
+void Renderer::show_text(String const& string, float shift)
{
auto utf = Utf8View(string);
@@ -566,7 +566,7 @@ void Renderer::show_text(const String& string, float shift)
m_text_matrix = Gfx::AffineTransform(1, 0, 0, 1, delta_x, 0).multiply(m_text_matrix);
}
-RefPtr<ColorSpace> Renderer::get_color_space(const Value& value)
+RefPtr<ColorSpace> Renderer::get_color_space(Value const& value)
{
auto name = object_cast<NameObject>(value.as_object())->name();
@@ -600,7 +600,7 @@ RefPtr<ColorSpace> Renderer::get_color_space(const Value& value)
TODO();
}
-const Gfx::AffineTransform& Renderer::calculate_text_rendering_matrix()
+Gfx::AffineTransform const& Renderer::calculate_text_rendering_matrix()
{
if (m_text_rendering_matrix_is_dirty) {
m_text_rendering_matrix = Gfx::AffineTransform(
diff --git a/Userland/Libraries/LibPDF/Renderer.h b/Userland/Libraries/LibPDF/Renderer.h
index 3bb67261c2..b2daebc19a 100644
--- a/Userland/Libraries/LibPDF/Renderer.h
+++ b/Userland/Libraries/LibPDF/Renderer.h
@@ -79,29 +79,29 @@ struct GraphicsState {
class Renderer {
public:
- static void render(Document&, const Page&, RefPtr<Gfx::Bitmap>);
+ static void render(Document&, Page const&, RefPtr<Gfx::Bitmap>);
private:
- Renderer(RefPtr<Document>, const Page&, RefPtr<Gfx::Bitmap>);
+ Renderer(RefPtr<Document>, Page const&, RefPtr<Gfx::Bitmap>);
void render();
- void handle_command(const Command&);
+ void handle_command(Command const&);
#define V(name, snake_name, symbol) \
- void handle_##snake_name(const Vector<Value>& args);
+ void handle_##snake_name(Vector<Value> const& args);
ENUMERATE_COMMANDS(V)
#undef V
- void handle_text_next_line_show_string(const Vector<Value>& args);
- void handle_text_next_line_show_string_set_spacing(const Vector<Value>& args);
+ void handle_text_next_line_show_string(Vector<Value> const& args);
+ void handle_text_next_line_show_string_set_spacing(Vector<Value> const& args);
void set_graphics_state_from_dict(NonnullRefPtr<DictObject>);
// shift is the manual advance given in the TJ command array
- void show_text(const String&, float shift = 0.0f);
- RefPtr<ColorSpace> get_color_space(const Value&);
+ void show_text(String const&, float shift = 0.0f);
+ RefPtr<ColorSpace> get_color_space(Value const&);
- ALWAYS_INLINE const GraphicsState& state() const { return m_graphics_state_stack.last(); }
+ ALWAYS_INLINE GraphicsState const& state() const { return m_graphics_state_stack.last(); }
ALWAYS_INLINE GraphicsState& state() { return m_graphics_state_stack.last(); }
- ALWAYS_INLINE const TextState& text_state() const { return state().text_state; }
+ ALWAYS_INLINE TextState const& text_state() const { return state().text_state; }
ALWAYS_INLINE TextState& text_state() { return state().text_state; }
template<typename T>
@@ -113,11 +113,11 @@ private:
template<typename T>
ALWAYS_INLINE Gfx::Rect<T> map(Gfx::Rect<T>) const;
- const Gfx::AffineTransform& calculate_text_rendering_matrix();
+ Gfx::AffineTransform const& calculate_text_rendering_matrix();
RefPtr<Document> m_document;
RefPtr<Gfx::Bitmap> m_bitmap;
- const Page& m_page;
+ Page const& m_page;
Gfx::Painter m_painter;
Gfx::Path m_current_path;
@@ -135,7 +135,7 @@ namespace AK {
template<>
struct Formatter<PDF::LineCapStyle> : Formatter<StringView> {
- void format(FormatBuilder& builder, const PDF::LineCapStyle& style)
+ void format(FormatBuilder& builder, PDF::LineCapStyle const& style)
{
switch (style) {
case PDF::LineCapStyle::ButtCap:
@@ -153,7 +153,7 @@ struct Formatter<PDF::LineCapStyle> : Formatter<StringView> {
template<>
struct Formatter<PDF::LineJoinStyle> : Formatter<StringView> {
- void format(FormatBuilder& builder, const PDF::LineJoinStyle& style)
+ void format(FormatBuilder& builder, PDF::LineJoinStyle const& style)
{
switch (style) {
case PDF::LineJoinStyle::Miter:
@@ -171,7 +171,7 @@ struct Formatter<PDF::LineJoinStyle> : Formatter<StringView> {
template<>
struct Formatter<PDF::LineDashPattern> : Formatter<StringView> {
- void format(FormatBuilder& format_builder, const PDF::LineDashPattern& pattern)
+ void format(FormatBuilder& format_builder, PDF::LineDashPattern const& pattern)
{
StringBuilder builder;
builder.append("[");
@@ -191,7 +191,7 @@ struct Formatter<PDF::LineDashPattern> : Formatter<StringView> {
template<>
struct Formatter<PDF::TextRenderingMode> : Formatter<StringView> {
- void format(FormatBuilder& builder, const PDF::TextRenderingMode& style)
+ void format(FormatBuilder& builder, PDF::TextRenderingMode const& style)
{
switch (style) {
case PDF::TextRenderingMode::Fill:
@@ -224,7 +224,7 @@ struct Formatter<PDF::TextRenderingMode> : Formatter<StringView> {
template<>
struct Formatter<PDF::TextState> : Formatter<StringView> {
- void format(FormatBuilder& format_builder, const PDF::TextState& state)
+ void format(FormatBuilder& format_builder, PDF::TextState const& state)
{
StringBuilder builder;
builder.append("TextState {\n");
@@ -245,7 +245,7 @@ struct Formatter<PDF::TextState> : Formatter<StringView> {
template<>
struct Formatter<PDF::GraphicsState> : Formatter<StringView> {
- void format(FormatBuilder& format_builder, const PDF::GraphicsState& state)
+ void format(FormatBuilder& format_builder, PDF::GraphicsState const& state)
{
StringBuilder builder;
builder.append("GraphicsState {\n");
diff --git a/Userland/Libraries/LibPDF/Value.cpp b/Userland/Libraries/LibPDF/Value.cpp
index 0248356fa6..887cda9bda 100644
--- a/Userland/Libraries/LibPDF/Value.cpp
+++ b/Userland/Libraries/LibPDF/Value.cpp
@@ -15,7 +15,7 @@ Value::~Value()
m_as_object->unref();
}
-Value& Value::operator=(const Value& other)
+Value& Value::operator=(Value const& other)
{
m_type = other.m_type;
switch (m_type) {
diff --git a/Userland/Libraries/LibPDF/Value.h b/Userland/Libraries/LibPDF/Value.h
index d26ac45d71..160edd68ba 100644
--- a/Userland/Libraries/LibPDF/Value.h
+++ b/Userland/Libraries/LibPDF/Value.h
@@ -79,14 +79,14 @@ public:
m_as_object = obj;
}
- Value(const Value& other)
+ Value(Value const& other)
{
*this = other;
}
~Value();
- Value& operator=(const Value& other);
+ Value& operator=(Value const& other);
[[nodiscard]] ALWAYS_INLINE bool is_empty() const { return m_type == Type::Empty; }
[[nodiscard]] ALWAYS_INLINE bool is_null() const { return m_type == Type::Null; }
@@ -191,7 +191,7 @@ namespace AK {
template<>
struct Formatter<PDF::Value> : Formatter<StringView> {
- void format(FormatBuilder& builder, const PDF::Value& value)
+ void format(FormatBuilder& builder, PDF::Value const& value)
{
Formatter<StringView>::format(builder, value.to_string());
}
diff --git a/Userland/Libraries/LibPDF/XRefTable.h b/Userland/Libraries/LibPDF/XRefTable.h
index 3cfb617dc8..ee70464755 100644
--- a/Userland/Libraries/LibPDF/XRefTable.h
+++ b/Userland/Libraries/LibPDF/XRefTable.h
@@ -52,7 +52,7 @@ public:
return true;
}
- void add_section(const XRefSection& section)
+ void add_section(XRefSection const& section)
{
m_entries.ensure_capacity(section.starting_index + section.count);
@@ -98,7 +98,7 @@ namespace AK {
template<>
struct Formatter<PDF::XRefEntry> : Formatter<StringView> {
- void format(FormatBuilder& builder, const PDF::XRefEntry& entry)
+ void format(FormatBuilder& builder, PDF::XRefEntry const& entry)
{
Formatter<StringView>::format(builder,
String::formatted("XRefEntry {{ offset={} generation={} used={} }}",
@@ -110,7 +110,7 @@ struct Formatter<PDF::XRefEntry> : Formatter<StringView> {
template<>
struct Formatter<PDF::XRefTable> : Formatter<StringView> {
- void format(FormatBuilder& format_builder, const PDF::XRefTable& table)
+ void format(FormatBuilder& format_builder, PDF::XRefTable const& table)
{
StringBuilder builder;
builder.append("XRefTable {");