diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-08-19 17:05:24 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-08-19 17:05:24 +0200 |
commit | 2b02d443ab344bc02dfc2891fb1a57c6520c393f (patch) | |
tree | 3bff59757b0ef986d70c67def93d689fb18a5b66 /odb/semantics/elements.cxx | |
parent | 33cd64535d2307a2e7884ee0796e1aae42937aaf (diff) |
Use type names as specified in the header that we compile
Diffstat (limited to 'odb/semantics/elements.cxx')
-rw-r--r-- | odb/semantics/elements.cxx | 64 |
1 files changed, 62 insertions, 2 deletions
diff --git a/odb/semantics/elements.cxx b/odb/semantics/elements.cxx index 29b1f8e..a25df86 100644 --- a/odb/semantics/elements.cxx +++ b/odb/semantics/elements.cxx @@ -21,13 +21,73 @@ namespace semantics // nameable // + bool nameable:: + fq_anonymous () const + { + // Nameable is fq-anonymous if all the paths to the global scope + // have at least one anonymous link. + // + if (anonymous ()) + return true; + + if (named ().global_scope ()) + return false; + + if (defined_ != 0 && !defined_->scope ().fq_anonymous ()) + return false; + + for (names_list::const_iterator i (named_.begin ()), e (named_.end ()); + i != e; ++i) + { + if (!(*i)->scope ().fq_anonymous ()) + return false; + } + + return true; + } + + bool nameable:: + fq_anonymous (names* hint) const + { + if (hint == 0 && defined_ == 0) + return true; + + names& n (hint ? *hint : *defined_); + + if (n.global_scope ()) + return false; + + return n.scope ().fq_anonymous (); + } + string nameable:: fq_name () const { if (named ().global_scope ()) return ""; - else - return scope ().fq_name () + "::" + name (); + + if (defined_ != 0 && !defined_->scope ().fq_anonymous ()) + return defined_->scope ().fq_name () + "::" + name (); + + for (names_list::const_iterator i (named_.begin ()), e (named_.end ()); + i != e; ++i) + { + if (!(*i)->scope ().fq_anonymous ()) + return (*i)->scope ().fq_name () + "::" + name (); + } + + return "<anonymous>"; + } + + string nameable:: + fq_name (names* hint) const + { + names& n (hint ? *hint : *defined_); + + if (n.global_scope ()) + return ""; + + return n.scope ().fq_name () + "::" + n.name (); } // scope |