예제 #1
0
 public void Remove(ISegmentableDeclarationTarget partial)
 {
     if (!(partial is INameSpaceDeclaration))
     {
         throw new ArgumentException("partial");
     }
 }
예제 #2
0
 void ISegmentableDeclarationTargetPartials.Remove(ISegmentableDeclarationTarget partial)
 {
     if (!(partial is IIntermediateProject))
     {
         throw new ArgumentException("partial");
     }
 }
예제 #3
0
 void ISegmentableDeclarationTargetPartials.Remove(ISegmentableDeclarationTarget partial)
 {
     if (!(partial is TItem))
     {
         throw new ArgumentException("partial");
     }
     this.Remove((TItem)partial);
 }
예제 #4
0
 public abstract void TranslateConceptPartial(ISegmentableDeclarationTarget seggedDecl);
예제 #5
0
        public override void TranslateTypeParentTypes(ITypeParent parent)
        {
            /* *
             * lastBlockFlag ensures that the null line is only inserted if the last block
             * -with members- is present.  This way if the delegates were null but the
             * classes had members, the enumerators check on the lastblockflag still checks
             * out with the 'classes' block.
             * */
            ISegmentableDeclarationTarget seggedMember = null;

            if (!options.AllowPartials && parent is ISegmentableDeclarationTarget && ((ISegmentableDeclarationTarget)(parent)).IsPartial)
            {
                return;
            }
            else if (parent is ISegmentableDeclarationTarget)
            {
                seggedMember = (ISegmentableDeclarationTarget)parent;
            }

            bool   lastBlockFlag = false;
            string regionText    = "";
            bool   useRegion     = false;

            if (!(parent.Classes == null && parent.Delegates == null && parent.Enumerators == null && parent.Interfaces == null && parent.Structures == null))
            {
                useRegion = (!(parent is INameSpaceDeclaration)) && (!(parent is IDeclarationResources)) && options.AutoRegionsFor(AutoRegionAreas.NestedTypes) && (options.AllowPartials && seggedMember != null && (parent.Classes.GetCountForTarget(parent) > 0 || parent.Delegates.GetCountForTarget(parent) > 0 || parent.Enumerators.GetCountForTarget(parent) > 0 || parent.Interfaces.GetCountForTarget(parent) > 0 || parent.Structures.GetCountForTarget(parent) > 0) || ((seggedMember == null) && (parent.GetTypeCount() > 0)));
            }
            if (useRegion)
            {
                regionText = String.Format(_OIL._Core.MaintenanceResources.AutoRegions_BasePattern, parent.Name, _OIL._Core.MaintenanceResources.AutoRegions_NestedTypes);
                TranslateConceptRegionStart(regionText);
            }

            if ((!(parent is IIntermediateProject)) && !(parent is IDeclarationResources) && parent is IResourceable)
            {
                if (((IResourceable)parent).Resources != null && ((IResourceable)parent).Resources.GetMemberCount(false) > 0)
                {
                    if ((options.AllowPartials) || (parent is ISegmentableDeclarationTarget && ((ISegmentableDeclarationTarget)(parent)).IsRoot))
                    {
                        options.BuildTrail.Push(((IResourceable)parent).Resources);
                        TranslateType(((IResourceable)parent).Resources);
                        options.BuildTrail.Pop();
                    }
                }
            }

            if (parent.Classes != null)
            {
                TranslateTypes(parent, parent.Classes);
                if (!lastBlockFlag)
                {
                    if (seggedMember == null)
                    {
                        lastBlockFlag = parent.Classes.Count > 0;
                    }
                    else
                    {
                        lastBlockFlag = parent.Classes.GetCountForTarget(parent) > 0;
                    }
                }
            }

            if (parent.Delegates != null)
            {
                if ((seggedMember != null && parent.Delegates.GetCountForTarget(parent) > 0) || (seggedMember == null) && (parent.Delegates.Count > 0) && (lastBlockFlag))
                {
                    this.WriteLine();
                    lastBlockFlag = false;
                }
                TranslateTypes(parent, parent.Delegates);
                if (!lastBlockFlag)
                {
                    if (seggedMember == null)
                    {
                        lastBlockFlag = parent.Delegates.Count > 0;
                    }
                    else
                    {
                        lastBlockFlag = parent.Delegates.GetCountForTarget(parent) > 0;
                    }
                }
            }

            if (parent.Enumerators != null)
            {
                if ((seggedMember != null && parent.Enumerators.GetCountForTarget(parent) > 0) || (seggedMember == null) && (parent.Enumerators.Count > 0) && (lastBlockFlag))
                {
                    this.WriteLine();
                    lastBlockFlag = false;
                }
                TranslateTypes(parent, parent.Enumerators);
                if (!lastBlockFlag)
                {
                    if (seggedMember == null)
                    {
                        lastBlockFlag = parent.Enumerators.Count > 0;
                    }
                    else
                    {
                        lastBlockFlag = parent.Enumerators.GetCountForTarget(parent) > 0;
                    }
                }
            }

            if (parent.Interfaces != null)
            {
                if ((seggedMember != null && parent.Interfaces.GetCountForTarget(parent) > 0) || (seggedMember == null) && (parent.Interfaces.Count > 0) && (lastBlockFlag))
                {
                    this.WriteLine();
                    lastBlockFlag = false;
                }
                TranslateTypes(parent, parent.Interfaces);
                if (!lastBlockFlag)
                {
                    if (seggedMember == null)
                    {
                        lastBlockFlag = parent.Interfaces.Count > 0;
                    }
                    else
                    {
                        lastBlockFlag = parent.Interfaces.GetCountForTarget(parent) > 0;
                    }
                }
            }

            if (parent.Structures != null)
            {
                if ((seggedMember != null && parent.Structures.GetCountForTarget(parent) > 0) || (seggedMember == null) && (parent.Structures.Count > 0) && (lastBlockFlag))
                {
                    this.WriteLine();
                    lastBlockFlag = false;
                }
                TranslateTypes(parent, parent.Structures);
            }

            if (useRegion)
            {
                TranslateConceptRegionEnd(regionText);
            }
        }
예제 #6
0
 public override void TranslateConceptPartial(ISegmentableDeclarationTarget seggedDecl)
 {
 }