aboutsummaryrefslogtreecommitdiff
path: root/common/enum/driver.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-10-15 07:01:17 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-10-15 07:01:17 +0200
commit4cb3716317207e3a6813b0d9ff779edc7fec91de (patch)
treef9f5ce8fc96df13a1b87be47124b25f0af7435f9 /common/enum/driver.cxx
parentccb45f5515e31f394f5164d8675b43f6b3f8b66c (diff)
Automatically map C++11 enum classes (strong enums)
Diffstat (limited to 'common/enum/driver.cxx')
-rw-r--r--common/enum/driver.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/common/enum/driver.cxx b/common/enum/driver.cxx
index 6cc41af..2e1e678 100644
--- a/common/enum/driver.cxx
+++ b/common/enum/driver.cxx
@@ -33,6 +33,13 @@ main (int argc, char* argv[])
object o;
o.color_ = green;
o.taste_ = object::sweet;
+ o.position_ = object::left;
+
+#ifdef HAVE_CXX11_ENUM
+ o.gender_ = object::gender::female;
+ o.scale_ = object::scale::ten;
+ o.yesno_ = object::yesno::yes;
+#endif
{
transaction t (db->begin ());
@@ -53,9 +60,21 @@ main (int argc, char* argv[])
result r1 (db->query<object> (query::color == blue));
result r2 (db->query<object> (query::taste == object::sweet));
+ result r3 (db->query<object> (query::position == object::left));
assert (r1.empty ());
assert (!r2.empty ());
+ assert (!r3.empty ());
+
+#ifdef HAVE_CXX11_ENUM
+ result r4 (db->query<object> (query::gender == object::gender::female));
+ result r5 (db->query<object> (query::scale == object::scale::ten));
+ result r6 (db->query<object> (query::yesno == object::yesno::yes));
+
+ assert (!r4.empty ());
+ assert (!r5.empty ());
+ assert (!r6.empty ());
+#endif
t.commit ();
}