예제 #1
0
 private static bool NameSpaceExists(INameSpaceDeclarations nameSpaces, string nameSpace, ref INameSpaceDeclaration foundSpace)
 {
     foreach (INameSpaceDeclaration insd in nameSpaces.Values)
     {
         bool childrenContain = false;
         if (insd.FullName == nameSpace)
         {
             foundSpace = insd;
             return(true);
         }
         childrenContain = NameSpaceExists(insd.ChildSpaces, nameSpace, ref foundSpace);
         if (childrenContain)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #2
0
        public CodeNamespace[] GenerateGroupCodeDom(ICodeDOMTranslationOptions options)
        {
            List <CodeNamespace> result        = new List <CodeNamespace>();
            CodeNamespace        cnsThisResult = this.GenerateCodeDom(options);

            if (cnsThisResult != null)
            {
                result.Add(cnsThisResult);
            }
            foreach (INameSpaceDeclaration ind in this.ChildSpaces.Values)
            {
                CodeNamespace[] childSpaces;
                if (!options.AllowPartials)
                {
                    //Auto-flattens hierarchhy.
                    childSpaces = ind.GenerateGroupCodeDom(options);
                }
                else
                {
                    //There's extra work to do.
                    List <CodeNamespace> childSpacesList = new List <CodeNamespace>();
                    if (ind.ParentTarget == this)
                    {
                        childSpacesList.AddRange(ind.GenerateGroupCodeDom(options));
                    }
                    foreach (INameSpaceDeclaration indPartial in ind.Partials)
                    {
                        if (indPartial.ParentTarget == this)
                        {
                            childSpacesList.AddRange(indPartial.GenerateGroupCodeDom(options));
                        }
                    }
                    childSpaces = childSpacesList.ToArray();
                }
                for (int i = 0; i < childSpaces.Length; i++)
                {
                    if (childSpaces[i] != null)
                    {
                        result.Add(childSpaces[i]);
                    }
                }
            }
            return(result.ToArray());
        }
예제 #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
 public abstract void TranslateNameSpaces(INameSpaceParent parent, INameSpaceDeclarations nameSpaces);
예제 #5
0
 private void GatherTypes(List <IDeclaredType> target, List <IIntermediateProject> projectPartials, INameSpaceDeclarations nameSpaces)
 {
     foreach (INameSpaceDeclaration insd in nameSpaces.Values)
     {
         GatherTypes(target, projectPartials, (ITypeParent)insd);
         GatherTypes(target, projectPartials, insd.ChildSpaces);
     }
 }