Пример #1
0
        /// <summary>
        ///   Validates that all the child names are unique.
        /// </summary>
        /// <exception cref="InvalidOperationException">Two child objects were found with the same name.</exception>
        private void ValidateChildNames()
        {
            List <BaseTypeInfo> childList = new List <BaseTypeInfo>();

            childList.AddRange(DeclaredTypes);
            childList.AddRange(Functions);
            childList.AddRange(Procedures);
            childList.AddRange(SubModule.GetUniqueComponents(SubModules, true));
            childList.AddRange(Signals);
            childList.AddRange(Aliases);
            childList.AddRange(AttributeDeclarationInfo.GetUniqueAttributeDeclarations(Attributes));
            childList.AddRange(Processes);
            childList.AddRange(Generates);
            childList.AddRange(SubModules);

            BaseTypeInfo.ValidateNoDuplicates(childList.ToArray(), Entity.Name, "module");
        }
        /// <summary>
        ///   Instantiates a new <see cref="AttributeSpecificationInfo"/> object.
        /// </summary>
        /// <param name="declaration"><see cref="AttributeDeclarationInfo"/> object representing the declaration of the attribute.</param>
        /// <param name="item"><see cref="BaseTypeInfo"/> object representing the item the attribute is applied to.</param>
        /// <param name="value">Value of the attribute.</param>
        /// <param name="summary">Summary description of the attribute specification.</param>
        /// <param name="remarks">Additional remarks to add to the documentation.</param>
        /// <remarks>Currently only <see cref="DeclarationInfo"/> and <see cref="SignalInfo"/> types are supported for <paramref name="item"/>.</remarks>
        /// <exception cref="ArgumentNullException"><paramref name="declaration"/>, <paramref name="item"/>, <paramref name="value"/>, or <paramref name="summary"/> is a null reference.</exception>
        /// <exception cref="ArgumentException"><paramref name="value"/>, or <paramref name="summary"/> is an empty string or <paramref name="item"/> is not a supported type.</exception>
        public AttributeSpecificationInfo(AttributeDeclarationInfo declaration, BaseTypeInfo item, string value, string summary, string remarks = null)
        {
            if (declaration == null)
            {
                throw new ArgumentNullException("declaration");
            }
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            if (value.Length == 0)
            {
                throw new ArgumentException("value is an empty string");
            }
            if (summary == null)
            {
                throw new ArgumentNullException("summary");
            }
            if (summary.Length == 0)
            {
                throw new ArgumentException("summary is an empty string");
            }

            if (!(item is DeclarationInfo) && !(item is SignalInfo))
            {
                throw new ArgumentException("item is not a DeclarationInfo or SignalInfo type");
            }

            Declaration = declaration;
            Item        = item;
            Value       = value;
            Summary     = summary;
            Remarks     = remarks;
        }
Пример #3
0
        /// <summary>
        ///   Generates the module sub-information.
        /// </summary>
        /// <param name="info"><see cref="ModuleInfo"/> object to generate the sub-information on.</param>
        /// <returns>Lookup table of the sub-information.</returns>
        private Dictionary <string, List <string> > GenerateModuleSubInfo(ModuleInfo info)
        {
            Dictionary <string, List <string> > lookup = new Dictionary <string, List <string> >();

            // Add Functions.
            if (info.Functions.Count > 0)
            {
                info.Functions.Sort();
                lookup.Add("Functions:", GenerateNamesFromBaseTypeInfo(info.Functions.ToArray()));
            }

            // Add Declarations.
            if (info.DeclaredTypes.Count > 0)
            {
                info.DeclaredTypes.Sort();
                lookup.Add("Constants & Types:", GenerateNamesFromBaseTypeInfo(info.DeclaredTypes.ToArray()));
            }

            // Add Procedures.
            if (info.Procedures.Count > 0)
            {
                info.Procedures.Sort();
                lookup.Add("Procedures:", GenerateNamesFromBaseTypeInfo(info.Procedures.ToArray()));
            }

            if (info.SubModules.Count > 0)
            {
                info.SubModules.Sort();
            }

            // Add Components.
            ComponentInfo[] components = SubModule.GetUniqueComponents(info.SubModules, true);
            if (components.Length > 0)
            {
                lookup.Add("Components:", GenerateNamesFromBaseTypeInfo(components));
            }

            // Add Signals.
            if (info.Signals.Count > 0)
            {
                info.Signals.Sort();
                lookup.Add("Signals:", GenerateNamesFromBaseTypeInfo(info.Signals.ToArray()));
            }

            // Add Aliases.
            if (info.Aliases.Count > 0)
            {
                info.Aliases.Sort();
                lookup.Add("Aliases:", GenerateNamesFromBaseTypeInfo(info.Aliases.ToArray()));
            }

            if (info.Attributes.Count > 0)
            {
                info.Attributes.Sort();
            }

            // Add Attributes.
            AttributeDeclarationInfo[] declarations = AttributeDeclarationInfo.GetUniqueAttributeDeclarations(info.Attributes);
            if (declarations.Length > 0)
            {
                lookup.Add("Attributes:", GenerateNamesFromBaseTypeInfo(declarations));
            }

            // Add Processes.
            if (info.Processes.Count > 0)
            {
                info.Processes.Sort();
                lookup.Add("Processes:", GenerateNamesFromBaseTypeInfo(info.Processes.ToArray()));
            }

            // Add Generates.
            if (info.Generates.Count > 0)
            {
                info.Generates.Sort();
                lookup.Add("Generates:", GenerateNamesFromBaseTypeInfo(info.Generates.ToArray()));
            }

            // Add Sub-Modules.
            if (info.SubModules.Count > 0)
            {
                lookup.Add("Sub-Modules:", GenerateNamesFromBaseTypeInfo(info.SubModules.ToArray()));
            }

            return(lookup);
        }