You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PackageKit-Qt/0003-Add-operator-to-bitfie...

75 lines
1.5 KiB

From c7b3c1dde34409fba8fd80355338d7f3fc1feffe Mon Sep 17 00:00:00 2001
From: Daniel Nicoletti <dantti12@gmail.com>
Date: Tue, 6 May 2014 12:43:26 -0300
Subject: [PATCH 03/16] Add operator== to bitfield
---
src/bitfield.cpp | 15 ++++++++++-----
src/bitfield.h | 6 +++++-
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/bitfield.cpp b/src/bitfield.cpp
index c986905..68ef80c 100644
--- a/src/bitfield.cpp
+++ b/src/bitfield.cpp
@@ -2,7 +2,7 @@
using namespace PackageKit;
-Bitfield::Bitfield () : m_val (0)
+Bitfield::Bitfield ()
{
}
@@ -61,10 +61,15 @@ Bitfield Bitfield::operator|= (Bitfield mask)
Bitfield& Bitfield::operator= (const Bitfield& other)
{
- if (this == &other)
- return *this;
+ if (this == &other)
+ return *this;
- m_val = other.m_val;
+ m_val = other.m_val;
- return *this;
+ return *this;
+}
+
+bool Bitfield::operator==(const Bitfield &other)
+{
+ return m_val == other.m_val;
}
diff --git a/src/bitfield.h b/src/bitfield.h
index d7dd481..8535e46 100644
--- a/src/bitfield.h
+++ b/src/bitfield.h
@@ -2,6 +2,7 @@
#define PACKAGEKIT_BITFIELD_H
#include <QtGlobal>
+#include <QMetaType>
namespace PackageKit {
@@ -23,11 +24,14 @@ public:
Bitfield operator|= (Bitfield mask);
Bitfield& operator= (const Bitfield& other);
+ bool operator==(const Bitfield &other);
private:
- qulonglong m_val;
+ qulonglong m_val = 0;
};
} // End namespace PackageKit
+Q_DECLARE_METATYPE(PackageKit::Bitfield)
+
#endif
--
2.1.0