mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-10-15 15:00:58 -04:00
Add an assignment operator to Uuid and support serialization with QDataStream.
This commit is contained in:
parent
d5cd0dcd14
commit
9e0a6ad2d8
2 changed files with 27 additions and 0 deletions
|
@ -60,6 +60,13 @@ bool Uuid::isNull() const
|
|||
return true;
|
||||
}
|
||||
|
||||
Uuid& Uuid::operator=(const Uuid& other)
|
||||
{
|
||||
m_data = other.m_data;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool Uuid::operator==(const Uuid& other) const
|
||||
{
|
||||
return m_data == other.m_data;
|
||||
|
@ -80,3 +87,19 @@ uint qHash(const Uuid& key)
|
|||
{
|
||||
return qHash(key.toByteArray());
|
||||
}
|
||||
|
||||
QDataStream& operator<<(QDataStream& stream, const Uuid& uuid)
|
||||
{
|
||||
return stream << uuid.toByteArray();
|
||||
}
|
||||
|
||||
QDataStream& operator>>(QDataStream& stream, Uuid& uuid)
|
||||
{
|
||||
QByteArray data;
|
||||
stream >> data;
|
||||
if (data.size() == Uuid::LENGTH) {
|
||||
uuid = Uuid(data);
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue