aboutsummaryrefslogtreecommitdiff
path: root/odb/query.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-09-20 11:53:03 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-09-20 11:53:03 +0200
commit8c257b1754ed55280c39e69a9b83065f4ca7fc80 (patch)
tree9224f9a00b065ed19cf73ace6bc31f7a6e58e9a9 /odb/query.hxx
parent3b728e0a21245871db9f70ba15a00e45f9741698 (diff)
Change query syntax to use . for composite and -> for object pointer access
Also make non-inverse query columns act as both an object pointer and a normal column. The latter allows us to use natural expressions such as query<employee>::employer.is_null ().
Diffstat (limited to 'odb/query.hxx')
-rw-r--r--odb/query.hxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/odb/query.hxx b/odb/query.hxx
index 82fb411..d89a4e6 100644
--- a/odb/query.hxx
+++ b/odb/query.hxx
@@ -23,6 +23,24 @@ namespace odb
template <typename T, const char* table>
struct pointer_query_columns;
+ // Object pointer syntax wrapper.
+ //
+ template <typename T>
+ struct query_pointer
+ {
+ query_pointer ()
+ {
+ // For some reason GCC needs this dummy c-tor if we make a static
+ // data member of this type const.
+ }
+
+ T*
+ operator-> () const
+ {
+ return 0; // All members in T are static.
+ }
+ };
+
//
//
template <typename T, class_kind kind = class_traits<T>::kind>