Пример #1
0
 /// <summary>
 /// Initializes a new instance of <see cref="GenericTypeId"/>.
 /// </summary>
 /// <param name="namespace">The namespace the type is defined in.</param>
 /// <param name="name">The name of the type.</param>
 /// <param name="arity">The number of type parameter the type defines.</param>
 public GenericTypeId(NamespaceId @namespace, string name, int arity) : base(@namespace, name)
 {
     Arity = arity;
     m_TypeParameterDisplayNames = arity == 1
         ? new[] { "T" }
         : Enumerable.Range(1, arity).Select(x => "T" + x).ToArray();
 }
Пример #2
0
 /// <inheritdoc />
 public IDocumentation?TryGetDocumentation(MemberId member)
 {
     return(member switch
     {
         TypeId typeId => m_Types.GetValueOrDefault(typeId)?.TryGetDocumentation(member),
         TypeMemberId typeMemberId => m_Types.GetValueOrDefault(typeMemberId.DefiningType)?.TryGetDocumentation(member),
         NamespaceId namespaceId => m_Namespaces.GetValueOrDefault(namespaceId),
         _ => null
     });
Пример #3
0
        /// <summary>
        /// Initializes a new instance of <see cref="TypeId"/>.
        /// </summary>
        /// <param name="namespace">The namespace the type is defined in.</param>
        /// <param name="name">The type's name.</param>
        // private protected constructor => prevent implementation outside of this assembly
        private protected TypeId(NamespaceId @namespace, string name)
        {
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Value must not be null or empty", nameof(name));
            }

            Namespace = @namespace ?? throw new ArgumentNullException(nameof(@namespace));
            Name      = name;
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of <see cref="GenericTypeId"/>.
        /// </summary>
        /// <param name="namespace">The namespace the type is defined in.</param>
        /// <param name="name">The name of the type.</param>
        /// <param name="arity">The number of type parameter the type defines.</param>
        /// <param name="typeParameterDisplayNames">The display names of the type parameters (e.g. "TKey", "TValue"...)</param>
        public GenericTypeId(NamespaceId @namespace, string name, int arity, IReadOnlyList <string> typeParameterDisplayNames) : base(@namespace, name)
        {
            m_TypeParameterDisplayNames = typeParameterDisplayNames ?? throw new ArgumentNullException(nameof(typeParameterDisplayNames));
            Arity = arity;

            if (typeParameterDisplayNames?.Count != arity)
            {
                throw new ArgumentException("The number of type parameter display names must match the type's arity", nameof(typeParameterDisplayNames));
            }
        }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of <see cref="GenericTypeInstanceId"/>.
 /// </summary>
 /// <param name="namespace">The namespace the type is defined in.</param>
 /// <param name="name">The type's name.</param>
 /// <param name="typeArguments">The type's type arguments.</param>
 public GenericTypeInstanceId(NamespaceId @namespace, string name, IReadOnlyList <TypeId> typeArguments) : base(@namespace, name)
 {
     TypeArguments = typeArguments ?? throw new ArgumentNullException(nameof(typeArguments));
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of <see cref="SimpleTypeId"/>.
 /// </summary>
 /// <param name="namespace">The namespace the type is defined in.</param>
 /// <param name="name">The type's name.</param>
 public SimpleTypeId(NamespaceId @namespace, string name) : base(@namespace, name)
 {
 }
Пример #7
0
        /// <summary>
        /// Initializes a new instance of <see cref="NamespaceDocumentation"/>.
        /// </summary>
        /// <param name="assemblySet">The the set of assemblies documentation is being generated for.</param>
        /// <param name="parentNamespaceDocumentation">The documentation model of the namespace that contains this namespace.</param>
        /// <param name="namespaceId">The id of the namespace.</param>
        /// <param name="logger">The logger to use.</param>
        internal NamespaceDocumentation(AssemblySetDocumentation assemblySet, NamespaceDocumentation?parentNamespaceDocumentation, NamespaceId namespaceId, ILogger logger)
        {
            m_AssemblySet = assemblySet ?? throw new ArgumentNullException(nameof(assemblySet));
            ParentNamespaceDocumentation = parentNamespaceDocumentation;
            NamespaceId = namespaceId ?? throw new ArgumentNullException(nameof(namespaceId));
            m_Logger    = logger ?? throw new ArgumentNullException(nameof(logger));

            m_Logger.LogDebug($"Initializing documentation object for namespace '{namespaceId.Name}'");

            Types      = ReadOnlyCollectionAdapter.Create(m_Types.Values);
            Namespaces = ReadOnlyCollectionAdapter.Create(m_Namespaces.Values);
            //TODO: Support XML docs for namespaces
        }