QtDataSync  4.2.0
A simple offline-first synchronisation framework, to synchronize data of Qt applications between devices
objectkey.h
1 #ifndef QTDATASYNC_OBJECTKEY_H
2 #define QTDATASYNC_OBJECTKEY_H
3 
4 #include <QtCore/qmetatype.h>
5 
6 #include "QtDataSync/qtdatasync_global.h"
7 
8 namespace QtDataSync {
9 
11 struct Q_DATASYNC_EXPORT ObjectKey
12 {
17 
19  ObjectKey(const QByteArray &typeName = {}, const QString &id = {});
20 
22  QByteArray hashed() const;
23 
25  bool operator==(const ObjectKey &other) const;
27  bool operator!=(const ObjectKey &other) const;
28 };
29 
31 uint Q_DATASYNC_EXPORT qHash(const ObjectKey &key, uint seed = 0);
33 QDataStream Q_DATASYNC_EXPORT &operator<<(QDataStream &stream, const ObjectKey &key);
35 QDataStream Q_DATASYNC_EXPORT &operator>>(QDataStream &stream, ObjectKey &key);
37 QDebug Q_DATASYNC_EXPORT operator<<(QDebug debug, const ObjectKey &key);
38 
39 }
40 
41 Q_DECLARE_METATYPE(QtDataSync::ObjectKey)
42 Q_DECLARE_TYPEINFO(QtDataSync::ObjectKey, Q_MOVABLE_TYPE);
43 
44 #endif // QTDATASYNC_OBJECTKEY_H
Q_DATASYNC_EXPORT QDataStream & operator<<(QDataStream &stream, const DeviceInfo &deviceInfo)
Stream operator to stream into a QDataStream.
Defines a unique key to identify a dataset globally.
Definition: objectkey.h:11
The primary namespace of the QtDataSync library.
QByteArray typeName
The name of the type the dataset is of.
Definition: objectkey.h:14
Q_DATASYNC_EXPORT QDataStream & operator>>(QDataStream &stream, DeviceInfo &deviceInfo)
Stream operator to stream out of a QDataStream.
uint Q_DATASYNC_EXPORT qHash(const ObjectKey &key, uint seed=0)
Overload of qHash to use ObjectKey with QHash.
QString id
The id of the dataset (it&#39;s USER property)
Definition: objectkey.h:16