Commit 1bb209a9bf5ade164cf1ba7c3b9399be70c45c24

Authored by Jay Berkenbilt
1 parent 37fcc5ff

Add QPDF::numWarnings

ChangeLog
  1 +2021-03-01 Jay Berkenbilt <ejb@ql.org>
  2 +
  3 + * Add QPDF::numWarnings() -- useful to tell whether any warnings
  4 + were issued by a specific bit of code.
  5 +
1 2021-02-26 Jay Berkenbilt <ejb@ql.org> 6 2021-02-26 Jay Berkenbilt <ejb@ql.org>
2 7
3 * Bug fix: QPDFFormFieldObjectHelper was mis-handling /DA, /Q, and 8 * Bug fix: QPDFFormFieldObjectHelper was mis-handling /DA, /Q, and
include/qpdf/QPDF.hh
@@ -236,6 +236,11 @@ class QPDF @@ -236,6 +236,11 @@ class QPDF
236 QPDF_DLL 236 QPDF_DLL
237 bool anyWarnings() const; 237 bool anyWarnings() const;
238 238
  239 + // Indicate the number of warnings that have been issued so far.
  240 + // Does not clear the list of warnings.
  241 + QPDF_DLL
  242 + size_t numWarnings() const;
  243 +
239 // Return an application-scoped unique ID for this QPDF object. 244 // Return an application-scoped unique ID for this QPDF object.
240 // This is not a globally unique ID. It is constructing using a 245 // This is not a globally unique ID. It is constructing using a
241 // timestamp and a random number and is intended to be unique 246 // timestamp and a random number and is intended to be unique
libqpdf/QPDF.cc
@@ -366,6 +366,12 @@ QPDF::anyWarnings() const @@ -366,6 +366,12 @@ QPDF::anyWarnings() const
366 return ! this->m->warnings.empty(); 366 return ! this->m->warnings.empty();
367 } 367 }
368 368
  369 +size_t
  370 +QPDF::numWarnings() const
  371 +{
  372 + return this->m->warnings.size();
  373 +}
  374 +
369 bool 375 bool
370 QPDF::findHeader() 376 QPDF::findHeader()
371 { 377 {