summaryrefslogtreecommitdiff
path: root/odb/semantics/relational/elements.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/semantics/relational/elements.cxx')
-rw-r--r--odb/semantics/relational/elements.cxx106
1 files changed, 32 insertions, 74 deletions
diff --git a/odb/semantics/relational/elements.cxx b/odb/semantics/relational/elements.cxx
index 6ab977a..42755c8 100644
--- a/odb/semantics/relational/elements.cxx
+++ b/odb/semantics/relational/elements.cxx
@@ -6,87 +6,27 @@
#include <cutl/compiler/type-info.hxx>
#include <odb/semantics/relational/elements.hxx>
-#include <odb/semantics/relational/column.hxx>
-#include <odb/semantics/relational/primary-key.hxx>
namespace semantics
{
namespace relational
{
- // scope
+ // duplicate_name
//
-
- scope::names_iterator scope::
- find (string const& name)
- {
- names_map::iterator i (names_map_.find (name));
-
- if (i == names_map_.end ())
- return names_.end ();
- else
- return i->second;
- }
-
- scope::names_const_iterator scope::
- find (string const& name) const
+ template <>
+ duplicate_name::
+ duplicate_name (uscope& s, unameable& o, unameable& d)
+ : scope (s), orig (o), dup (d),
+ orig_name (o.name ()), dup_name (d.name ())
{
- names_map::const_iterator i (names_map_.find (name));
-
- if (i == names_map_.end ())
- return names_.end ();
- else
- return names_const_iterator (i->second);
}
- scope::names_iterator scope::
- find (names const& e)
+ template <>
+ duplicate_name::
+ duplicate_name (qscope& s, qnameable& o, qnameable& d)
+ : scope (s), orig (o), dup (d),
+ orig_name (o.name ().string ()), dup_name (d.name ().string ())
{
- names_iterator_map::iterator i (iterator_map_.find (&e));
- return i != iterator_map_.end () ? i->second : names_.end ();
- }
-
- scope::names_const_iterator scope::
- find (names const& e) const
- {
- names_iterator_map::const_iterator i (iterator_map_.find (&e));
- return i != iterator_map_.end () ? i->second : names_.end ();
- }
-
- void scope::
- add_edge_left (names& e)
- {
- nameable& n (e.nameable ());
- string const& name (e.name ());
-
- names_map::iterator i (names_map_.find (name));
-
- if (i == names_map_.end ())
- {
- names_list::iterator i;
-
- // We want the order to be columns first, then the primary key,
- // and then the foreign keys.
- //
- if (n.is_a<column> ())
- i = names_.insert (first_key_, &e);
- else
- {
- if (n.is_a<primary_key> ())
- first_key_ = i = names_.insert (first_key_, &e);
- else
- {
- i = names_.insert (names_.end (), &e);
-
- if (first_key_ == names_.end ())
- first_key_ = i;
- }
- }
-
- names_map_[name] = i;
- iterator_map_[&e] = i;
- }
- else
- throw duplicate_name (*this, (*i->second)->nameable (), n);
}
// type info
@@ -110,7 +50,13 @@ namespace semantics
// names
//
{
- type_info ti (typeid (names));
+ type_info ti (typeid (unames));
+ ti.add_base (typeid (edge));
+ insert (ti);
+ }
+
+ {
+ type_info ti (typeid (qnames));
ti.add_base (typeid (edge));
insert (ti);
}
@@ -118,7 +64,13 @@ namespace semantics
// nameable
//
{
- type_info ti (typeid (nameable));
+ type_info ti (typeid (unameable));
+ ti.add_base (typeid (node));
+ insert (ti);
+ }
+
+ {
+ type_info ti (typeid (qnameable));
ti.add_base (typeid (node));
insert (ti);
}
@@ -126,7 +78,13 @@ namespace semantics
// scope
//
{
- type_info ti (typeid (scope));
+ type_info ti (typeid (uscope));
+ ti.add_base (typeid (node));
+ insert (ti);
+ }
+
+ {
+ type_info ti (typeid (qscope));
ti.add_base (typeid (node));
insert (ti);
}