QPDFWriter: clean up overloaded functions

In a small number of cases, it makes sense to replace an overloaded
function with a function that takes a default argument. We can do this
now because we've already broken binary compatibility since the last
release.
This commit is contained in:
Jay Berkenbilt 2019-06-22 09:59:47 -04:00
parent 46304befec
commit 658b5bb3be
3 changed files with 9 additions and 33 deletions

7
TODO
View File

@ -1,10 +1,3 @@
Next ABI
========
* Check all overloaded methods to see if any can be eliminated by
using defaulted arguments. See ../misc/find-overloaded-functions.pl
(not in source repo)
Lexical
=======

View File

@ -248,9 +248,7 @@ class QPDFWriter
// R3 encryption parameters are used, and to 1.5 when object
// streams are used.
QPDF_DLL
void setMinimumPDFVersion(std::string const&);
QPDF_DLL
void setMinimumPDFVersion(std::string const&, int extension_level);
void setMinimumPDFVersion(std::string const&, int extension_level = 0);
// Force the PDF version of the output file to be a given version.
// Use of this function may create PDF files that will not work
@ -268,9 +266,7 @@ class QPDFWriter
// Additionally, forcing to a version below 1.5 will disable
// object streams.
QPDF_DLL
void forcePDFVersion(std::string const&);
QPDF_DLL
void forcePDFVersion(std::string const&, int extension_level);
void forcePDFVersion(std::string const&, int extension_level = 0);
// Provide additional text to insert in the PDF file somewhere
// near the beginning of the file. This can be used to add
@ -483,10 +479,9 @@ class QPDFWriter
void writeTrailer(trailer_e which, int size,
bool xref_stream, qpdf_offset_t prev,
int linearization_pass);
void unparseObject(QPDFObjectHandle object, int level, int flags);
void unparseObject(QPDFObjectHandle object, int level, int flags,
// for stream dictionaries
size_t stream_length, bool compress);
size_t stream_length = 0, bool compress = false);
void unparseChild(QPDFObjectHandle child, int level, int flags);
void initializeSpecialStreams();
void preserveObjectStreams();

View File

@ -231,12 +231,6 @@ QPDFWriter::setNewlineBeforeEndstream(bool val)
this->m->newline_before_endstream = val;
}
void
QPDFWriter::setMinimumPDFVersion(std::string const& version)
{
setMinimumPDFVersion(version, 0);
}
void
QPDFWriter::setMinimumPDFVersion(std::string const& version,
int extension_level)
@ -285,12 +279,6 @@ QPDFWriter::setMinimumPDFVersion(std::string const& version,
}
}
void
QPDFWriter::forcePDFVersion(std::string const& version)
{
forcePDFVersion(version, 0);
}
void
QPDFWriter::forcePDFVersion(std::string const& version,
int extension_level)
@ -1433,12 +1421,6 @@ QPDFWriter::writeTrailer(trailer_e which, int size, bool xref_stream,
writeString(">>");
}
void
QPDFWriter::unparseObject(QPDFObjectHandle object, int level, int flags)
{
unparseObject(object, level, flags, 0, false);
}
void
QPDFWriter::unparseObject(QPDFObjectHandle object, int level,
int flags, size_t stream_length,
@ -2811,6 +2793,9 @@ QPDFWriter::writeHintStream(int hint_id)
qpdf_offset_t
QPDFWriter::writeXRefTable(trailer_e which, int first, int last, int size)
{
// There are too many extra arguments to replace overloaded
// function with defaults in the header file...too much risk of
// leaving something off.
return writeXRefTable(which, first, last, size, 0, false, 0, 0, 0, 0);
}
@ -2858,6 +2843,9 @@ qpdf_offset_t
QPDFWriter::writeXRefStream(int objid, int max_id, qpdf_offset_t max_offset,
trailer_e which, int first, int last, int size)
{
// There are too many extra arguments to replace overloaded
// function with defaults in the header file...too much risk of
// leaving something off.
return writeXRefStream(objid, max_id, max_offset,
which, first, last, size, 0, 0, 0, 0, false, 0);
}