예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DocumentedType" /> class.
        /// </summary>
        /// <param name="info">The type information.</param>
        /// <param name="properties">The type's properties.</param>
        /// <param name="methods">The type's methods.</param>
        /// <param name="fields">The type's fields.</param>
        /// <param name="summary">The summary.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="examples">The examples.</param>
        /// <param name="metadata">The type metadata.</param>
        public DocumentedType(
            ITypeInfo info,
            IEnumerable <DocumentedProperty> properties,
            IEnumerable <DocumentedMethod> methods,
            IEnumerable <DocumentedField> fields,
            SummaryComment summary,
            RemarksComment remarks,
            IEnumerable <ExampleComment> examples,
            IDocumentationMetadata metadata)
            : base(MemberClassification.Type, summary, remarks, examples, metadata)
        {
            Definition         = info.Definition;
            TypeClassification = info.Definition.GetTypeClassification();
            Identity           = info.Identity;
            Properties         = new List <DocumentedProperty>(properties);
            Fields             = new List <DocumentedField>(fields);

            // Materialize all methods.
            var documentedMethods = methods as DocumentedMethod[] ?? methods.ToArray();

            Constructors = new List <DocumentedMethod>(GetConstructors(documentedMethods));
            Methods      = new List <DocumentedMethod>(GetMethods(documentedMethods));
            Operators    = new List <DocumentedMethod>(GetOperators(documentedMethods));

            _extensionMethods = new List <DocumentedMethod>();
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DocumentedType" /> class.
        /// </summary>
        /// <param name="info">The type information.</param>
        /// <param name="properties">The type's properties.</param>
        /// <param name="methods">The type's methods.</param>
        /// <param name="fields">The type's fields.</param>
        /// <param name="summary">The summary.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="examples">The examples.</param>
        /// <param name="metadata">The type metadata.</param>
        public DocumentedType(
            ITypeInfo info,
            IEnumerable<DocumentedProperty> properties,
            IEnumerable<DocumentedMethod> methods,
            IEnumerable<DocumentedField> fields,
            SummaryComment summary,
            RemarksComment remarks,
            IEnumerable<ExampleComment> examples,
            IDocumentationMetadata metadata)
            : base(MemberClassification.Type, summary, remarks, examples, metadata)
        {
            Definition = info.Definition;
            TypeClassification = info.Definition.GetTypeClassification();
            Identity = info.Identity;
            Properties = new List<DocumentedProperty>(properties);
            Fields = new List<DocumentedField>(fields);

            // Materialize all methods.
            var documentedMethods = methods as DocumentedMethod[] ?? methods.ToArray();

            Constructors = new List<DocumentedMethod>(GetConstructors(documentedMethods));
            Methods = new List<DocumentedMethod>(GetMethods(documentedMethods));
            Operators = new List<DocumentedMethod>(GetOperators(documentedMethods));

            _extensionMethods = new List<DocumentedMethod>();
        }
예제 #3
0
        private static DocumentedType MapType(ITypeInfo type, XmlDocumentationModel xmlModel)
        {
            SummaryComment summary = null;
            RemarksComment remarks = null;
            IEnumerable <ExampleComment> example = null;

            // Get the documentation for the type.
            var member = xmlModel.Find(type.Identity);

            if (member != null)
            {
                // Get the comments for the type.
                summary = member.Comments.OfType <SummaryComment>().Aggregate(
                    null as SummaryComment,
                    (prev, curr) => (curr != null && prev != null)
                        ? new SummaryComment(prev.Children.Concat(curr.Children))
                        : curr ?? prev,
                    result => result
                    );
                remarks = member.Comments.OfType <RemarksComment>().Aggregate(
                    null as RemarksComment,
                    (prev, curr) => (curr != null && prev != null)
                        ? new RemarksComment(prev.Children.Concat(curr.Children))
                        : curr ?? prev,
                    result => result
                    );
                example = member.Comments.OfType <ExampleComment>();
            }

            // Map the methods.
            var methods = new List <DocumentedMethod>();

            foreach (var method in type.Methods)
            {
                methods.Add(MapMethod(method, xmlModel));
            }

            // Map the properties.
            var properties = new List <DocumentedProperty>();

            foreach (var property in type.Properties)
            {
                properties.Add(MapProperty(property, xmlModel));
            }

            // Map the fields.
            var fields = new List <DocumentedField>();

            foreach (var field in type.Fields)
            {
                fields.Add(MapField(field, xmlModel));
            }

            // Return the documented type.
            return(new DocumentedType(type, properties, methods, fields, summary, remarks, example, type.Metadata));
        }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedField"/> class.
 /// </summary>
 /// <param name="info">The field info.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 public DocumentedField(
     IFieldInfo info,
     SummaryComment summary,
     RemarksComment remarks,
     ExampleComment example)
     : base(MemberClassification.Type, summary, remarks, example)
 {
     _definition = info.Definition;
     _identity   = info.Identity;
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedField"/> class.
 /// </summary>
 /// <param name="info">The field info.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 public DocumentedField(
     IFieldInfo info,
     SummaryComment summary, 
     RemarksComment remarks,
     ExampleComment example)
     : base(MemberClassification.Type, summary, remarks, example)
 {
     _definition = info.Definition;
     _identity = info.Identity;
 }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedField"/> class.
 /// </summary>
 /// <param name="info">The field info.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="examples">The example comments.</param>
 /// <param name="metadata">The associated metadata.</param>
 public DocumentedField(
     IFieldInfo info,
     SummaryComment summary,
     RemarksComment remarks,
     IEnumerable <ExampleComment> examples,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Type, summary, remarks, examples, metadata)
 {
     Definition = info.Definition;
     Identity   = info.Identity;
 }
예제 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedMember"/> class.
 /// </summary>
 /// <param name="classification">The member classification.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 protected DocumentedMember(
     MemberClassification classification,
     SummaryComment summary,
     RemarksComment remarks,
     ExampleComment example)
 {
     _classification = classification;
     _summary        = summary;
     _remarks        = remarks;
     _example        = example;
 }
예제 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedField"/> class.
 /// </summary>
 /// <param name="info">The field info.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="examples">The example comments.</param>
 /// <param name="metadata">The associated metadata.</param>
 public DocumentedField(
     IFieldInfo info,
     SummaryComment summary,
     RemarksComment remarks,
     IEnumerable<ExampleComment> examples,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Type, summary, remarks, examples, metadata)
 {
     Definition = info.Definition;
     Identity = info.Identity;
 }
예제 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedMember"/> class.
 /// </summary>
 /// <param name="classification">The member classification.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 protected DocumentedMember(
     MemberClassification classification, 
     SummaryComment summary, 
     RemarksComment remarks, 
     ExampleComment example)
 {
     _classification = classification;
     _summary = summary;
     _remarks = remarks;
     _example = example;
 }
예제 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedProperty" /> class.
 /// </summary>
 /// <param name="info">The property info.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 /// <param name="value">The value comment.</param>
 public DocumentedProperty(
     IPropertyInfo info,
     SummaryComment summary,
     RemarksComment remarks,
     ExampleComment example,
     ValueComment value)
     : base(MemberClassification.Property, summary, remarks, example)
 {
     _definition = info.Definition;
     _identity = info.Identity;
     _value = value;
 }
예제 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedProperty" /> class.
 /// </summary>
 /// <param name="info">The property info.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 /// <param name="value">The value comment.</param>
 public DocumentedProperty(
     IPropertyInfo info,
     SummaryComment summary,
     RemarksComment remarks,
     ExampleComment example,
     ValueComment value)
     : base(MemberClassification.Property, summary, remarks, example)
 {
     _definition = info.Definition;
     _identity   = info.Identity;
     _value      = value;
 }
예제 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedProperty" /> class.
 /// </summary>
 /// <param name="info">The property info.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="examples">The example comments.</param>
 /// <param name="value">The value comment.</param>
 /// <param name="metadata">The associated metadata.</param>
 public DocumentedProperty(
     IPropertyInfo info,
     SummaryComment summary,
     RemarksComment remarks,
     IEnumerable <ExampleComment> examples,
     ValueComment value,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Property, summary, remarks, examples, metadata)
 {
     Definition = info.Definition;
     Identity   = info.Identity;
     Value      = value;
 }
예제 #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedProperty" /> class.
 /// </summary>
 /// <param name="info">The property info.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="examples">The example comments.</param>
 /// <param name="value">The value comment.</param>
 /// <param name="metadata">The associated metadata.</param>
 public DocumentedProperty(
     IPropertyInfo info,
     SummaryComment summary,
     RemarksComment remarks,
     IEnumerable<ExampleComment> examples,
     ValueComment value,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Property, summary, remarks, examples, metadata)
 {
     Definition = info.Definition;
     Identity = info.Identity;
     Value = value;
 }
예제 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedMethod" /> class.
 /// </summary>
 /// <param name="info">The method info.</param>
 /// <param name="parameters">The method's parameters.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 /// <param name="returns">The return value comment.</param>
 public DocumentedMethod(
     IMethodInfo info,
     IEnumerable <DocumentedParameter> parameters,
     SummaryComment summary,
     RemarksComment remarks,
     ExampleComment example,
     ReturnsComment returns) : base(MemberClassification.Method, summary, remarks, example)
 {
     _definition           = info.Definition;
     _methodClassification = info.Definition.GetMethodClassification();
     _identity             = info.Identity;
     _parameters           = new List <DocumentedParameter>(parameters);
     _returns = returns;
 }
예제 #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedMethod" /> class.
 /// </summary>
 /// <param name="info">The method info.</param>
 /// <param name="parameters">The method's parameters.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 /// <param name="returns">The return value comment.</param>
 public DocumentedMethod(
     IMethodInfo info, 
     IEnumerable<DocumentedParameter> parameters,
     SummaryComment summary, 
     RemarksComment remarks, 
     ExampleComment example,
     ReturnsComment returns)
     : base(MemberClassification.Method, summary, remarks, example)
 {
     _definition = info.Definition;
     _methodClassification = MethodClassifier.GetMethodClassification(info.Definition);
     _identity = info.Identity;
     _parameters = new List<DocumentedParameter>(parameters);
     _returns = returns;
 }
예제 #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedMethod" /> class.
 /// </summary>
 /// <param name="info">The method info.</param>
 /// <param name="parameters">The method's parameters.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="examples">The example comments.</param>
 /// <param name="returns">The return value comment.</param>
 /// <param name="metadata">The method metadata.</param>
 public DocumentedMethod(
     IMethodInfo info,
     IEnumerable <DocumentedParameter> parameters,
     SummaryComment summary,
     RemarksComment remarks,
     IEnumerable <ExampleComment> examples,
     ReturnsComment returns,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Method, summary, remarks, examples, metadata)
 {
     Definition           = info.Definition;
     MethodClassification = MethodClassifier.GetMethodClassification(info.Definition);
     Identity             = info.Identity;
     Parameters           = new List <DocumentedParameter>(parameters);
     Returns = returns;
 }
예제 #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedMethod" /> class.
 /// </summary>
 /// <param name="info">The method info.</param>
 /// <param name="parameters">The method's parameters.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="examples">The example comments.</param>
 /// <param name="returns">The return value comment.</param>
 /// <param name="metadata">The method metadata.</param>
 public DocumentedMethod(
     IMethodInfo info,
     IEnumerable<DocumentedParameter> parameters,
     SummaryComment summary,
     RemarksComment remarks,
     IEnumerable<ExampleComment> examples,
     ReturnsComment returns,
     IDocumentationMetadata metadata)
     : base(MemberClassification.Method, summary, remarks, examples, metadata)
 {
     Definition = info.Definition;
     MethodClassification = MethodClassifier.GetMethodClassification(info.Definition);
     Identity = info.Identity;
     Parameters = new List<DocumentedParameter>(parameters);
     Returns = returns;
 }
예제 #18
0
        private static DocumentedMethod MapMethod(IMethodInfo method, XmlDocumentationModel xmlModel)
        {
            var parameters = new List <DocumentedParameter>();

            SummaryComment summary = null;
            RemarksComment remarks = null;
            IEnumerable <ExampleComment> examples = null;
            ReturnsComment returns = null;

            // Get the documentation for the type.
            var member = xmlModel.Find(method.Identity);

            if (member != null)
            {
                // Get the comments for the type.
                summary  = member.Comments.OfType <SummaryComment>().FirstOrDefault();
                remarks  = member.Comments.OfType <RemarksComment>().FirstOrDefault();
                examples = member.Comments.OfType <ExampleComment>();
                returns  = member.Comments.OfType <ReturnsComment>().FirstOrDefault();
            }

            // Map parameters.
            foreach (var parameterDefinition in method.Definition.Parameters.ToList())
            {
                ParamComment comment = null;
                if (member != null)
                {
                    // Try to get the comment for the current parameter.
                    comment = member.Comments.OfType <ParamComment>().FirstOrDefault(x => x.Name == parameterDefinition.Name);
                }

                var parameter = new DocumentedParameter(parameterDefinition, comment, method.Metadata);
                parameters.Add(parameter);
            }

            var  metadata = method.Metadata;
            bool isPropertyAlias;

            if (method.Definition.IsCakeAlias(out isPropertyAlias))
            {
                metadata = new AliasMetadataAdapter(metadata, isPropertyAlias);
            }

            return(new DocumentedMethod(method, parameters, summary, remarks, examples, returns, metadata));
        }
예제 #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DocumentedMember"/> class.
        /// </summary>
        /// <param name="classification">The member classification.</param>
        /// <param name="summary">The summary comment.</param>
        /// <param name="remarks">The remarks comment.</param>
        /// <param name="examples">The example comments.</param>
        /// <param name="metadata">The metadata associated with the member.</param>
        protected DocumentedMember(
            MemberClassification classification,
            SummaryComment summary,
            RemarksComment remarks,
            IEnumerable <ExampleComment> examples,
            IDocumentationMetadata metadata)
        {
            if (metadata == null)
            {
                throw new ArgumentNullException(nameof(metadata));
            }

            Classification = classification;
            Summary        = summary;
            Remarks        = remarks;
            Examples       = new List <ExampleComment>(examples ?? Enumerable.Empty <ExampleComment>());
            Metadata       = metadata;
        }
예제 #20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DocumentedMember"/> class.
        /// </summary>
        /// <param name="classification">The member classification.</param>
        /// <param name="summary">The summary comment.</param>
        /// <param name="remarks">The remarks comment.</param>
        /// <param name="examples">The example comments.</param>
        /// <param name="metadata">The metadata associated with the member.</param>
        protected DocumentedMember(
            MemberClassification classification,
            SummaryComment summary, 
            RemarksComment remarks, 
            IEnumerable<ExampleComment> examples,
            IDocumentationMetadata metadata)
        {
            if (metadata == null)
            {
                throw new ArgumentNullException("metadata");
            }

            _classification = classification;
            _summary = summary;
            _remarks = remarks;
            _examples = new List<ExampleComment>(examples ?? Enumerable.Empty<ExampleComment>());
            _metadata = metadata;
        }
예제 #21
0
        private static DocumentedType MapType(ITypeInfo type, XmlDocumentationModel xmlModel)
        {
            SummaryComment summary = null;
            RemarksComment remarks = null;
            ExampleComment example = null;

            // Get the documentation for the type.
            var member = xmlModel.Find(type.Identity);

            if (member != null)
            {
                // Get the comments for the type.
                summary = member.Comments.OfType <SummaryComment>().SingleOrDefault();
                remarks = member.Comments.OfType <RemarksComment>().SingleOrDefault();
                example = member.Comments.OfType <ExampleComment>().SingleOrDefault();
            }

            // Map the methods.
            var methods = new List <DocumentedMethod>();

            foreach (var method in type.Methods)
            {
                methods.Add(MapMethod(method, xmlModel));
            }

            // Map the properties.
            var properties = new List <DocumentedProperty>();

            foreach (var property in type.Properties)
            {
                properties.Add(MapProperty(property, xmlModel));
            }

            // Map the fields.
            var fields = new List <DocumentedField>();

            foreach (var field in type.Fields)
            {
                fields.Add(MapField(field, xmlModel));
            }

            // Return the documented type.
            return(new DocumentedType(type, properties, methods, fields, summary, remarks, example));
        }
예제 #22
0
        private static DocumentedField MapField(IFieldInfo field, XmlDocumentationModel xmlModel)
        {
            SummaryComment summary = null;
            RemarksComment remarks = null;
            ExampleComment example = null;

            // Get the documentation for the type.
            var member = xmlModel.Find(field.Identity);

            if (member != null)
            {
                // Get the comments for the type.
                summary = member.Comments.OfType <SummaryComment>().SingleOrDefault();
                remarks = member.Comments.OfType <RemarksComment>().SingleOrDefault();
                example = member.Comments.OfType <ExampleComment>().SingleOrDefault();
            }

            return(new DocumentedField(field, summary, remarks, example));
        }
예제 #23
0
        private static DocumentedProperty MapProperty(IPropertyInfo property, XmlDocumentationModel xmlModel)
        {
            SummaryComment summary = null;
            RemarksComment remarks = null;
            ExampleComment example = null;
            ValueComment   value   = null;

            // Get the documentation for the type.
            var member = xmlModel.Find(property.Identity);

            if (member != null)
            {
                // Get the comments for the type.
                summary = member.Comments.OfType <SummaryComment>().SingleOrDefault();
                remarks = member.Comments.OfType <RemarksComment>().SingleOrDefault();
                example = member.Comments.OfType <ExampleComment>().SingleOrDefault();
                value   = member.Comments.OfType <ValueComment>().SingleOrDefault();
            }

            return(new DocumentedProperty(property, summary, remarks, example, value));
        }
예제 #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DocumentedType" /> class.
        /// </summary>
        /// <param name="info">The type information.</param>
        /// <param name="properties">The type's properties.</param>
        /// <param name="methods">The type's methods.</param>
        /// <param name="fields">The type's fields.</param>
        /// <param name="summary">The summary.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="example">The example.</param>
        public DocumentedType(
            ITypeInfo info,
            IEnumerable <DocumentedProperty> properties,
            IEnumerable <DocumentedMethod> methods,
            IEnumerable <DocumentedField> fields,
            SummaryComment summary,
            RemarksComment remarks,
            ExampleComment example)
            : base(MemberClassification.Type, summary, remarks, example)
        {
            _definition         = info.Definition;
            _typeClassification = info.Definition.GetTypeClassification();
            _identity           = info.Identity;
            _properties         = new List <DocumentedProperty>(properties);
            _fields             = new List <DocumentedField>(fields);

            // Materialize all methods.
            var documentedMethods = methods as DocumentedMethod[] ?? methods.ToArray();

            _constructors = new List <DocumentedMethod>(GetConstructors(documentedMethods));
            _methods      = new List <DocumentedMethod>(GetMethods(documentedMethods));
            _operators    = new List <DocumentedMethod>(GetOperators(documentedMethods));
        }
예제 #25
0
        private static DocumentedMethod MapMethod(IMethodInfo method, XmlDocumentationModel xmlModel)
        {
            var parameters = new List <DocumentedParameter>();

            SummaryComment summary = null;
            RemarksComment remarks = null;
            ExampleComment example = null;
            ReturnsComment returns = null;

            // Get the documentation for the type.
            var member = xmlModel.Find(method.Identity);

            if (member != null)
            {
                // Get the comments for the type.
                summary = member.Comments.OfType <SummaryComment>().FirstOrDefault();
                remarks = member.Comments.OfType <RemarksComment>().FirstOrDefault();
                example = member.Comments.OfType <ExampleComment>().FirstOrDefault();
                returns = member.Comments.OfType <ReturnsComment>().FirstOrDefault();
            }

            // Map parameters.
            foreach (var parameterDefinition in method.Definition.Parameters.ToList())
            {
                ParamComment comment = null;
                if (member != null)
                {
                    // Try to get the comment for the current parameter.
                    comment = member.Comments.OfType <ParamComment>().FirstOrDefault(x => x.Name == parameterDefinition.Name);
                }

                var parameter = new DocumentedParameter(parameterDefinition, comment);
                parameters.Add(parameter);
            }

            return(new DocumentedMethod(method, parameters, summary, remarks, example, returns));
        }
예제 #26
0
 public override void VisitRemarks(RemarksComment comment, StringBuilder context)
 {
     context.Append("<remarks>");
     base.VisitRemarks(comment, context);
     context.Append("</remarks>");
 }
예제 #27
0
 /// <summary>
 /// Visits a <c>remarks</c> comment.
 /// </summary>
 /// <param name="comment">The comment.</param>
 /// <param name="context">The context.</param>
 public virtual void VisitRemarks(RemarksComment comment, TContext context)
 {
     VisitChildren(comment, context);
 }