Add QPDFObjectHandle operator bool

This commit is contained in:
m-holger 2022-12-31 10:49:28 +00:00 committed by Jay Berkenbilt
parent d7b470761b
commit 56c923d109
1 changed files with 10 additions and 0 deletions

View File

@ -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
{