summaryrefslogtreecommitdiff
path: root/include/vcl
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-03-26 10:30:34 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-03-26 11:58:03 +0100
commit83b011b61e941250f8c58ff12c864830fe52f9c0 (patch)
treedd27bfae50bad8ddb788e54d18504fdcffb910e8 /include/vcl
parentf3b98808b13e7ec7bfcee9e249175cbb75ee7245 (diff)
create operator bool for Bitmap
so we can use a more natural syntax than "!!" Change-Id: I8152a0d3ce37115fc83d332a26725ca1d28d959a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113147 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/vcl')
-rw-r--r--include/vcl/bitmap.hxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 3a2baf9e24c7..4c1a3b3dbddf 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -124,6 +124,7 @@ public:
inline bool operator!() const;
bool operator==( const Bitmap& rBitmap ) const;
bool operator!=( const Bitmap& rBitmap ) const { return !operator==(rBitmap); }
+ inline operator bool() const;
inline bool IsEmpty() const;
void SetEmpty();
@@ -550,6 +551,11 @@ private:
};
+inline Bitmap::operator bool() const
+{
+ return mxSalBmp != nullptr;
+}
+
inline bool Bitmap::operator!() const
{
return( mxSalBmp == nullptr );