diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-03-25 13:47:43 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-03-25 13:47:43 +0200 |
commit | 01f77f6d38283b4efbe2b55fc9c7c837fd6498dc (patch) | |
tree | 12059fa0c514a3f2b9da2a9419593e3596cc6f5d /odb/semantics/class-template.hxx | |
parent | ad637abaa62a26461b276769c35dd1b67036b54b (diff) |
Add support for union, enum, class/union template
Diffstat (limited to 'odb/semantics/class-template.hxx')
-rw-r--r-- | odb/semantics/class-template.hxx | 76 |
1 files changed, 76 insertions, 0 deletions
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 <boris@codesynthesis.com> +// 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 <semantics/elements.hxx> +#include <semantics/class.hxx> +#include <semantics/template.hxx> + +namespace semantics +{ + class class_template: public type_template, public scope + { + private: + typedef std::vector<inherits*> 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 |