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"); }
public void Dispose() { this.targetDeclaration = null; foreach (INameSpaceDeclaration nsd in this.Values) { try { this.Remove(nsd.Name); } catch { } } }
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); } } } } }
/// <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); }
public abstract void TranslateNameSpaces(INameSpaceParent parent, INameSpaceDeclarations nameSpaces);
internal NameSpaceDeclarations(INameSpaceParent targetDeclaration, NameSpaceDeclarations sibling) : base(sibling) { this.targetDeclaration = targetDeclaration; }
/// <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; }
public INameSpaceDeclarations GetPartialClone(INameSpaceParent basePartial) { return(new NameSpaceDeclarations(basePartial, this)); }