diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-03-21 08:36:21 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-04-23 16:50:56 +0200 |
commit | 8d89bf37dd4ef3cb7373e1841ff57a53916fff0d (patch) | |
tree | 704b7de0338eba0e008a96a09b6d57e86846d1b1 /odb/semantics/elements.hxx | |
parent | 68ff21c56fb287790440208907ad2a851a108f89 (diff) |
Polymorphic inheritance support
Diffstat (limited to 'odb/semantics/elements.hxx')
-rw-r--r-- | odb/semantics/elements.hxx | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/odb/semantics/elements.hxx b/odb/semantics/elements.hxx index ef28d23..59e058d 100644 --- a/odb/semantics/elements.hxx +++ b/odb/semantics/elements.hxx @@ -67,6 +67,40 @@ namespace semantics class edge; class unit; + // Support for inserting edges at specified positions. + // + template <typename N, typename I> + struct node_position + { + node_position (N& node, I pos) + : node_ (node), pos_ (pos) + { + } + + operator N& () const + { + return node_; + } + + template <typename E> + void + add_edge_left (E& e) + { + node_.add_edge_left (e, pos_); + } + + template <typename E> + void + add_edge_right (E& e) + { + node_.add_edge_right (e, pos_); + } + + private: + N& node_; + I pos_; + }; + // // class edge: public context @@ -529,6 +563,9 @@ namespace semantics void add_edge_left (names&); + void + add_edge_left (names&, names_iterator after); + using nameable::add_edge_right; protected: @@ -544,6 +581,8 @@ namespace semantics // // + class points; + class belongs; class qualifies; @@ -567,6 +606,15 @@ namespace semantics } public: + bool + pointed_p () const {return pointed_ != 0;} + + points& + pointed () const {return *pointed_;} + + public: + type (): pointed_ (0) {} + void add_edge_right (belongs&) { @@ -578,10 +626,17 @@ namespace semantics qualified_.push_back (&e); } + void + add_edge_right (points& e) + { + pointed_ = &e; + } + using nameable::add_edge_right; private: qualified qualified_; + points* pointed_; }; // @@ -688,6 +743,22 @@ namespace semantics : node (file, line, column, tn) { } + + protected: + data_member () + { + } + }; + + // Virtual data member (extension to the standard C++ model). + // + class virtual_data_member: public data_member + { + public: + virtual_data_member (path const& file, size_t line, size_t column) + : node (file, line, column, 0) + { + } }; // Unsupported type. |