From 567dd10abec38aa7bee0b2934e6ce36c7623699b Mon Sep 17 00:00:00 2001 From: m-holger Date: Wed, 12 Feb 2025 11:45:10 +0000 Subject: [PATCH] Inline various QPDFObjGen method and remove 'explicit' from constructor --- include/qpdf/QPDFObjGen.hh | 28 ++++++++++++++++++---------- libqpdf/QPDFObjGen.cc | 15 --------------- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/include/qpdf/QPDFObjGen.hh b/include/qpdf/QPDFObjGen.hh index c37531b..3553ff3 100644 --- a/include/qpdf/QPDFObjGen.hh +++ b/include/qpdf/QPDFObjGen.hh @@ -21,8 +21,10 @@ #define QPDFOBJGEN_HH #include + #include #include +#include class QPDFObjectHandle; class QPDFObjectHelper; @@ -33,13 +35,10 @@ class QPDFObjectHelper; class QPDFObjGen { public: - // ABI: change to default. QPDF_DLL - QPDFObjGen() - { - } + QPDFObjGen() = default; QPDF_DLL - explicit QPDFObjGen(int obj, int gen) : + QPDFObjGen(int obj, int gen) : obj(obj), gen(gen) { @@ -48,19 +47,19 @@ class QPDFObjGen bool operator<(QPDFObjGen const& rhs) const { - return (obj < rhs.obj) || ((obj == rhs.obj) && (gen < rhs.gen)); + return (obj < rhs.obj) || (obj == rhs.obj && gen < rhs.gen); } QPDF_DLL bool operator==(QPDFObjGen const& rhs) const { - return (obj == rhs.obj) && (gen == rhs.gen); + return obj == rhs.obj && gen == rhs.gen; } QPDF_DLL bool operator!=(QPDFObjGen const& rhs) const { - return (obj != rhs.obj) || (gen != rhs.gen); + return !(*this == rhs); } QPDF_DLL int @@ -81,9 +80,18 @@ class QPDFObjGen return obj != 0; } QPDF_DLL - std::string unparse(char separator = ',') const; + std::string + unparse(char separator = ',') const + { + return std::to_string(obj) + separator + std::to_string(gen); + } QPDF_DLL - friend std::ostream& operator<<(std::ostream& os, const QPDFObjGen& og); + friend std::ostream& + operator<<(std::ostream& os, QPDFObjGen og) + { + os << og.obj << "," << og.gen; + return os; + } // Convenience class for loop detection when processing objects. // diff --git a/libqpdf/QPDFObjGen.cc b/libqpdf/QPDFObjGen.cc index f3b19f6..5242f4f 100644 --- a/libqpdf/QPDFObjGen.cc +++ b/libqpdf/QPDFObjGen.cc @@ -6,21 +6,6 @@ #include -// ABI: inline and pass og by value -std::ostream& -operator<<(std::ostream& os, const QPDFObjGen& og) -{ - os << og.obj << "," << og.gen; - return os; -} - -// ABI: inline -std::string -QPDFObjGen::unparse(char separator) const -{ - return std::to_string(obj) + separator + std::to_string(gen); -} - bool QPDFObjGen::set::add(QPDFObjectHandle const& oh) { -- libgit2 0.21.4