Add warn() to QPDF's public API

This commit is contained in:
Jay Berkenbilt 2021-01-16 18:35:04 -05:00
parent fc88837d4b
commit 6226b69dba
5 changed files with 32 additions and 16 deletions

View File

@ -1,3 +1,7 @@
2021-01-16 Jay Berkenbilt <ejb@ql.org>
* Add warn() to QPDF's public API.
2021-01-11 Jay Berkenbilt <ejb@ql.org>
* Fix very old error in code that was finding attachment streams.

View File

@ -246,6 +246,12 @@ class QPDF
QPDF_DLL
unsigned long long getUniqueId() const;
// Issue a warning on behalf of this QPDF object. It will be
// emitted with other warnings, following warning suppression
// rules, and it will be available with getWarnings().
QPDF_DLL
void warn(QPDFExc const& e);
QPDF_DLL
std::string getFilename() const;
QPDF_DLL
@ -694,19 +700,6 @@ class QPDF
};
friend class Resolver;
// Warner class allows QPDFObjectHandle to create warnings
class Warner
{
friend class QPDFObjectHandle;
friend class QPDF_Stream;
private:
static void warn(QPDF* qpdf, QPDFExc const& e)
{
qpdf->warn(e);
}
};
friend class Warner;
// ParseGuard class allows QPDFObjectHandle to detect re-entrant
// resolution
class ParseGuard
@ -895,7 +888,6 @@ class QPDF
void parse(char const* password);
void inParse(bool);
void warn(QPDFExc const& e);
void setTrailer(QPDFObjectHandle obj);
void read_xref(qpdf_offset_t offset);
void reconstruct_xref(QPDFExc& e);

View File

@ -3016,7 +3016,7 @@ QPDFObjectHandle::warn(QPDF* qpdf, QPDFExc const& e)
// string, then just throw the exception.
if (qpdf)
{
QPDF::Warner::warn(qpdf, e);
qpdf->warn(e);
}
else
{

View File

@ -679,5 +679,5 @@ QPDF_Stream::replaceDict(QPDFObjectHandle new_dict)
void
QPDF_Stream::warn(QPDFExc const& e)
{
QPDF::Warner::warn(this->qpdf, e);
this->qpdf->warn(e);
}

View File

@ -4818,6 +4818,26 @@ print "\n";
</listitem>
</varlistentry>
-->
<varlistentry>
<term>10.2.0: Month dd, YYYY</term>
<listitem>
<itemizedlist>
<listitem>
<para>
Library Enhancements
</para>
<itemizedlist>
<listitem>
<para>
Add <function>warn</function> to
<classname>QPDF</classname>'s public API.
</para>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
<varlistentry>
<term>10.1.0: January 5, 2021</term>
<listitem>