summaryrefslogtreecommitdiff
path: root/odb/semantics
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-03 18:23:51 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-03 18:23:51 +0200
commit80b868be1e7c249daa714b0c7a5f87694edb8664 (patch)
treed8e0dd6eca09d33d70224f7289ae096a0976cd6b /odb/semantics
parent89ba09f073b103953c53e63bd78f644973d9154e (diff)
Implement nested id support
Now the 'id' specifier can optionally include the data member path to the id inside the composite value. For example: #pragma db id(first) std::pair<int, int> p; Note that one somewhat counter-intuitive aspect of this new feature is that the whole member marked with id ('p' in the above example) and not just the actual id member ('p.first' in the above example) is treated as readonly. Such nested id also cannot be automatically assigned (auto specifier).
Diffstat (limited to 'odb/semantics')
-rw-r--r--odb/semantics/elements.hxx22
1 files changed, 12 insertions, 10 deletions
diff --git a/odb/semantics/elements.hxx b/odb/semantics/elements.hxx
index b52acc3..d0156dd 100644
--- a/odb/semantics/elements.hxx
+++ b/odb/semantics/elements.hxx
@@ -114,11 +114,12 @@ namespace semantics
public:
template <typename X>
- bool
- is_a () const
- {
- return dynamic_cast<X const*> (this) != 0;
- }
+ X*
+ is_a () {return dynamic_cast<X*> (this);}
+
+ template <typename X>
+ const X*
+ is_a () const {return dynamic_cast<const X*> (this);}
};
//
@@ -165,11 +166,12 @@ namespace semantics
public:
template <typename X>
- bool
- is_a () const
- {
- return dynamic_cast<X const*> (this) != 0;
- }
+ X*
+ is_a () {return dynamic_cast<X*> (this);}
+
+ template <typename X>
+ const X*
+ is_a () const {return dynamic_cast<const X*> (this);}
public:
node (path const& file, size_t line, size_t column, tree);