aboutsummaryrefslogtreecommitdiff
path: root/qt/employee.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-09-05 14:58:54 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-09-05 14:58:54 +0200
commit0e272ec96fbcce93ec3be49eca753a7cd0079893 (patch)
tree1149c6cf97ac988acba4d458a5f9a1f1a886c992 /qt/employee.hxx
parent47e38764ebc759c0884921cfb594a215a88dcb98 (diff)
Support for Qt QUuid persistence
This support was added to the basic sub-profile. New test: qt/common/basic. Updated the qt example to use QUuid as an object id.
Diffstat (limited to 'qt/employee.hxx')
-rw-r--r--qt/employee.hxx16
1 files changed, 13 insertions, 3 deletions
diff --git a/qt/employee.hxx b/qt/employee.hxx
index f2c34da..82bbcfb 100644
--- a/qt/employee.hxx
+++ b/qt/employee.hxx
@@ -6,6 +6,7 @@
#include <QtCore/QString>
#include <QtCore/QByteArray>
+#include <QtCore/QUuid>
#include <QtCore/QDateTime>
#include <QtCore/QSharedPointer>
#include <QtCore/QList>
@@ -72,7 +73,8 @@ public:
const QDate& born,
const QByteArray& publicKey,
QSharedPointer<Employer> employer)
- : first_ (first),
+ : id_ (QUuid::createUuid ()),
+ first_ (first),
last_ (last),
born_ (born),
publicKey_ (publicKey),
@@ -80,6 +82,14 @@ public:
{
}
+ // Id.
+ //
+ const QUuid&
+ id () const
+ {
+ return id_;
+ }
+
// Name.
//
const QString&
@@ -141,8 +151,8 @@ private:
Employee () {}
- #pragma db id auto
- unsigned long id_;
+ #pragma db id
+ QUuid id_;
QString first_;
QString last_;