aboutsummaryrefslogtreecommitdiff
path: root/odb/common.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-06-04 16:29:02 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-06-04 16:29:02 +0200
commitbb76e9388009ed0bb2512034f8cd48a7d19aabb3 (patch)
tree0b43ebff1c36a35bf7cf66c670f04707d4334e38 /odb/common.hxx
parent633f9c5ac574750799efdfe5d1eb31db40a267da (diff)
Next chunk of functionality
Diffstat (limited to 'odb/common.hxx')
-rw-r--r--odb/common.hxx43
1 files changed, 43 insertions, 0 deletions
diff --git a/odb/common.hxx b/odb/common.hxx
new file mode 100644
index 0000000..5588f00
--- /dev/null
+++ b/odb/common.hxx
@@ -0,0 +1,43 @@
+// file : odb/common.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_COMMON_HXX
+#define ODB_COMMON_HXX
+
+#include <odb/context.hxx>
+
+// Find id member.
+//
+struct id_member: traversal::class_,
+ traversal::data_member,
+ context
+{
+ id_member (context& c)
+ : context (c), m_ (0)
+ {
+ *this >> names_ >> *this;
+ }
+
+ semantics::data_member*
+ member () const
+ {
+ return m_;
+ }
+
+ virtual void
+ traverse (semantics::data_member& m)
+ {
+ if (m.count ("id"))
+ m_ = &m;
+ }
+
+ using class_::traverse;
+
+private:
+ traversal::names names_;
+ semantics::data_member* m_;
+};
+
+#endif // ODB_COMMON_HXX