From 08a112cdeba34186033a8ade37c0e5545012fc45 Mon Sep 17 00:00:00 2001
From: Stefan Roiser <Stefan.Roiser@cern.ch>
Date: Thu, 8 Jun 2006 16:05:14 +0000
Subject: [PATCH] - Introducing NameLookup   API member functions in Scope:    
      Member LookupMember( const std::string & nam ) const;          Type
 LookupType( const std::string & nam ) const;

- Using directives
  adding the possibility to add/remove/use using directives
  API member functions in Scope:
         Scope UsingDirectiveAt( size_t nth ) const;
         size_t UsingDirectiveSize() const;
         Scope_Iterator UsingDirective_Begin() const;
         Scope_Iterator UsingDirective_End() const;
         Reverse_Scope_Iterator UsingDirective_RBegin() const;
         Reverse_Scope_Iterator UsingDirective_REnd() const;
         void AddUsingDirective( const Scope & ud ) const;
         void RemoveUsingDirective( const Scope & ud ) const;


git-svn-id: http://root.cern.ch/svn/root/trunk@15376 27541ba8-7e3a-0410-8455-c3a389f83636
---
 reflex/inc/Reflex/Builder/CollectionProxy.h |   4 +-
 reflex/inc/Reflex/Scope.h                   | 114 +++++++++++++++-
 reflex/inc/Reflex/ScopeBase.h               | 121 +++++++++++++++--
 reflex/inc/Reflex/TypeBase.h                |   7 +-
 reflex/src/NameLookup.cxx                   | 137 ++++++++++++++++++++
 reflex/src/NameLookup.h                     |  90 +++++++++++++
 reflex/src/Scope.cxx                        |  20 ++-
 reflex/src/ScopeBase.cxx                    |  40 +++++-
 8 files changed, 515 insertions(+), 18 deletions(-)
 create mode 100644 reflex/src/NameLookup.cxx
 create mode 100644 reflex/src/NameLookup.h

diff --git a/reflex/inc/Reflex/Builder/CollectionProxy.h b/reflex/inc/Reflex/Builder/CollectionProxy.h
index b4cebc17075..c7523fc94ba 100644
--- a/reflex/inc/Reflex/Builder/CollectionProxy.h
+++ b/reflex/inc/Reflex/Builder/CollectionProxy.h
@@ -1,4 +1,4 @@
-// @(#)root/reflex:$Name:  $:$Id: CollectionProxy.h,v 1.13 2006/06/06 16:07:15 roiser Exp $
+// @(#)root/reflex:$Name:  $:$Id: CollectionProxy.h,v 1.14 2006/06/07 08:45:01 roiser Exp $
 // Author: Markus Frank 2004
 
 // Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
@@ -100,7 +100,6 @@ namespace ROOT {
          }
          static void* first(void* env)  {
             PEnv_t  e = PEnv_t(env);
-            e->idx = 0;
             PCont_t c = PCont_t(e->object);
             // Assume iterators do not need destruction
             ::new(e->buff) Iter_t(c->begin()); 
@@ -115,7 +114,6 @@ namespace ROOT {
          }
          static void* next(void* env)  {
             PEnv_t  e = PEnv_t(env);
-            ++e->idx;
             PCont_t c = PCont_t(e->object);
             for (; e->idx > 0 && e->iter() != c->end(); ++(e->iter()), --e->idx );
             // TODO: Need to find something for going backwards....
diff --git a/reflex/inc/Reflex/Scope.h b/reflex/inc/Reflex/Scope.h
index 7aacaff16b0..66559362417 100644
--- a/reflex/inc/Reflex/Scope.h
+++ b/reflex/inc/Reflex/Scope.h
@@ -1,4 +1,4 @@
-// @(#)root/reflex:$Name:  $:$Id: Scope.h,v 1.5 2006/03/06 12:51:46 roiser Exp $
+// @(#)root/reflex:$Name:  $:$Id: Scope.h,v 1.6 2006/03/13 15:49:50 roiser Exp $
 // Author: Stefan Roiser 2004
 
 // Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
@@ -299,6 +299,22 @@ namespace ROOT {
          bool IsUnion() const;
 
 
+         /**
+          * LookupMember will lookup a member in the current scope
+          * @param nam the string representation of the member to lookup
+          * @return if a matching member is found return it, otherwise return empty member
+          */
+         Member LookupMember( const std::string & nam ) const;
+
+
+         /**
+          * LookupType will lookup a type in the current scope
+          * @param nam the string representation of the type to lookup
+          * @return if a matching type is found return it, otherwise return empty type
+          */
+         Type LookupType( const std::string & nam ) const;
+
+
          /**
           * MemberAt will return the nth member of the type
           * @param  nth member
@@ -665,6 +681,27 @@ namespace ROOT {
           */
          TypeTemplate TemplateFamily() const;
 
+         
+         /**
+          * UsingDirectiveAt will return the nth using directive
+          * @param  nth using directive
+          * @return nth using directive
+          */
+         Scope UsingDirectiveAt( size_t nth ) const;
+         
+         
+         /**
+          * UsingDirectiveSize will return the number of using directives of this scope
+          * @return number of using directives declared in this scope
+          */
+         size_t UsingDirectiveSize() const;
+         
+         
+         Scope_Iterator UsingDirective_Begin() const;
+         Scope_Iterator UsingDirective_End() const;
+         Reverse_Scope_Iterator UsingDirective_RBegin() const;
+         Reverse_Scope_Iterator UsingDirective_REnd() const;
+         
       public:
 
          /**
@@ -761,6 +798,13 @@ namespace ROOT {
           * @param tt type template to add
           */
          void AddSubTypeTemplate( const TypeTemplate & mt ) const ;
+         
+         
+         /**
+          * AddUsingDirective will add a using namespace directive to this scope
+          * @param ud using directive to add
+          */
+         void AddUsingDirective( const Scope & ud ) const;
 
 
          /**
@@ -804,6 +848,13 @@ namespace ROOT {
           */
          void RemoveSubTypeTemplate( const TypeTemplate & tt ) const;
 
+         
+         /** 
+          * RemoveUsingDirective will remove a using namespace directive from this scope
+          * @param ud using namespace directive to remove
+          */
+         void RemoveUsingDirective( const Scope & ud ) const;
+         
 
          /** */
          const ScopeBase * ToScopeBase() const;
@@ -1343,6 +1394,54 @@ inline ROOT::Reflex::Reverse_TypeTemplate_Iterator ROOT::Reflex::Scope::SubTypeT
 }
 
 
+//-------------------------------------------------------------------------------
+inline ROOT::Reflex::Scope ROOT::Reflex::Scope::UsingDirectiveAt( size_t nth ) const {
+//-------------------------------------------------------------------------------
+   if ( * this ) return fScopeName->fScopeBase->UsingDirectiveAt( nth );
+   return Scope();
+}
+
+
+//-------------------------------------------------------------------------------
+inline size_t ROOT::Reflex::Scope::UsingDirectiveSize() const {
+//-------------------------------------------------------------------------------
+   if ( * this ) return fScopeName->fScopeBase->UsingDirectiveSize();
+   return 0;
+}
+
+
+//-------------------------------------------------------------------------------
+inline ROOT::Reflex::Scope_Iterator ROOT::Reflex::Scope::UsingDirective_Begin() const {
+//-------------------------------------------------------------------------------
+   if ( * this ) return fScopeName->fScopeBase->UsingDirective_Begin();
+   return Scope_Iterator();
+}
+
+
+//-------------------------------------------------------------------------------
+inline ROOT::Reflex::Scope_Iterator ROOT::Reflex::Scope::UsingDirective_End() const {
+//-------------------------------------------------------------------------------
+   if ( * this ) return fScopeName->fScopeBase->UsingDirective_End();
+   return Scope_Iterator();
+}
+
+
+//-------------------------------------------------------------------------------
+inline ROOT::Reflex::Reverse_Scope_Iterator ROOT::Reflex::Scope::UsingDirective_RBegin() const {
+//-------------------------------------------------------------------------------
+   if ( * this ) return fScopeName->fScopeBase->UsingDirective_RBegin();
+   return Reverse_Scope_Iterator();
+}
+
+
+//-------------------------------------------------------------------------------
+inline ROOT::Reflex::Reverse_Scope_Iterator ROOT::Reflex::Scope::UsingDirective_REnd() const {
+//-------------------------------------------------------------------------------
+   if ( * this ) return fScopeName->fScopeBase->UsingDirective_REnd();
+   return Reverse_Scope_Iterator();
+}
+
+
 //-------------------------------------------------------------------------------
 inline void ROOT::Reflex::Scope::AddSubScope( const Scope & sc ) const {
 //-------------------------------------------------------------------------------
@@ -1365,5 +1464,18 @@ inline void ROOT::Reflex::Scope::RemoveSubScope( const Scope & sc ) const {
 }
 
 
+//-------------------------------------------------------------------------------
+inline void ROOT::Reflex::Scope::AddUsingDirective( const Scope & ud ) const {
+//-------------------------------------------------------------------------------
+   if ( * this ) fScopeName->fScopeBase->AddUsingDirective( ud );
+}
+
+
+//-------------------------------------------------------------------------------
+inline void ROOT::Reflex::Scope::RemoveUsingDirective( const Scope & ud ) const {
+//-------------------------------------------------------------------------------
+   if ( * this ) fScopeName->fScopeBase->RemoveUsingDirective( ud );
+}
+
 
 #endif // ROOT_Reflex_Scope
diff --git a/reflex/inc/Reflex/ScopeBase.h b/reflex/inc/Reflex/ScopeBase.h
index 7daa9bf3658..c5c2b1333e2 100644
--- a/reflex/inc/Reflex/ScopeBase.h
+++ b/reflex/inc/Reflex/ScopeBase.h
@@ -1,4 +1,4 @@
-// @(#)root/reflex:$Name:  $:$Id: ScopeBase.h,v 1.5 2006/03/06 12:51:46 roiser Exp $
+// @(#)root/reflex:$Name:  $:$Id: ScopeBase.h,v 1.6 2006/03/13 15:49:50 roiser Exp $
 // Author: Stefan Roiser 2004
 
 // Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
@@ -199,6 +199,26 @@ namespace ROOT {
          bool IsUnion() const;
 
 
+         /**
+          * LookupMember will lookup a member in the current scope
+          * @param nam the string representation of the member to lookup
+          * @param current the current scope
+          * @return if a matching member is found return it, otherwise return empty member
+          */
+         Member LookupMember( const std::string & nam,
+                              const Scope & current ) const;
+
+
+         /**
+          * LookupType will lookup a type in the current scope
+          * @param nam the string representation of the type to lookup
+          * @param current the current scope
+          * @return if a matching type is found return it, otherwise return empty type
+          */
+         Type LookupType( const std::string & nam,
+                          const Scope & current ) const;
+
+
          /**
           * MemberByName will return the first MemberAt with a given Name
           * @param Name  MemberAt Name
@@ -359,15 +379,15 @@ namespace ROOT {
 
          /** 
           * SubTypeTemplateAt will return the nth At template of this At
-          * @param nth At template
-          * @return nth At template
+          * @param  nth sub type template
+          * @return nth sub type template
           */
          TypeTemplate SubTypeTemplateAt( size_t nth ) const;
 
 
          /** 
           * SubTypeTemplateSize will return the number of At templates in this socpe
-          * @return number of defined At templates
+          * @return number of defined sub type templates
           */
          size_t SubTypeTemplateSize() const;
 
@@ -377,6 +397,28 @@ namespace ROOT {
          Reverse_TypeTemplate_Iterator SubTypeTemplate_RBegin() const;
          Reverse_TypeTemplate_Iterator SubTypeTemplate_REnd() const;
 
+
+         /**
+          * UsingDirectiveAt will return the nth using directive
+          * @param  nth using directive
+          * @return nth using directive
+          */
+         Scope UsingDirectiveAt( size_t nth ) const;
+
+
+         /**
+          * UsingDirectiveSize will return the number of using directives of this scope
+          * @return number of using directives declared in this scope
+          */
+         size_t UsingDirectiveSize() const;
+
+
+         Scope_Iterator UsingDirective_Begin() const;
+         Scope_Iterator UsingDirective_End() const;
+         Reverse_Scope_Iterator UsingDirective_RBegin() const;
+         Reverse_Scope_Iterator UsingDirective_REnd() const;
+         
+
       protected:
 
          /** protected constructor for initialisation of the global namespace */
@@ -433,6 +475,9 @@ namespace ROOT {
 
 
          void AddSubTypeTemplate( const TypeTemplate & tt ) const;
+         
+         
+         void AddUsingDirective( const Scope & ud ) const;
 
 
          /**
@@ -467,6 +512,9 @@ namespace ROOT {
 
 
          virtual void RemoveSubTypeTemplate( const TypeTemplate & tt ) const;
+         
+         
+         void RemoveUsingDirective( const Scope & ud ) const;
 
       protected:
       
@@ -548,7 +596,7 @@ namespace ROOT {
 
          /**
           * pointer to types
-          * @label At types
+          * @label sub types
           * @link aggregationByValue
           * @supplierCardinality 0..*
           * @clientCardinality 1
@@ -558,8 +606,8 @@ namespace ROOT {
 
 
          /**
-          * container for At templates defined in this At
-          * @label At templates
+          * container for type templates defined in this scope
+          * @label type templates
           * @link aggregationByValue
           * @supplierCardinality 0..*
           * @clientCardinality 1
@@ -569,8 +617,8 @@ namespace ROOT {
  
  
          /**
-          * container for At templates defined in this At
-          * @label At templates
+          * container for member templates defined in this scope
+          * @label member templates
           * @link aggregationByValue
           * @supplierCardinality 0..*
           * @clientCardinality 1
@@ -579,6 +627,17 @@ namespace ROOT {
             std::vector < MemberTemplate > fMemberTemplates;
 
 
+         /** 
+          * container for using directives of this scope
+          * @label using directives
+          * @link aggregationByValue
+          * @supplierCardinality 0..*
+          * @clientCardinality 1
+          */
+         mutable
+            std::vector < Scope > fUsingDirectives;
+
+
          /**
           * pointer to the PropertyNth list
           * @label propertylist
@@ -928,4 +987,48 @@ inline size_t ROOT::Reflex::ScopeBase::TemplateArgumentSize() const {
    return 0;
 }
 
+
+//-------------------------------------------------------------------------------
+inline ROOT::Reflex::Scope ROOT::Reflex::ScopeBase::UsingDirectiveAt( size_t nth ) const {
+//-------------------------------------------------------------------------------
+   if ( nth < fUsingDirectives.size() ) { return fUsingDirectives[ nth ]; }
+   return Scope( 0 );
+}
+
+
+//-------------------------------------------------------------------------------
+inline size_t ROOT::Reflex::ScopeBase::UsingDirectiveSize() const {
+//-------------------------------------------------------------------------------
+   return fUsingDirectives.size();
+}
+
+
+//-------------------------------------------------------------------------------
+inline ROOT::Reflex::Scope_Iterator ROOT::Reflex::ScopeBase::UsingDirective_Begin() const {
+//-------------------------------------------------------------------------------
+   return fUsingDirectives.begin();
+}
+
+
+//-------------------------------------------------------------------------------
+inline ROOT::Reflex::Scope_Iterator ROOT::Reflex::ScopeBase::UsingDirective_End() const {
+//-------------------------------------------------------------------------------
+   return fUsingDirectives.end();
+}
+
+
+//-------------------------------------------------------------------------------
+inline ROOT::Reflex::Reverse_Scope_Iterator ROOT::Reflex::ScopeBase::UsingDirective_RBegin() const {
+//-------------------------------------------------------------------------------
+   return fUsingDirectives.rbegin();
+}
+
+
+//-------------------------------------------------------------------------------
+inline ROOT::Reflex::Reverse_Scope_Iterator ROOT::Reflex::ScopeBase::UsingDirective_REnd() const {
+//-------------------------------------------------------------------------------
+   return fUsingDirectives.rend();
+}
+
+
 #endif // ROOT_Reflex_ScopeBase
diff --git a/reflex/inc/Reflex/TypeBase.h b/reflex/inc/Reflex/TypeBase.h
index f60000c3251..01913ce9cd2 100644
--- a/reflex/inc/Reflex/TypeBase.h
+++ b/reflex/inc/Reflex/TypeBase.h
@@ -1,4 +1,4 @@
-// @(#)root/reflex:$Name:  $:$Id: TypeBase.h,v 1.8 2006/04/12 10:21:11 roiser Exp $
+// @(#)root/reflex:$Name:  $:$Id: TypeBase.h,v 1.9 2006/05/31 22:23:12 roiser Exp $
 // Author: Stefan Roiser 2004
 
 // Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
@@ -122,12 +122,13 @@ namespace ROOT {
           */
          /*
            virtual Object Construct( const Type & signature,
-           std::vector < Object > values,
-           void * mem) const;*/
+                                     const std::vector < Object > & values,
+                                     void * mem ) const;*/
          virtual Object Construct( const Type & signature,
                                    const std::vector < void * > & values,
                                    void * mem) const;
       
+
          /**
           * DataMemberAt will return the nth data MemberAt of the At
           * @param  nth data MemberAt
diff --git a/reflex/src/NameLookup.cxx b/reflex/src/NameLookup.cxx
new file mode 100644
index 00000000000..08fbfdce658
--- /dev/null
+++ b/reflex/src/NameLookup.cxx
@@ -0,0 +1,137 @@
+// @(#)root/reflex:$Name:  $:$Id: $
+// Author: Stefan Roiser 2006
+
+// Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
+//
+// Permission to use, copy, modify, and distribute this software for any
+// purpose is hereby granted without fee, provided that this copyright and
+// permissions notice appear in all copies and derivatives.
+//
+// This software is provided "as is" without express or implied warranty.
+
+#ifndef REFLEX_BUILD
+#define REFLEX_BUILD
+#endif
+
+#include "NameLookup.h"
+#include "Reflex/Scope.h"
+#include "Reflex/Type.h"
+#include "Reflex/Member.h"
+
+//-------------------------------------------------------------------------------
+ROOT::Reflex::Type
+ROOT::Reflex::NameLookup::LookupType( const std::string & nam, 
+                                      const Scope & current ) {
+//-------------------------------------------------------------------------------
+   Type t = Type();
+
+   if ( Tools::GetBasePosition(nam)) t = LookupTypeQualified( nam );
+   else                              t = LookupTypeUnqualified( nam, current );
+
+   return t;
+}
+
+
+//-------------------------------------------------------------------------------
+ROOT::Reflex::Type
+ROOT::Reflex::NameLookup::LookupTypeQualified( const std::string & nam ) {
+//-------------------------------------------------------------------------------
+
+   Scope bscope = Scope::ByName(Tools::GetScopeName(nam));
+   if ( bscope ) {
+      return LookupType( Tools::GetBaseName(nam), bscope);
+   }
+   else { 
+      return Type(); 
+   }
+
+}
+
+
+//-------------------------------------------------------------------------------
+ROOT::Reflex::Type
+ROOT::Reflex::NameLookup::LookupTypeUnqualified( const std::string & nam,
+                                                 const Scope & current ) {
+//-------------------------------------------------------------------------------
+
+   Type t = Type();
+
+   for ( Type_Iterator it = current.SubType_Begin(); it != current.SubType_End(); ++it ) {
+      if ( (*it).Name() == nam ) return *it;
+   }
+
+   for ( Scope_Iterator si = current.UsingDirective_Begin(); si != current.UsingDirective_End(); ++si ) {
+      t = LookupType( nam, *si );
+      if ( t ) return t;
+   }
+
+   for ( Base_Iterator bi = current.Base_Begin(); bi != current.Base_End(); ++bi ) {
+      t = LookupType( nam, bi->ToScope() );
+      if ( t ) return t;
+   }
+
+   if ( ! current.IsTopScope() ) t = LookupType( nam, current.DeclaringScope() );
+
+   return t;
+
+}
+
+
+//-------------------------------------------------------------------------------
+ROOT::Reflex::Member
+ROOT::Reflex::NameLookup::LookupMember( const std::string & nam, 
+                                        const Scope & current ) {
+//-------------------------------------------------------------------------------
+
+   Member m = Member();
+
+   if ( Tools::GetBasePosition(nam)) m = LookupMemberQualified( nam );
+   else                              m = LookupMemberUnqualified( nam, current );
+
+   return m;
+}
+
+
+//-------------------------------------------------------------------------------
+ROOT::Reflex::Member
+ROOT::Reflex::NameLookup::LookupMemberQualified( const std::string & nam ) {
+//-------------------------------------------------------------------------------
+
+   Scope bscope = Scope::ByName(Tools::GetScopeName(nam));
+   if ( bscope ) {
+      return LookupMemberUnqualified( Tools::GetBaseName(nam), bscope);
+   }
+   else {
+      return Member();
+   }
+
+}
+
+
+
+//-------------------------------------------------------------------------------
+ROOT::Reflex::Member
+ROOT::Reflex::NameLookup::LookupMemberUnqualified( const std::string & nam,
+                                                   const Scope & current ) {
+//-------------------------------------------------------------------------------
+
+   Member m = Member();
+
+   m = current.MemberByName(nam);
+   if ( m ) return m;
+      
+   for ( Scope_Iterator si = current.UsingDirective_Begin(); si != current.UsingDirective_End(); ++si ) {
+      m = LookupMember( nam, *si );
+      if ( m ) return m;
+   }
+
+   for ( Base_Iterator bi = current.Base_Begin(); bi != current.Base_End(); ++ bi ) {
+      m = LookupMember( nam, bi->ToScope() );
+      if ( m ) return m;
+   }
+         
+   if ( ! current.IsTopScope() ) m = LookupMember( nam, current.DeclaringScope() );
+
+   return m;
+
+}
diff --git a/reflex/src/NameLookup.h b/reflex/src/NameLookup.h
new file mode 100644
index 00000000000..42030444e72
--- /dev/null
+++ b/reflex/src/NameLookup.h
@@ -0,0 +1,90 @@
+// @(#)root/reflex:$Name:  $:$Id: $
+// Author: Stefan Roiser 2006
+
+// Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
+//
+// Permission to use, copy, modify, and distribute this software for any
+// purpose is hereby granted without fee, provided that this copyright and
+// permissions notice appear in all copies and derivatives.
+//
+// This software is provided "as is" without express or implied warranty.
+
+#ifndef ROOT_Reflex_NameLookup
+#define ROOT_Reflex_NameLookup
+
+// Include files
+#include <string>
+
+namespace ROOT {
+   namespace Reflex {
+    
+      // forward declarations
+      class Type;
+      class Scope;
+      class Member;
+      
+      /*
+       * point of declaration (3.3.1 [basic.scope.pdecl]) is not taken into account 
+       */
+
+      namespace NameLookup {
+
+         // 1. Lookup
+         Type LookupType( const std::string & nam,
+                          const Scope & current );
+
+         
+         Type LookupTypeQualified( const std::string & nam );
+
+         
+         Type LookupTypeUnqualified( const std::string & nam,
+                                     const Scope & current );
+
+
+         Scope LookupScope( const std::string & nam,
+                            const Scope & current );
+
+
+         Scope LookupScopeQualified( const std::string & nam );
+
+
+         Scope LookupScopeUnqualified( const std::string & nam,
+                                       const Scope & current );
+
+
+         Member LookupMember( const std::string & nam,
+                              const Scope & current );
+
+
+         Member LookupMemberQualified( const std::string & nam );
+
+         
+         Member LookupMemberUnqualified( const std::string & nam,
+                                         const Scope & current );
+
+         
+
+
+         // 2. OverloadResolution
+         Member OverloadResultion( const std::string & nam,
+                                   const std::vector< Member > & funcs );
+                                   
+
+         // 3. AccessControl
+         bool AccessControl( const Type & typ,
+                             const Scope & current );
+
+
+         bool AccessControl( const Scope & scop,
+                             const Scope & current );
+         
+         
+         bool AccessControl( const Member & mem,
+                             const Scope & current );
+
+      } // namespace NameLookup
+   } //namespace Reflex
+} //namespace ROOT
+
+
+#endif // ROOT_Reflex_NameLookup
diff --git a/reflex/src/Scope.cxx b/reflex/src/Scope.cxx
index 9ccc89b9340..0adef6b8d01 100644
--- a/reflex/src/Scope.cxx
+++ b/reflex/src/Scope.cxx
@@ -1,4 +1,4 @@
-// @(#)root/reflex:$Name:  $:$Id: Scope.cxx,v 1.6 2006/03/13 15:49:51 roiser Exp $
+// @(#)root/reflex:$Name:  $:$Id: Scope.cxx,v 1.7 2006/03/20 09:46:18 roiser Exp $
 // Author: Stefan Roiser 2004
 
 // Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
@@ -115,6 +115,24 @@ size_t ROOT::Reflex::Scope::FunctionMemberSize() const {
 }
 
 
+//-------------------------------------------------------------------------------
+ROOT::Reflex::Member 
+ROOT::Reflex::Scope::LookupMember( const std::string & nam ) const {
+//-------------------------------------------------------------------------------
+   if ( * this ) return fScopeName->fScopeBase->LookupMember( nam, *this );
+   return Member();
+}
+
+
+//-------------------------------------------------------------------------------
+ROOT::Reflex::Type
+ROOT::Reflex::Scope::LookupType( const std::string & nam ) const {
+//-------------------------------------------------------------------------------
+   if ( * this ) return fScopeName->fScopeBase->LookupType( nam, *this );
+   return Type();
+}
+
+
 //-------------------------------------------------------------------------------
 ROOT::Reflex::Member 
 ROOT::Reflex::Scope::MemberByName( const std::string & name ) const {
diff --git a/reflex/src/ScopeBase.cxx b/reflex/src/ScopeBase.cxx
index 76c504e76fc..5a2e63621bd 100644
--- a/reflex/src/ScopeBase.cxx
+++ b/reflex/src/ScopeBase.cxx
@@ -1,4 +1,4 @@
-// @(#)root/reflex:$Name:  $:$Id: ScopeBase.cxx,v 1.8 2006/03/20 09:46:18 roiser Exp $
+// @(#)root/reflex:$Name:  $:$Id: ScopeBase.cxx,v 1.9 2006/04/20 17:18:23 roiser Exp $
 // Author: Stefan Roiser 2004
 
 // Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
@@ -31,6 +31,7 @@
 #include "FunctionMember.h"
 #include "Union.h"
 #include "Enum.h"
+#include "NameLookup.h"
 
 //-------------------------------------------------------------------------------
 ROOT::Reflex::ScopeBase::ScopeBase( const char * scope, 
@@ -212,6 +213,25 @@ bool ROOT::Reflex::ScopeBase::IsTopScope() const {
    return false;
 }
 
+
+//-------------------------------------------------------------------------------
+ROOT::Reflex::Member 
+ROOT::Reflex::ScopeBase::LookupMember( const std::string & nam,
+                                       const Scope & current ) const {
+//------------------------------------------------------------------------------- 
+  return NameLookup::LookupMember( nam, current );
+}
+
+
+//-------------------------------------------------------------------------------
+ROOT::Reflex::Type
+ROOT::Reflex::ScopeBase::LookupType( const std::string & nam,
+                                     const Scope & current ) const {
+//-------------------------------------------------------------------------------
+   return NameLookup::LookupType( nam, current );
+}
+
+
 //-------------------------------------------------------------------------------
 ROOT::Reflex::Member ROOT::Reflex::ScopeBase::MemberAt( size_t nth ) const {
 //-------------------------------------------------------------------------------
@@ -541,3 +561,21 @@ void ROOT::Reflex::ScopeBase::RemoveSubTypeTemplate( const TypeTemplate & tt ) c
 }
 
 
+//-------------------------------------------------------------------------------
+void ROOT::Reflex::ScopeBase::AddUsingDirective( const Scope & ud ) const {
+//-------------------------------------------------------------------------------
+   fUsingDirectives.push_back( ud );
+}
+
+
+//-------------------------------------------------------------------------------
+void ROOT::Reflex::ScopeBase::RemoveUsingDirective( const Scope & ud ) const {
+//-------------------------------------------------------------------------------
+   for ( Scope_Iterator it = UsingDirective_Begin(); it != UsingDirective_End(); ++ it ) {
+      if ( *it == ud ) {
+         fUsingDirectives.erase( it ); 
+         break;
+      }
+   }
+}
+
-- 
GitLab