/// <summary>
        /// For all "duplicate" comments, replace the comment with the duplicated comments.
        /// </summary>
        /// <param name="FindMember">Function that returns the selected member from all known members in the assembly.</param>
        /// <param name="pathToThisDuplicate">List of named types/members that are duplicating each other, leading to this member. Used to avoid reference loops.</param>
        /// <returns>Returns true if resolution is successful. Returns false if referenced member is not found, or if there is a reference loop.</returns>
        public virtual bool ResolveDuplicatedComments(Func <DotNetQualifiedName, DotNetMember> FindMember, List <DotNetQualifiedName> pathToThisDuplicate = null)
        {
            if (pathToThisDuplicate == null)
            {
                pathToThisDuplicate = new List <DotNetQualifiedName>();
            }

            if (!DuplicatesDocumentation)
            {
                return(true);
            }
            if (pathToThisDuplicate.Contains(this.Name))
            {
                return(false);                //avoid reference loops
            }
            DotNetMember copyFrom = FindMember(DuplicatesFrom);

            if (copyFrom == null)
            {
                return(false);
            }
            if (copyFrom.DuplicatesDocumentation)
            {
                pathToThisDuplicate.Add(copyFrom.Name);
                bool copyFromSuccessful = copyFrom.ResolveDuplicatedComments(FindMember, pathToThisDuplicate);
                if (!copyFromSuccessful)
                {
                    return(false);
                }
            }
            CopyComments(copyFrom);
            return(true);
        }
 private void AddMemberToType(DotNetMember member)
 {
     foreach (DotNetType parentType in Types)
     {
         if (parentType.Owns(member))
         {
             parentType.AddMember(member);
             return;
         }
     }
     //no exception if type not found, member is ignored
 }
Exemplo n.º 3
0
 /// <summary>
 /// Add a member to this type or one of its nested type descendents.
 /// </summary>
 public void AddMember(DotNetMember member)
 {
     if (Name.FullName == member.Name.FullNamespace)
     {
         if (member is DotNetEvent)
         {
             Events.Add(member as DotNetEvent);
         }
         else if (member is DotNetProperty)
         {
             Properties.Add(member as DotNetProperty);
         }
         else if (member is DotNetField)
         {
             Fields.Add(member as DotNetField);
         }
         else if (member is DotNetMethod)
         {
             Methods.Add(member as DotNetMethod);
             if (member is DotNetMethodConstructor)
             {
                 (member as DotNetMethodConstructor).SetClassName(ClassName);
             }
         }
         else if (member is DotNetType)
         {
             NestedTypes.Add(member as DotNetType);
         }
         else
         {
             throw new XmlFormatException("Member with unknown category added to type: " + member.Name.FullName);
         }
         return;
     }
     foreach (DotNetType nestedType in NestedTypes)
     {
         if (nestedType.Owns(member))
         {
             nestedType.AddMember(member);
             return;
         }
     }
     //no exception if member parent is not found
 }
        /// <summary>
        /// Shallow-copies all comments from the <paramref name="original"/> member to this member.
        /// </summary>
        public void CopyComments(DotNetMember original)
        {
            if (original == null)
            {
                return;
            }

            SummaryComments.Comments.Clear();
            SummaryComments.Comments.AddRange(original.SummaryComments.Comments);

            RemarksComments.Comments.Clear();
            RemarksComments.Comments.AddRange(original.RemarksComments.Comments);

            PermissionComments.Clear();
            PermissionComments.AddRange(original.PermissionComments);

            ExampleComments.Clear();
            ExampleComments.AddRange(original.ExampleComments);

            ExceptionComments.Clear();
            ExceptionComments.AddRange(original.ExceptionComments);

            ParameterComments.Clear();
            ParameterComments.AddRange(original.ParameterComments);

            TypeParameterComments.Clear();
            TypeParameterComments.AddRange(original.TypeParameterComments);

            ValueComments.Comments.Clear();
            ValueComments.Comments.AddRange(original.ValueComments.Comments);

            ReturnsComments.Comments.Clear();
            ReturnsComments.Comments.AddRange(original.ReturnsComments.Comments);

            FloatingComments.Comments.Clear();
            FloatingComments.Comments.AddRange(original.FloatingComments.Comments);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Returns true if link name matches the member name.
 /// </summary>
 public bool Matches(DotNetMember member)
 {
     return(member.Matches(this));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Returns true if this member is defined within this type or any of its nested type descendents.
 /// </summary>
 public bool Owns(DotNetMember member)
 {
     return(Owns(member.Name));
 }