summaryrefslogtreecommitdiff
path: root/gatoaddress.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gatoaddress.cpp')
-rw-r--r--gatoaddress.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/gatoaddress.cpp b/gatoaddress.cpp
index b99a977..6f1c583 100644
--- a/gatoaddress.cpp
+++ b/gatoaddress.cpp
@@ -31,34 +31,39 @@ struct GatoAddressPrivate : QSharedData
bdaddr_t bd;
quint64 u64;
} addr;
+ GatoAddress::Type type;
};
GatoAddress::GatoAddress()
: d(new GatoAddressPrivate)
{
d->addr.u64 = 0;
+ d->type = TypeNull;
}
-GatoAddress::GatoAddress(quint64 addr)
+GatoAddress::GatoAddress(quint64 addr, Type type)
: d(new GatoAddressPrivate)
{
d->addr.u64 = addr;
+ d->type = type;
}
-GatoAddress::GatoAddress(quint8 addr[])
+GatoAddress::GatoAddress(quint8 addr[], Type type)
: d(new GatoAddressPrivate)
{
d->addr.u64 = 0;
for (int i = 0; i < 6; i++) {
d->addr.bd.b[i] = addr[i];
}
+ d->type = type;
}
-GatoAddress::GatoAddress(const QString &addr)
+GatoAddress::GatoAddress(const QString &addr, Type type)
: d(new GatoAddressPrivate)
{
d->addr.u64 = 0;
str2ba(addr.toLatin1().constData(), &d->addr.bd);
+ d->type = type;
}
GatoAddress::GatoAddress(const GatoAddress &o)
@@ -83,6 +88,11 @@ bool GatoAddress::isNull() const
return toUInt64() == 0;
}
+GatoAddress::Type GatoAddress::type() const
+{
+ return d->type;
+}
+
quint64 GatoAddress::toUInt64() const
{
return d->addr.u64;
@@ -104,10 +114,10 @@ QString GatoAddress::toString() const
bool operator==(const GatoAddress &a, const GatoAddress &b)
{
- return a.toUInt64() == b.toUInt64();
+ return a.toUInt64() == b.toUInt64() && a.type() == b.type();
}
uint qHash(const GatoAddress &a)
{
- return qHash(a.toUInt64());
+ return qHash(a.toUInt64() + a.type());
}