From 32dafbe8a2aaf2230b55dfd0840f70ff7909b5e1 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Thu, 21 Apr 2011 09:30:16 +0200 Subject: Add qt/container usage to Qt example --- qt/driver.cxx | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'qt/driver.cxx') diff --git a/qt/driver.cxx b/qt/driver.cxx index 395f0b5..79d4b4a 100644 --- a/qt/driver.cxx +++ b/qt/driver.cxx @@ -45,11 +45,16 @@ main (int argc, char* argv[]) QSharedPointer jane ( new employee ("Jane", - "Doe", + "Smith", QDate (1983, 1, 18), QByteArray ("\0xD7\0x00\0x14", 3), er)); + john->emails ().insert ("john_d@example.com"); + john->emails ().insert ("john.doe@simple.com"); + jane->emails ().insert ("jane_s@example.com"); + jane->emails ().insert ("jane.smith@simple.com"); + // Set the inverse side of the employee-employer relationship. // er->employees ().push_back (john); @@ -84,6 +89,11 @@ main (int argc, char* argv[]) QByteArray ("0x00\0x32\0x00\0x01\0x00", 5), er)); + john->emails ().insert ("john_d@example.com"); + john->emails ().insert ("john.doe@complex.com"); + jane->emails ().insert ("jane_s@example.com"); + jane->emails ().insert ("jane.smith@complex.com"); + // Set the inverse side of the employee-employer relationship. // er->employees ().push_back (john); @@ -121,12 +131,18 @@ main (int argc, char* argv[]) QSharedPointer pe (p->employer ().load ()); cout << p->first () << " " << p->last () << endl - << " born: " << p->born ().toString () << endl - << " public key length: " << p->public_key ().size () << endl - << " employer: " - << pe->name ().toAscii ().data () << endl; - - cout << endl; + << " born: " << p->born ().toString () << endl; + + for (emails::const_iterator j (p->emails ().begin ()), + e (p->emails ().end ()); j != e; ++j) + { + cout << " email: " << *j << endl; + } + + cout << " public key length: " << p->public_key ().size () << endl + << " employer: " + << pe->name () << endl + << endl; } t.commit (); -- cgit v1.1