summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/subsurface-qt/DiveObjectHelper.cpp10
-rw-r--r--core/subsurface-qt/DiveObjectHelper.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp
index c19c03eb4..cb6cf6dd1 100644
--- a/core/subsurface-qt/DiveObjectHelper.cpp
+++ b/core/subsurface-qt/DiveObjectHelper.cpp
@@ -67,6 +67,16 @@ DiveObjectHelper::DiveObjectHelper(struct dive *d) :
{
}
+DiveObjectHelper::operator bool() const
+{
+ return !!m_dive;
+}
+
+bool DiveObjectHelper::operator!() const
+{
+ return !m_dive;
+}
+
int DiveObjectHelper::number() const
{
return m_dive->number;
diff --git a/core/subsurface-qt/DiveObjectHelper.h b/core/subsurface-qt/DiveObjectHelper.h
index 7071c1580..674386e56 100644
--- a/core/subsurface-qt/DiveObjectHelper.h
+++ b/core/subsurface-qt/DiveObjectHelper.h
@@ -50,6 +50,8 @@ class DiveObjectHelper {
public:
DiveObjectHelper(); // This is only to be used by Qt's metatype system!
DiveObjectHelper(struct dive *dive);
+ operator bool() const; // Returns false if this is an invalid default-generated object
+ bool operator!() const; // Returns true if this is an invalid default-generated object
int number() const;
int id() const;
struct dive *getDive() const;