From 01f77f6d38283b4efbe2b55fc9c7c837fd6498dc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 25 Mar 2010 13:47:43 +0200 Subject: Add support for union, enum, class/union template --- odb/semantics/class-template.hxx | 76 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 odb/semantics/class-template.hxx (limited to 'odb/semantics/class-template.hxx') diff --git a/odb/semantics/class-template.hxx b/odb/semantics/class-template.hxx new file mode 100644 index 0000000..6443a19 --- /dev/null +++ b/odb/semantics/class-template.hxx @@ -0,0 +1,76 @@ +// file : odb/semantics/class-template.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_SEMANTICS_CLASS_TEMPLATE_HXX +#define ODB_SEMANTICS_CLASS_TEMPLATE_HXX + +#include +#include +#include + +namespace semantics +{ + class class_template: public type_template, public scope + { + private: + typedef std::vector inherits_list; + + public: + typedef inherits_list::const_iterator inherits_iterator; + + inherits_iterator + inherits_begin () const + { + return inherits_.begin (); + } + + inherits_iterator + inherits_end () const + { + return inherits_.end (); + } + + public: + class_template (path const& file, size_t line, size_t column) + : node (file, line, column) + { + } + + void + add_edge_left (inherits& e) + { + inherits_.push_back (&e); + } + + void + add_edge_right (inherits&) + { + } + + using scope::add_edge_left; + using scope::add_edge_right; + + // Resolve conflict between scope::scope and nameable::scope. + // + using nameable::scope; + + private: + inherits_list inherits_; + }; + + class class_instantiation: public class_, public type_instantiation + { + public: + class_instantiation (path const& file, size_t line, size_t column) + : node (file, line, column) + { + } + + using class_::add_edge_left; + using type_instantiation::add_edge_left; + }; +} + +#endif // ODB_SEMANTICS_CLASS_TEMPLATE_HXX -- cgit v1.1