aboutsummaryrefslogtreecommitdiff
path: root/qt/driver.cxx
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-04-21 09:30:16 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-04-22 18:45:40 +0200
commit32dafbe8a2aaf2230b55dfd0840f70ff7909b5e1 (patch)
treeff6fe0d4ccbfedbddad4b8e4b5bc08c63c45d2cb /qt/driver.cxx
parent25c332e53064af13c9f119df6bcc2c3847d93695 (diff)
Add qt/container usage to Qt example
Diffstat (limited to 'qt/driver.cxx')
-rw-r--r--qt/driver.cxx30
1 files changed, 23 insertions, 7 deletions
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<employee> 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<employer> 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 ();