diff options
author | m-holger <m-holger@kubitscheck.org> | 2022-12-31 11:49:28 +0100 |
---|---|---|
committer | Jay Berkenbilt <jberkenbilt@users.noreply.github.com> | 2023-01-01 01:16:38 +0100 |
commit | 56c923d1096b0317d978bdadeb44e8198053286c (patch) | |
tree | 3b1598d0c617d9697589bbaa6066da15aff5919d /include | |
parent | d7b470761b3fe6895888f44c15655e880e5afaa0 (diff) | |
download | qpdf-56c923d1096b0317d978bdadeb44e8198053286c.tar.zst |
Add QPDFObjectHandle operator bool
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/QPDFObjectHandle.hh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index 3c597adc..b8787635 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -334,6 +334,11 @@ class QPDFObjectHandle QPDF_DLL inline bool isInitialized() const; + // Return true if the QPDFObjectHandle is initialized. This allows object + // handles to be used in if statements with initializer. + QPDF_DLL + inline operator bool() const; + // This method returns true if the QPDFObjectHandle objects point // to exactly the same underlying object, meaning that changes to // one are reflected in the other, or "if you paint one, the other @@ -1863,6 +1868,11 @@ QPDFObjectHandle::isIndirect() const return (obj != nullptr) && (getObjectID() != 0); } +inline QPDFObjectHandle::operator bool() const +{ + return obj != nullptr; +} + inline bool QPDFObjectHandle::isInitialized() const { |