示例#1
0
 public INameSpaceDeclaration AddNew(INameSpaceParent parentTarget)
 {
     if ((parentTarget is ISegmentableDeclarationTarget && this.RootDeclaration.ParentTarget is ISegmentableDeclarationTarget && ((ISegmentableDeclarationTarget)parentTarget).GetRootDeclaration().Equals(((ISegmentableDeclarationTarget)(this.RootDeclaration.ParentTarget)).GetRootDeclaration())) || parentTarget == this.RootDeclaration.ParentTarget)
     {
         INameSpaceDeclaration partial = new NameSpaceDeclaration(this.RootDeclaration, parentTarget);
         base.baseList.Add(partial);
         return(partial);
     }
     throw new InvalidOperationException("Type-hierarchy must be identical to the root declaration");
 }
示例#2
0
 public void Dispose()
 {
     this.targetDeclaration = null;
     foreach (INameSpaceDeclaration nsd in this.Values)
     {
         try
         {
             this.Remove(nsd.Name);
         }
         catch { }
     }
 }
示例#3
0
 public override void TranslateNameSpaces(INameSpaceParent parent, INameSpaceDeclarations nameSpaces)
 {
     foreach (INameSpaceDeclaration insd in nameSpaces.Values)
     {
         if (insd.ParentTarget == parent || ((!(options.AllowPartials)) && (insd.ParentTarget.GetRootDeclaration() == parent.GetRootDeclaration())))
         {
             TranslateNameSpace(insd);
         }
         if (options.AllowPartials)
         {
             foreach (INameSpaceDeclaration insdChild in insd.Partials)
             {
                 if (insdChild.ParentTarget == parent)
                 {
                     TranslateNameSpace(insdChild);
                 }
             }
         }
     }
 }
示例#4
0
        /// <summary>
        /// Returns the number of types in the <see cref="NameSpaceDeclarations"/> that
        /// <paramref name="target"/> what's provided.
        /// </summary>
        /// <param name="target">The namespace parent to check which against the namespaces.</param>
        /// <returns>An integer containing the number of <see cref="INameSpaceDeclaration"/> instances that
        /// are children of the <paramref name="target"/>.</returns>
        public int GetCountForTarget(INameSpaceParent target)
        {
            int result = 0;

            foreach (INameSpaceDeclaration ti in this.Values)
            {
                if (ti.ParentTarget == target)
                {
                    result++;
                }
                else
                {
                    foreach (INameSpaceDeclaration nsp in ti.Partials)
                    {
                        if (nsp.ParentTarget == target)
                        {
                            result++;
                        }
                    }
                }
            }
            return(result);
        }
示例#5
0
 public abstract void TranslateNameSpaces(INameSpaceParent parent, INameSpaceDeclarations nameSpaces);
示例#6
0
 internal NameSpaceDeclarations(INameSpaceParent targetDeclaration, NameSpaceDeclarations sibling)
     : base(sibling)
 {
     this.targetDeclaration = targetDeclaration;
 }
示例#7
0
 /// <summary>
 /// Creates a new instance of <see cref="ClassTypes"/> denoting the <see cref="ITypeParent"/>
 /// that members are children of initially.
 /// </summary>
 internal NameSpaceDeclarations(INameSpaceParent targetDeclaration)
 {
     this.targetDeclaration = targetDeclaration;
 }
示例#8
0
 public INameSpaceDeclarations GetPartialClone(INameSpaceParent basePartial)
 {
     return(new NameSpaceDeclarations(basePartial, this));
 }